PlayerAdapterConformanceTest
Language-neutral PlayerAdapter conformance suite (Kotlin port of the web @dolby-optiview/ads-sdk-adapter-test-kit). Subclass it for a concrete adapter, provide createAdapter, and the inherited tests assert the shared contract every OptiView Ads PlayerAdapter must satisfy:
state properties (
currentTime/duration/paused/muted/volume/programDateTime),volume clamping to
[0, 1]and mute pass-through,subscription lifecycle (
on/off, multiple handlers, idempotentdestroy),optional capabilities (
preload,supportsParallelBuffering).
Event delivery is platform-dependent: it is only asserted when the platform can synthesize a player event headlessly (see triggerVolumeChange). On Android, ExoPlayer volume/playback events need real playback or a device, so delivery is covered by on-device integration; here it is skipped via Assume.
See also
Functions
Create a fresh adapter wrapping a fresh underlying player.
A volumechange reaches a subscribed handler and stops after PlayerAdapter.off; skipped when triggerVolumeChange returns false.
Calling PlayerAdapter.destroy twice does not throw.
A fresh adapter reports position 0, an infinite duration and a paused player.
Setting PlayerAdapter.muted reads back the same value.
PlayerAdapter.preload of a URL does not throw.
PlayerAdapter.programDateTime is null before any stream is loaded.
PlayerAdapter.on and PlayerAdapter.off accept every PlayerAdapterEvent without throwing.
PlayerAdapter.supportsParallelBuffering is true, false or null.
Destroys the adapter created for the test; runs after every test.
Synthesize a volumechange on the adapter's underlying player so delivery can be asserted headlessly. Return false if the platform cannot trigger it without real playback/a device (the delivery test is then skipped).
PlayerAdapter.setVideoQuality with null returns false and does not throw.
Setting PlayerAdapter.volume reads back the same value, clamped to 0.0..1.0.