TestPlayerRunHelper.ExoPlayerRunResult


public final class TestPlayerRunHelper.ExoPlayerRunResult extends TestPlayerRunHelper.PlayerRunResult


An ExoPlayer specific subclass of PlayerRunResult, giving access to conditions that only make sense for the ExoPlayer interface.

Summary

Public methods

TestPlayerRunHelper.ExoPlayerRunResult

Returns a new instance where the untilXXX(...) methods ignore non-fatal errors.

void

Runs tasks of the main Looper until the player completely handled all previously issued commands on the internal playback thread.

ExoPlaybackException

Runs tasks of the main Looper until a player error occurs.

void
untilPosition(int mediaItemIndex, long positionMs)

Runs tasks of the main Looper until playback reaches the specified position or an error occurs.

void
untilSleepingForOffloadBecomes(boolean expectedSleepingForOffload)

Runs tasks of the main Looper until isSleepingForOffload matches the expected value, or an error occurs.

void
untilStartOfMediaItem(int mediaItemIndex)

Runs tasks of the main Looper until playback reaches the specified media item or a playback error occurs.

Inherited methods

From androidx.media3.test.utils.robolectric.TestPlayerRunHelper.PlayerRunResult
final void

Runs the main Looper until predicate returns true or an error occurs.

void

Runs tasks of the main Looper until onRenderedFirstFrame is called or an error occurs.

final void
untilLoadingIs(boolean expectedIsLoading)

Runs tasks of the main Looper until isLoading matches the expected value or an error occurs.

final void
untilPlayWhenReadyIs(boolean expectedPlayWhenReady)

Runs tasks of the main Looper until getPlayWhenReady matches the expected value or an error occurs.

final void

Runs tasks of the main Looper until onPositionDiscontinuity is called with the specified Player.DiscontinuityReason or an error occurs.

final void
untilState(@Player.State int expectedState)

Runs tasks of the main Looper until getPlaybackState matches the expected state or an error occurs.

final Timeline

Runs tasks of the main Looper until a timeline change or an error occurs.

final void
untilTimelineChangesTo(Timeline expectedTimeline)

Runs tasks of the main Looper until getCurrentTimeline matches the expected timeline or an error occurs.

Public methods

ignoringNonFatalErrors

public TestPlayerRunHelper.ExoPlayerRunResult ignoringNonFatalErrors()

Returns a new instance where the untilXXX(...) methods ignore non-fatal errors.

A fatal error is defined as an error that is passed to onPlayerError and results in the player transitioning to STATE_IDLE. A non-fatal error is defined as an error that is passed to any other callback (e.g. onLoadError).

untilPendingCommandsAreFullyHandled

public void untilPendingCommandsAreFullyHandled()

Runs tasks of the main Looper until the player completely handled all previously issued commands on the internal playback thread.

Both fatal and non-fatal errors are always ignored.

untilPlayerError

public ExoPlaybackException untilPlayerError()

Runs tasks of the main Looper until a player error occurs.

Non-fatal errors are always ignored.

untilPosition

public void untilPosition(int mediaItemIndex, long positionMs)

Runs tasks of the main Looper until playback reaches the specified position or an error occurs.

The playback thread is automatically blocked from making further progress after reaching this position and will only be unblocked by other run()/play().untilXXX(...) method chains, custom runMainLooperUntil conditions, or an explicit unblockThreadsWaitingForProgressOnCurrentLooper on the main thread.

untilSleepingForOffloadBecomes

public void untilSleepingForOffloadBecomes(boolean expectedSleepingForOffload)

Runs tasks of the main Looper until isSleepingForOffload matches the expected value, or an error occurs.

untilStartOfMediaItem

public void untilStartOfMediaItem(int mediaItemIndex)

Runs tasks of the main Looper until playback reaches the specified media item or a playback error occurs.

The playback thread is automatically blocked from making further progress after reaching the media item and will only be unblocked by other run()/play().untilXXX(...) method chains, custom runMainLooperUntil conditions, or an explicit unblockThreadsWaitingForProgressOnCurrentLooper on the main thread.

Parameters
int mediaItemIndex

The index of the media item.