PlayerAudioFocusContractTest


@UnstableApi
public 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 methods

abstract PlayerAudioFocusContractTest.PlayerInfo

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

Public constructors

PlayerAudioFocusContractTest

public PlayerAudioFocusContractTest()

Public methods

audioFocusLoss_whilePaused_rereportsPausedWithFocusLoss

@Test
public void audioFocusLoss_whilePaused_rereportsPausedWithFocusLoss()

audioFocusLost_whilePlaying_pausesPlayback

@Test
public void audioFocusLost_whilePlaying_pausesPlayback()

getPlaybackSuppressionReason_withUnpreparedPlayer_returnsNone

@Test
public void getPlaybackSuppressionReason_withUnpreparedPlayer_returnsNone()

pause_duringTransientLossWhilePlaying_keepsPlaybackPausedAndSuppressed

@Test
public void pause_duringTransientLossWhilePlaying_keepsPlaybackPausedAndSuppressed(

)

play_duringTransientLossWhilePaused_continuesPlayback

@Test
public void play_duringTransientLossWhilePaused_continuesPlayback()

play_duringTransientLossWhilePlaying_continuesPlayback

@Test
public void play_duringTransientLossWhilePlaying_continuesPlayback()

play_withAudioFocusRequestDenied_doesNotPlay

@Test
public void play_withAudioFocusRequestDenied_doesNotPlay()

play_withAudioFocusRequestGranted_startsPlayback

@Test
public void play_withAudioFocusRequestGranted_startsPlayback()

play_withHandleAudioFocusDisabled_ignoresDeniedRequestAndStartsPlayback

@Test
public void play_withHandleAudioFocusDisabled_ignoresDeniedRequestAndStartsPlayback(

)

player_hasRequiredCommandsAvailable

@Test
public void player_hasRequiredCommandsAvailable()

tearDown

@After
public final void tearDown()

transientLossAndGain_whilePaused_suppressesPlayback

@Test
public void transientLossAndGain_whilePaused_suppressesPlayback()

transientLossAndGain_whilePlaying_suppressesPlaybackWhileLost

@Test
public void transientLossAndGain_whilePlaying_suppressesPlaybackWhileLost()

Protected methods

createPlayerInfo

@ForOverride
protected abstract PlayerAudioFocusContractTest.PlayerInfo createPlayerInfo()

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

The player must have audio focus handling initially disabled.