PlayerAudioFocusContractTest


@UnstableApi
abstract class PlayerAudioFocusContractTest


A collection of contract tests for Player implementations that support COMMAND_SET_AUDIO_ATTRIBUTES.

Subclasses should only include the logic necessary to construct the Player and return the player's internal Clock and internal processing Looper by overriding createPlayerInfo.

Subclasses shouldn't include any new @Test methods - implementation-specific tests should be in a separate class.

Summary

Nested types

Interface that allows access to a Player instance and its internal Clock and processing Looper.

Public constructors

Protected functions

abstract PlayerAudioFocusContractTest.PlayerInfo!

Creates and returns the PlayerInfo with which to run the tests.

Public constructors

PlayerAudioFocusContractTest

PlayerAudioFocusContractTest()

Public functions

audioFocusLoss_whilePaused_rereportsPausedWithFocusLoss

@Test
fun audioFocusLoss_whilePaused_rereportsPausedWithFocusLoss(): Unit

audioFocusLost_whilePlaying_pausesPlayback

@Test
fun audioFocusLost_whilePlaying_pausesPlayback(): Unit

getPlaybackSuppressionReason_withUnpreparedPlayer_returnsNone

@Test
fun getPlaybackSuppressionReason_withUnpreparedPlayer_returnsNone(): Unit

pause_duringTransientLossWhilePlaying_keepsPlaybackPausedAndSuppressed

@Test
fun pause_duringTransientLossWhilePlaying_keepsPlaybackPausedAndSuppressed(

): Unit

play_duringTransientLossWhilePaused_continuesPlayback

@Test
fun play_duringTransientLossWhilePaused_continuesPlayback(): Unit

play_duringTransientLossWhilePlaying_continuesPlayback

@Test
fun play_duringTransientLossWhilePlaying_continuesPlayback(): Unit

play_withAudioFocusRequestDenied_doesNotPlay

@Test
fun play_withAudioFocusRequestDenied_doesNotPlay(): Unit

play_withAudioFocusRequestGranted_startsPlayback

@Test
fun play_withAudioFocusRequestGranted_startsPlayback(): Unit

play_withHandleAudioFocusDisabled_ignoresDeniedRequestAndStartsPlayback

@Test
fun play_withHandleAudioFocusDisabled_ignoresDeniedRequestAndStartsPlayback(

): Unit

player_hasRequiredCommandsAvailable

@Test
fun player_hasRequiredCommandsAvailable(): Unit

tearDown

@After
fun tearDown(): Unit

transientLossAndGain_whilePaused_suppressesPlayback

@Test
fun transientLossAndGain_whilePaused_suppressesPlayback(): Unit

transientLossAndGain_whilePlaying_suppressesPlaybackWhileLost

@Test
fun transientLossAndGain_whilePlaying_suppressesPlaybackWhileLost(): Unit

Protected functions

createPlayerInfo

@ForOverride
protected abstract fun createPlayerInfo(): PlayerAudioFocusContractTest.PlayerInfo!

Creates and returns the PlayerInfo with which to run the tests.

The player must have audio focus handling initially disabled.