ExoHostedTest
@UnstableApi
public abstract class ExoHostedTest implements HostActivity.HostedTest
A HostedTest for ExoPlayer playback tests.
Summary
Constants |
|
|---|---|
static final long |
|
static final long |
|
static final long |
Public constructors |
|---|
ExoHostedTest(@Size(max = 23) String tag, boolean fullPlaybackNoSeeking) |
ExoHostedTest( |
Public methods |
|
|---|---|
final boolean |
blockUntilStopped(long timeoutMs)Called on the main thread to block until the test has stopped or |
final boolean |
Called on the main thread to force stop the test (if it is not stopped already). |
final void |
Called on the test thread after the test has finished and been stopped. |
final void |
onStart(Called on the main thread when the test is started. |
final void |
setSchedule(ActionSchedule schedule)Sets a schedule to be applied during the test. |
Protected methods |
|
|---|---|
void |
assertPassed( |
DrmSessionManager |
|
ExoPlayer |
buildExoPlayer( |
abstract MediaSource |
buildSource( |
DefaultTrackSelector |
|
void |
logMetrics( |
void |
Constants
EXPECTED_PLAYING_TIME_MEDIA_DURATION_MS
public static final long EXPECTED_PLAYING_TIME_MEDIA_DURATION_MS = -2
Public constructors
ExoHostedTest
public ExoHostedTest(@Size(max = 23) String tag, boolean fullPlaybackNoSeeking)
| Parameters | |
|---|---|
@Size(max = 23) String tag |
A tag to use for logging. |
boolean fullPlaybackNoSeeking |
Whether the test will play the target media in full without seeking. If set to true, the test will assert that the total time spent playing the media was within |
ExoHostedTest
public ExoHostedTest(
@Size(max = 23) String tag,
long expectedPlayingTimeMs,
boolean failOnPlayerError
)
| Parameters | |
|---|---|
@Size(max = 23) String tag |
A tag to use for logging. |
long expectedPlayingTimeMs |
The expected playing time. If set to a non-negative value, the test will assert that the total time spent playing the media was within |
boolean failOnPlayerError |
Whether a player error should be considered a test failure. |
Public methods
blockUntilStopped
public final boolean blockUntilStopped(long timeoutMs)
Called on the main thread to block until the test has stopped or forceStop is called.
| Parameters | |
|---|---|
long timeoutMs |
The maximum time to block in milliseconds. |
| Returns | |
|---|---|
boolean |
Whether the test has stopped successful. |
forceStop
public final boolean forceStop()
Called on the main thread to force stop the test (if it is not stopped already).
| Returns | |
|---|---|
boolean |
Whether the test was forced stopped. |
onFinished
public final void onFinished()
Called on the test thread after the test has finished and been stopped.
Implementations may use this method to assert that test criteria were met.
onStart
public final void onStart(
HostActivity host,
Surface surface,
FrameLayout overlayFrameLayout
)
Called on the main thread when the test is started.
The test will not be started until the HostActivity has been resumed and its Surface has been created.
| Parameters | |
|---|---|
HostActivity host |
The |
Surface surface |
The |
FrameLayout overlayFrameLayout |
A |
setSchedule
public final void setSchedule(ActionSchedule schedule)
Sets a schedule to be applied during the test.
| Parameters | |
|---|---|
ActionSchedule schedule |
The schedule. |
Protected methods
assertPassed
protected void assertPassed(
DecoderCounters audioCounters,
DecoderCounters videoCounters
)
buildExoPlayer
protected ExoPlayer buildExoPlayer(
HostActivity host,
Surface surface,
MappingTrackSelector trackSelector
)
buildSource
protected abstract MediaSource buildSource(
HostActivity host,
DrmSessionManager drmSessionManager,
FrameLayout overlayFrameLayout
)