public class

TestPlayerRunHelper.PlayerRunResult

extends java.lang.Object

 java.lang.Object

↳androidx.media3.test.utils.robolectric.TestPlayerRunHelper.PlayerRunResult

Subclasses:

TestPlayerRunHelper.ExoPlayerRunResult

Overview

Intermediate type that allows callers to run the main until certain conditions are met.

If an error occurs while a untilXXX(...) method is waiting for the condition to become true, most methods will throw that error (exceptions to this are documented on specific methods below). Use TestPlayerRunHelper.PlayerRunResult.ignoringNonFatalErrors() to ignore non-fatal errors and only fail on fatal playback errors.

Instances of this class should only be used for a single untilXXX() invocation and not be re-used.

Summary

Fields
protected booleanhasBeenUsed

protected final booleanplayBeforeWaiting

Methods
public TestPlayerRunHelper.PlayerRunResultignoringNonFatalErrors()

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

protected final voidrunUntil(<any> predicate)

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

public voiduntilFirstFrameIsRendered()

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

public final voiduntilLoadingIs(boolean expectedIsLoading)

Runs tasks of the main until Player.isLoading() matches the expected value or an error occurs.

public PlaybackExceptionuntilPlayerError()

Runs tasks of the main until a player error occurs.

public final voiduntilPlayWhenReadyIs(boolean expectedPlayWhenReady)

Runs tasks of the main until Player.getPlayWhenReady() matches the expected value or an error occurs.

public final voiduntilPositionDiscontinuityWithReason(int expectedReason)

Runs tasks of the main until is called with the specified or an error occurs.

public final voiduntilState(int expectedState)

Runs tasks of the main until Player.getPlaybackState() matches the expected state or an error occurs.

public final TimelineuntilTimelineChanges()

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

public final voiduntilTimelineChangesTo(Timeline expectedTimeline)

Runs tasks of the main until Player.getCurrentTimeline() matches the expected timeline or an error occurs.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Fields

protected final boolean playBeforeWaiting

protected boolean hasBeenUsed

Methods

public final void untilState(int expectedState)

Runs tasks of the main until Player.getPlaybackState() matches the expected state or an error occurs.

public final void untilPlayWhenReadyIs(boolean expectedPlayWhenReady)

Runs tasks of the main until Player.getPlayWhenReady() matches the expected value or an error occurs.

public final void untilLoadingIs(boolean expectedIsLoading)

Runs tasks of the main until Player.isLoading() matches the expected value or an error occurs.

public final Timeline untilTimelineChanges()

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

public final void untilTimelineChangesTo(Timeline expectedTimeline)

Runs tasks of the main until Player.getCurrentTimeline() matches the expected timeline or an error occurs.

public final void untilPositionDiscontinuityWithReason(int expectedReason)

Runs tasks of the main until is called with the specified or an error occurs.

public PlaybackException untilPlayerError()

Runs tasks of the main until a player error occurs.

Non-fatal errors are always ignored.

Returns:

The raised PlaybackException.

public void untilFirstFrameIsRendered()

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

public TestPlayerRunHelper.PlayerRunResult 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 and results in the player transitioning to Player.STATE_IDLE. A non-fatal error is defined as an error that is passed to any other callback (e.g. AnalyticsListener.onLoadError(AnalyticsListener.EventTime, LoadEventInfo, MediaLoadData, IOException, boolean)).

protected final void runUntil(<any> predicate)

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