Commit bb33d568 by tonihei Committed by Oliver Woodman

Remove test-specific ActionSchedule tags

There is no need for that, updating them is often forgotten and
takes up too much line space. Replace by a single TAG per test class.

PiperOrigin-RevId: 300113072
parent 0d230d51
...@@ -94,6 +94,8 @@ import org.robolectric.shadows.ShadowAudioManager; ...@@ -94,6 +94,8 @@ import org.robolectric.shadows.ShadowAudioManager;
@LooperMode(LooperMode.Mode.PAUSED) @LooperMode(LooperMode.Mode.PAUSED)
public final class ExoPlayerTest { public final class ExoPlayerTest {
private static final String TAG = "ExoPlayerTest";
/** /**
* For tests that rely on the player transitioning to the ended state, the duration in * For tests that rely on the player transitioning to the ended state, the duration in
* milliseconds after starting the player before the test will time out. This is to catch cases * milliseconds after starting the player before the test will time out. This is to catch cases
...@@ -324,7 +326,7 @@ public final class ExoPlayerTest { ...@@ -324,7 +326,7 @@ public final class ExoPlayerTest {
// test thread to set a third source, and block the playback thread until the test thread's call // test thread to set a third source, and block the playback thread until the test thread's call
// to setMediaSources() has returned. // to setMediaSources() has returned.
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testResettingMediaSourcesGivesFreshSourceInfo") new ActionSchedule.Builder(TAG)
.waitForTimelineChanged( .waitForTimelineChanged(
firstTimeline, /* expectedReason */ Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE) firstTimeline, /* expectedReason */ Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE)
.setMediaSources(secondSource) .setMediaSources(secondSource)
...@@ -370,7 +372,7 @@ public final class ExoPlayerTest { ...@@ -370,7 +372,7 @@ public final class ExoPlayerTest {
Timeline timeline = new FakeTimeline(/* windowCount= */ 3); Timeline timeline = new FakeTimeline(/* windowCount= */ 3);
FakeRenderer renderer = new FakeRenderer(Builder.VIDEO_FORMAT); FakeRenderer renderer = new FakeRenderer(Builder.VIDEO_FORMAT);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testRepeatMode") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForTimelineChanged( .waitForTimelineChanged(
timeline, /* expectedReason */ Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE) timeline, /* expectedReason */ Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE)
...@@ -427,7 +429,7 @@ public final class ExoPlayerTest { ...@@ -427,7 +429,7 @@ public final class ExoPlayerTest {
new ConcatenatingMediaSource(false, new FakeShuffleOrder(3), fakeMediaSources); new ConcatenatingMediaSource(false, new FakeShuffleOrder(3), fakeMediaSources);
FakeRenderer renderer = new FakeRenderer(Builder.VIDEO_FORMAT); FakeRenderer renderer = new FakeRenderer(Builder.VIDEO_FORMAT);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testShuffleModeEnabled") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.setRepeatMode(Player.REPEAT_MODE_ALL) .setRepeatMode(Player.REPEAT_MODE_ALL)
...@@ -484,7 +486,7 @@ public final class ExoPlayerTest { ...@@ -484,7 +486,7 @@ public final class ExoPlayerTest {
errorAdPlaybackState)); errorAdPlaybackState));
final FakeMediaSource fakeMediaSource = new FakeMediaSource(fakeTimeline, Builder.VIDEO_FORMAT); final FakeMediaSource fakeMediaSource = new FakeMediaSource(fakeTimeline, Builder.VIDEO_FORMAT);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testAdGroupWithLoadErrorIsSkipped") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.executeRunnable(() -> fakeMediaSource.setNewSourceInfo(adErrorTimeline)) .executeRunnable(() -> fakeMediaSource.setNewSourceInfo(adErrorTimeline))
...@@ -507,7 +509,7 @@ public final class ExoPlayerTest { ...@@ -507,7 +509,7 @@ public final class ExoPlayerTest {
public void periodHoldersReleasedAfterSeekWithRepeatModeAll() throws Exception { public void periodHoldersReleasedAfterSeekWithRepeatModeAll() throws Exception {
FakeRenderer renderer = new FakeRenderer(Builder.VIDEO_FORMAT); FakeRenderer renderer = new FakeRenderer(Builder.VIDEO_FORMAT);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testPeriodHoldersReleased") new ActionSchedule.Builder(TAG)
.setRepeatMode(Player.REPEAT_MODE_ALL) .setRepeatMode(Player.REPEAT_MODE_ALL)
.waitForPositionDiscontinuity() .waitForPositionDiscontinuity()
.seek(0) // Seek with repeat mode set to Player.REPEAT_MODE_ALL. .seek(0) // Seek with repeat mode set to Player.REPEAT_MODE_ALL.
...@@ -527,7 +529,7 @@ public final class ExoPlayerTest { ...@@ -527,7 +529,7 @@ public final class ExoPlayerTest {
public void seekProcessedCallback() throws Exception { public void seekProcessedCallback() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 2); Timeline timeline = new FakeTimeline(/* windowCount= */ 2);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSeekProcessedCallback") new ActionSchedule.Builder(TAG)
// Initial seek. Expect immediate seek processed. // Initial seek. Expect immediate seek processed.
.pause() .pause()
.seek(5) .seek(5)
...@@ -592,7 +594,7 @@ public final class ExoPlayerTest { ...@@ -592,7 +594,7 @@ public final class ExoPlayerTest {
public void illegalSeekPositionDoesThrow() throws Exception { public void illegalSeekPositionDoesThrow() throws Exception {
final IllegalSeekPositionException[] exception = new IllegalSeekPositionException[1]; final IllegalSeekPositionException[] exception = new IllegalSeekPositionException[1];
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testIllegalSeekPositionDoesThrow") new ActionSchedule.Builder(TAG)
.waitForPlaybackState(Player.STATE_BUFFERING) .waitForPlaybackState(Player.STATE_BUFFERING)
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
...@@ -619,8 +621,7 @@ public final class ExoPlayerTest { ...@@ -619,8 +621,7 @@ public final class ExoPlayerTest {
@Test @Test
public void seekDiscontinuity() throws Exception { public void seekDiscontinuity() throws Exception {
FakeTimeline timeline = new FakeTimeline(1); FakeTimeline timeline = new FakeTimeline(1);
ActionSchedule actionSchedule = ActionSchedule actionSchedule = new ActionSchedule.Builder(TAG).seek(10).build();
new ActionSchedule.Builder("testSeekDiscontinuity").seek(10).build();
ExoPlayerTestRunner testRunner = ExoPlayerTestRunner testRunner =
new ExoPlayerTestRunner.Builder() new ExoPlayerTestRunner.Builder()
.setTimeline(timeline) .setTimeline(timeline)
...@@ -649,7 +650,7 @@ public final class ExoPlayerTest { ...@@ -649,7 +650,7 @@ public final class ExoPlayerTest {
} }
}; };
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSeekDiscontinuityAdjust") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.seek(10) .seek(10)
...@@ -787,7 +788,7 @@ public final class ExoPlayerTest { ...@@ -787,7 +788,7 @@ public final class ExoPlayerTest {
FakeRenderer audioRenderer = new FakeRenderer(Builder.AUDIO_FORMAT); FakeRenderer audioRenderer = new FakeRenderer(Builder.AUDIO_FORMAT);
final FakeTrackSelector trackSelector = new FakeTrackSelector(); final FakeTrackSelector trackSelector = new FakeTrackSelector();
ActionSchedule disableTrackAction = ActionSchedule disableTrackAction =
new ActionSchedule.Builder("testChangeTrackSelection") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.disableRenderer(0) .disableRenderer(0)
...@@ -826,7 +827,7 @@ public final class ExoPlayerTest { ...@@ -826,7 +827,7 @@ public final class ExoPlayerTest {
final FakeTrackSelector trackSelector = final FakeTrackSelector trackSelector =
new FakeTrackSelector(/* mayReuseTrackSelection= */ true); new FakeTrackSelector(/* mayReuseTrackSelection= */ true);
ActionSchedule disableTrackAction = ActionSchedule disableTrackAction =
new ActionSchedule.Builder("testReuseTrackSelection") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.disableRenderer(0) .disableRenderer(0)
...@@ -862,7 +863,7 @@ public final class ExoPlayerTest { ...@@ -862,7 +863,7 @@ public final class ExoPlayerTest {
final Timeline timeline2 = new FakeTimeline(new TimelineWindowDefinition(false, false, 20000)); final Timeline timeline2 = new FakeTimeline(new TimelineWindowDefinition(false, false, 20000));
final FakeMediaSource mediaSource = new FakeMediaSource(timeline, Builder.VIDEO_FORMAT); final FakeMediaSource mediaSource = new FakeMediaSource(timeline, Builder.VIDEO_FORMAT);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testDynamicTimelineChangeReason") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForTimelineChanged( .waitForTimelineChanged(
timeline, /* expectedReason */ Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE) timeline, /* expectedReason */ Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE)
...@@ -950,7 +951,7 @@ public final class ExoPlayerTest { ...@@ -950,7 +951,7 @@ public final class ExoPlayerTest {
} }
}; };
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSetPlaybackParametersBeforePreparationCompletesSucceeds") new ActionSchedule.Builder(TAG)
.waitForPlaybackState(Player.STATE_BUFFERING) .waitForPlaybackState(Player.STATE_BUFFERING)
// Block until createPeriod has been called on the fake media source. // Block until createPeriod has been called on the fake media source.
.executeRunnable( .executeRunnable(
...@@ -979,7 +980,7 @@ public final class ExoPlayerTest { ...@@ -979,7 +980,7 @@ public final class ExoPlayerTest {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
final long[] positionHolder = new long[1]; final long[] positionHolder = new long[1];
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testStopDoesNotResetPosition") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.playUntilPosition(/* windowIndex= */ 0, /* positionMs= */ 50) .playUntilPosition(/* windowIndex= */ 0, /* positionMs= */ 50)
...@@ -1013,7 +1014,7 @@ public final class ExoPlayerTest { ...@@ -1013,7 +1014,7 @@ public final class ExoPlayerTest {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
final long[] positionHolder = new long[1]; final long[] positionHolder = new long[1];
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testStopWithoutResetDoesNotReset") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.playUntilPosition(/* windowIndex= */ 0, /* positionMs= */ 50) .playUntilPosition(/* windowIndex= */ 0, /* positionMs= */ 50)
...@@ -1047,7 +1048,7 @@ public final class ExoPlayerTest { ...@@ -1047,7 +1048,7 @@ public final class ExoPlayerTest {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
final long[] positionHolder = new long[1]; final long[] positionHolder = new long[1];
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testStopWithResetDoesReset") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.playUntilPosition(/* windowIndex= */ 0, /* positionMs= */ 50) .playUntilPosition(/* windowIndex= */ 0, /* positionMs= */ 50)
...@@ -1082,7 +1083,7 @@ public final class ExoPlayerTest { ...@@ -1082,7 +1083,7 @@ public final class ExoPlayerTest {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
final FakeMediaSource mediaSource = new FakeMediaSource(timeline, Builder.VIDEO_FORMAT); final FakeMediaSource mediaSource = new FakeMediaSource(timeline, Builder.VIDEO_FORMAT);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testStopReleasesMediaSource") new ActionSchedule.Builder(TAG)
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.stop(/* reset= */ false) .stop(/* reset= */ false)
.build(); .build();
...@@ -1102,7 +1103,7 @@ public final class ExoPlayerTest { ...@@ -1102,7 +1103,7 @@ public final class ExoPlayerTest {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
final FakeMediaSource mediaSource = new FakeMediaSource(timeline, Builder.VIDEO_FORMAT); final FakeMediaSource mediaSource = new FakeMediaSource(timeline, Builder.VIDEO_FORMAT);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testStopReleasesMediaSource") new ActionSchedule.Builder(TAG)
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.stop(/* reset= */ true) .stop(/* reset= */ true)
.build(); .build();
...@@ -1125,7 +1126,7 @@ public final class ExoPlayerTest { ...@@ -1125,7 +1126,7 @@ public final class ExoPlayerTest {
AtomicInteger windowIndexAfterStop = new AtomicInteger(); AtomicInteger windowIndexAfterStop = new AtomicInteger();
AtomicLong positionAfterStop = new AtomicLong(); AtomicLong positionAfterStop = new AtomicLong();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSettingNewStartPositionPossibleAfterStopWithReset") new ActionSchedule.Builder(TAG)
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.stop(/* reset= */ true) .stop(/* reset= */ true)
.waitForPlaybackState(Player.STATE_IDLE) .waitForPlaybackState(Player.STATE_IDLE)
...@@ -1191,7 +1192,7 @@ public final class ExoPlayerTest { ...@@ -1191,7 +1192,7 @@ public final class ExoPlayerTest {
MediaSource secondSource = new FakeMediaSource(secondTimeline); MediaSource secondSource = new FakeMediaSource(secondTimeline);
AtomicLong positionAfterReprepare = new AtomicLong(); AtomicLong positionAfterReprepare = new AtomicLong();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testResetPlaylistWithPreviousPosition") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.playUntilPosition(/* windowIndex= */ 0, /* positionMs= */ 2000) .playUntilPosition(/* windowIndex= */ 0, /* positionMs= */ 2000)
...@@ -1243,7 +1244,7 @@ public final class ExoPlayerTest { ...@@ -1243,7 +1244,7 @@ public final class ExoPlayerTest {
MediaSource secondSource = new FakeMediaSource(secondTimeline); MediaSource secondSource = new FakeMediaSource(secondTimeline);
AtomicLong positionAfterReprepare = new AtomicLong(); AtomicLong positionAfterReprepare = new AtomicLong();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testResetPlaylistStartsFromDefaultPosition") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.playUntilPosition(/* windowIndex= */ 0, /* positionMs= */ 2000) .playUntilPosition(/* windowIndex= */ 0, /* positionMs= */ 2000)
...@@ -1295,7 +1296,7 @@ public final class ExoPlayerTest { ...@@ -1295,7 +1296,7 @@ public final class ExoPlayerTest {
MediaSource secondSource = new FakeMediaSource(secondTimeline); MediaSource secondSource = new FakeMediaSource(secondTimeline);
AtomicLong positionAfterReprepare = new AtomicLong(); AtomicLong positionAfterReprepare = new AtomicLong();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testResetPlaylistWithoutResettingPositionStartsFromOldPosition") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.playUntilPosition(/* windowIndex= */ 0, /* positionMs= */ 2000) .playUntilPosition(/* windowIndex= */ 0, /* positionMs= */ 2000)
...@@ -1334,7 +1335,7 @@ public final class ExoPlayerTest { ...@@ -1334,7 +1335,7 @@ public final class ExoPlayerTest {
public void stopDuringPreparationOverwritesPreparation() throws Exception { public void stopDuringPreparationOverwritesPreparation() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testStopOverwritesPrepare") new ActionSchedule.Builder(TAG)
.waitForPlaybackState(Player.STATE_BUFFERING) .waitForPlaybackState(Player.STATE_BUFFERING)
.seek(0) .seek(0)
.stop(true) .stop(true)
...@@ -1361,7 +1362,7 @@ public final class ExoPlayerTest { ...@@ -1361,7 +1362,7 @@ public final class ExoPlayerTest {
// callback which ensures that all operations have been processed by the player. // callback which ensures that all operations have been processed by the player.
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testStopTwice") new ActionSchedule.Builder(TAG)
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.stop(false) .stop(false)
.stop(false) .stop(false)
...@@ -1387,7 +1388,7 @@ public final class ExoPlayerTest { ...@@ -1387,7 +1388,7 @@ public final class ExoPlayerTest {
public void reprepareAfterPlaybackError() throws Exception { public void reprepareAfterPlaybackError() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testReprepareAfterPlaybackError") new ActionSchedule.Builder(TAG)
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.throwPlaybackException(ExoPlaybackException.createForSource(new IOException())) .throwPlaybackException(ExoPlaybackException.createForSource(new IOException()))
.waitForPlaybackState(Player.STATE_IDLE) .waitForPlaybackState(Player.STATE_IDLE)
...@@ -1416,7 +1417,7 @@ public final class ExoPlayerTest { ...@@ -1416,7 +1417,7 @@ public final class ExoPlayerTest {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
final long[] positionHolder = new long[2]; final long[] positionHolder = new long[2];
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testReprepareAfterPlaybackError") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.throwPlaybackException(ExoPlaybackException.createForSource(new IOException())) .throwPlaybackException(ExoPlaybackException.createForSource(new IOException()))
...@@ -1468,7 +1469,7 @@ public final class ExoPlayerTest { ...@@ -1468,7 +1469,7 @@ public final class ExoPlayerTest {
FakeMediaSource mediaSource = new FakeMediaSource(new FakeTimeline(/* windowCount= */ 2)); FakeMediaSource mediaSource = new FakeMediaSource(new FakeTimeline(/* windowCount= */ 2));
AtomicInteger windowIndexAfterUpdate = new AtomicInteger(); AtomicInteger windowIndexAfterUpdate = new AtomicInteger();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testInvalidSeekPositionSourceInfoRefreshUsesCorrectFirstPeriod") new ActionSchedule.Builder(TAG)
.setShuffleOrder(new FakeShuffleOrder(/* length= */ 0)) .setShuffleOrder(new FakeShuffleOrder(/* length= */ 0))
.setShuffleModeEnabled(true) .setShuffleModeEnabled(true)
.waitForPlaybackState(Player.STATE_BUFFERING) .waitForPlaybackState(Player.STATE_BUFFERING)
...@@ -1541,7 +1542,7 @@ public final class ExoPlayerTest { ...@@ -1541,7 +1542,7 @@ public final class ExoPlayerTest {
final int[] windowIndexHolder = new int[3]; final int[] windowIndexHolder = new int[3];
final FakeMediaSource firstMediaSource = new FakeMediaSource(timeline); final FakeMediaSource firstMediaSource = new FakeMediaSource(timeline);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testPlaybackErrorDoesNotResetPosition") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.playUntilPosition(/* windowIndex= */ 1, /* positionMs= */ 500) .playUntilPosition(/* windowIndex= */ 1, /* positionMs= */ 500)
...@@ -1604,7 +1605,7 @@ public final class ExoPlayerTest { ...@@ -1604,7 +1605,7 @@ public final class ExoPlayerTest {
final int[] windowIndexHolder = {C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET}; final int[] windowIndexHolder = {C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET};
final FakeMediaSource firstMediaSource = new FakeMediaSource(timeline); final FakeMediaSource firstMediaSource = new FakeMediaSource(timeline);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSeekAfterPlaybackError") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.playUntilPosition(/* windowIndex= */ 1, /* positionMs= */ 500) .playUntilPosition(/* windowIndex= */ 1, /* positionMs= */ 500)
...@@ -1666,7 +1667,7 @@ public final class ExoPlayerTest { ...@@ -1666,7 +1667,7 @@ public final class ExoPlayerTest {
throws Exception { throws Exception {
FakeMediaSource mediaSource = new FakeMediaSource(new FakeTimeline(/* windowCount= */ 1)); FakeMediaSource mediaSource = new FakeMediaSource(new FakeTimeline(/* windowCount= */ 1));
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("playbackErrorWithResetKeepsWindowSequenceNumber") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.throwPlaybackException(ExoPlaybackException.createForSource(new IOException())) .throwPlaybackException(ExoPlaybackException.createForSource(new IOException()))
...@@ -1707,7 +1708,7 @@ public final class ExoPlayerTest { ...@@ -1707,7 +1708,7 @@ public final class ExoPlayerTest {
final Timeline timeline = new FakeTimeline(/* windowCount= */ 1); final Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
final FakeMediaSource mediaSource2 = new FakeMediaSource(timeline); final FakeMediaSource mediaSource2 = new FakeMediaSource(timeline);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testPlaybackErrorDoesNotResetPosition") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.throwPlaybackException(ExoPlaybackException.createForSource(new IOException())) .throwPlaybackException(ExoPlaybackException.createForSource(new IOException()))
...@@ -1743,7 +1744,7 @@ public final class ExoPlayerTest { ...@@ -1743,7 +1744,7 @@ public final class ExoPlayerTest {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSendMessages") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_BUFFERING) .waitForPlaybackState(Player.STATE_BUFFERING)
.sendMessage(target, /* positionMs= */ 50) .sendMessage(target, /* positionMs= */ 50)
...@@ -1763,7 +1764,7 @@ public final class ExoPlayerTest { ...@@ -1763,7 +1764,7 @@ public final class ExoPlayerTest {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSendMessages") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForTimelineChanged( .waitForTimelineChanged(
timeline, /* expectedReason */ Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE) timeline, /* expectedReason */ Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE)
...@@ -1785,7 +1786,7 @@ public final class ExoPlayerTest { ...@@ -1785,7 +1786,7 @@ public final class ExoPlayerTest {
PositionGrabbingMessageTarget target50 = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target50 = new PositionGrabbingMessageTarget();
PositionGrabbingMessageTarget target80 = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target80 = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSendMessages") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_BUFFERING) .waitForPlaybackState(Player.STATE_BUFFERING)
.sendMessage(target80, /* positionMs= */ 80) .sendMessage(target80, /* positionMs= */ 80)
...@@ -1808,7 +1809,7 @@ public final class ExoPlayerTest { ...@@ -1808,7 +1809,7 @@ public final class ExoPlayerTest {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
AtomicInteger counter = new AtomicInteger(); AtomicInteger counter = new AtomicInteger();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSendMessagesFromStartPositionOnlyOnce") new ActionSchedule.Builder(TAG)
.waitForTimelineChanged() .waitForTimelineChanged()
.pause() .pause()
.sendMessage( .sendMessage(
...@@ -1838,7 +1839,7 @@ public final class ExoPlayerTest { ...@@ -1838,7 +1839,7 @@ public final class ExoPlayerTest {
PositionGrabbingMessageTarget target1 = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target1 = new PositionGrabbingMessageTarget();
PositionGrabbingMessageTarget target2 = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target2 = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSendMessages") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_BUFFERING) .waitForPlaybackState(Player.STATE_BUFFERING)
.sendMessage(target1, /* positionMs= */ 50) .sendMessage(target1, /* positionMs= */ 50)
...@@ -1861,7 +1862,7 @@ public final class ExoPlayerTest { ...@@ -1861,7 +1862,7 @@ public final class ExoPlayerTest {
new FakeTimeline(new TimelineWindowDefinition(/* periodCount= */ 10, /* id= */ 0)); new FakeTimeline(new TimelineWindowDefinition(/* periodCount= */ 10, /* id= */ 0));
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSendMessages") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_BUFFERING) .waitForPlaybackState(Player.STATE_BUFFERING)
.sendMessage(target, /* positionMs= */ 50) .sendMessage(target, /* positionMs= */ 50)
...@@ -1891,7 +1892,7 @@ public final class ExoPlayerTest { ...@@ -1891,7 +1892,7 @@ public final class ExoPlayerTest {
long duration1Ms = timeline.getWindow(0, new Window()).getDurationMs(); long duration1Ms = timeline.getWindow(0, new Window()).getDurationMs();
long duration2Ms = timeline.getWindow(1, new Window()).getDurationMs(); long duration2Ms = timeline.getWindow(1, new Window()).getDurationMs();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSendMessagesAtStartAndEndOfPeriod") new ActionSchedule.Builder(TAG)
.sendMessage(targetStartFirstPeriod, /* windowIndex= */ 0, /* positionMs= */ 0) .sendMessage(targetStartFirstPeriod, /* windowIndex= */ 0, /* positionMs= */ 0)
.sendMessage( .sendMessage(
targetEndMiddlePeriodResolved, targetEndMiddlePeriodResolved,
...@@ -1942,7 +1943,7 @@ public final class ExoPlayerTest { ...@@ -1942,7 +1943,7 @@ public final class ExoPlayerTest {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSendMessages") new ActionSchedule.Builder(TAG)
.waitForPlaybackState(Player.STATE_BUFFERING) .waitForPlaybackState(Player.STATE_BUFFERING)
.sendMessage(target, /* positionMs= */ 50) .sendMessage(target, /* positionMs= */ 50)
.seek(/* positionMs= */ 50) .seek(/* positionMs= */ 50)
...@@ -1961,7 +1962,7 @@ public final class ExoPlayerTest { ...@@ -1961,7 +1962,7 @@ public final class ExoPlayerTest {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSendMessages") new ActionSchedule.Builder(TAG)
.waitForPlaybackState(Player.STATE_BUFFERING) .waitForPlaybackState(Player.STATE_BUFFERING)
.sendMessage(target, /* positionMs= */ 50) .sendMessage(target, /* positionMs= */ 50)
.waitForTimelineChanged( .waitForTimelineChanged(
...@@ -1982,7 +1983,7 @@ public final class ExoPlayerTest { ...@@ -1982,7 +1983,7 @@ public final class ExoPlayerTest {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSendMessages") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_BUFFERING) .waitForPlaybackState(Player.STATE_BUFFERING)
.sendMessage(target, /* positionMs= */ 50) .sendMessage(target, /* positionMs= */ 50)
...@@ -2003,7 +2004,7 @@ public final class ExoPlayerTest { ...@@ -2003,7 +2004,7 @@ public final class ExoPlayerTest {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSendMessages") new ActionSchedule.Builder(TAG)
.pause() .pause()
.sendMessage(target, /* positionMs= */ 50) .sendMessage(target, /* positionMs= */ 50)
.waitForTimelineChanged( .waitForTimelineChanged(
...@@ -2025,7 +2026,7 @@ public final class ExoPlayerTest { ...@@ -2025,7 +2026,7 @@ public final class ExoPlayerTest {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSendMessages") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_BUFFERING) .waitForPlaybackState(Player.STATE_BUFFERING)
.sendMessage(target, /* positionMs= */ 50) .sendMessage(target, /* positionMs= */ 50)
...@@ -2049,7 +2050,7 @@ public final class ExoPlayerTest { ...@@ -2049,7 +2050,7 @@ public final class ExoPlayerTest {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSendMessages") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_BUFFERING) .waitForPlaybackState(Player.STATE_BUFFERING)
.sendMessage( .sendMessage(
...@@ -2084,7 +2085,7 @@ public final class ExoPlayerTest { ...@@ -2084,7 +2085,7 @@ public final class ExoPlayerTest {
final FakeMediaSource mediaSource = new FakeMediaSource(timeline, Builder.VIDEO_FORMAT); final FakeMediaSource mediaSource = new FakeMediaSource(timeline, Builder.VIDEO_FORMAT);
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSendMessages") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForTimelineChanged( .waitForTimelineChanged(
timeline, /* expectedReason */ Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE) timeline, /* expectedReason */ Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE)
...@@ -2109,7 +2110,7 @@ public final class ExoPlayerTest { ...@@ -2109,7 +2110,7 @@ public final class ExoPlayerTest {
Timeline timeline = new FakeTimeline(/* windowCount= */ 3); Timeline timeline = new FakeTimeline(/* windowCount= */ 3);
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSendMessages") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForTimelineChanged(timeline, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE) .waitForTimelineChanged(timeline, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE)
.sendMessage(target, /* windowIndex = */ 2, /* positionMs= */ 50) .sendMessage(target, /* windowIndex = */ 2, /* positionMs= */ 50)
...@@ -2130,7 +2131,7 @@ public final class ExoPlayerTest { ...@@ -2130,7 +2131,7 @@ public final class ExoPlayerTest {
Timeline timeline = new FakeTimeline(/* windowCount= */ 3); Timeline timeline = new FakeTimeline(/* windowCount= */ 3);
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSendMessages") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForTimelineChanged( .waitForTimelineChanged(
timeline, /* expectedReason */ Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE) timeline, /* expectedReason */ Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE)
...@@ -2160,7 +2161,7 @@ public final class ExoPlayerTest { ...@@ -2160,7 +2161,7 @@ public final class ExoPlayerTest {
final FakeMediaSource mediaSource = new FakeMediaSource(timeline, Builder.VIDEO_FORMAT); final FakeMediaSource mediaSource = new FakeMediaSource(timeline, Builder.VIDEO_FORMAT);
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSendMessages") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForTimelineChanged( .waitForTimelineChanged(
timeline, /* expectedReason */ Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE) timeline, /* expectedReason */ Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE)
...@@ -2195,7 +2196,7 @@ public final class ExoPlayerTest { ...@@ -2195,7 +2196,7 @@ public final class ExoPlayerTest {
PositionGrabbingMessageTarget target2 = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target2 = new PositionGrabbingMessageTarget();
PositionGrabbingMessageTarget target3 = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target3 = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSendMessages") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.sendMessage(target1, /* windowIndex = */ 0, /* positionMs= */ 50) .sendMessage(target1, /* windowIndex = */ 0, /* positionMs= */ 50)
...@@ -2222,7 +2223,7 @@ public final class ExoPlayerTest { ...@@ -2222,7 +2223,7 @@ public final class ExoPlayerTest {
final PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); final PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
final AtomicReference<PlayerMessage> message = new AtomicReference<>(); final AtomicReference<PlayerMessage> message = new AtomicReference<>();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testCancelMessage") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_BUFFERING) .waitForPlaybackState(Player.STATE_BUFFERING)
.executeRunnable( .executeRunnable(
...@@ -2254,7 +2255,7 @@ public final class ExoPlayerTest { ...@@ -2254,7 +2255,7 @@ public final class ExoPlayerTest {
final CountingMessageTarget target = new CountingMessageTarget(); final CountingMessageTarget target = new CountingMessageTarget();
final AtomicReference<PlayerMessage> message = new AtomicReference<>(); final AtomicReference<PlayerMessage> message = new AtomicReference<>();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testCancelMessage") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_BUFFERING) .waitForPlaybackState(Player.STATE_BUFFERING)
.executeRunnable( .executeRunnable(
...@@ -2297,8 +2298,7 @@ public final class ExoPlayerTest { ...@@ -2297,8 +2298,7 @@ public final class ExoPlayerTest {
rendererMessages.add(what); rendererMessages.add(what);
} }
}; };
ActionSchedule actionSchedule = ActionSchedule actionSchedule = addSurfaceSwitch(new ActionSchedule.Builder(TAG)).build();
addSurfaceSwitch(new ActionSchedule.Builder("testSetAndSwitchSurface")).build();
new ExoPlayerTestRunner.Builder() new ExoPlayerTestRunner.Builder()
.setRenderers(videoRenderer) .setRenderers(videoRenderer)
.setActionSchedule(actionSchedule) .setActionSchedule(actionSchedule)
...@@ -2312,8 +2312,7 @@ public final class ExoPlayerTest { ...@@ -2312,8 +2312,7 @@ public final class ExoPlayerTest {
@Test @Test
public void switchSurfaceOnEndedState() throws Exception { public void switchSurfaceOnEndedState() throws Exception {
ActionSchedule.Builder scheduleBuilder = ActionSchedule.Builder scheduleBuilder =
new ActionSchedule.Builder("testSwitchSurfaceOnEndedState") new ActionSchedule.Builder(TAG).waitForPlaybackState(Player.STATE_ENDED);
.waitForPlaybackState(Player.STATE_ENDED);
ActionSchedule waitForEndedAndSwitchSchedule = addSurfaceSwitch(scheduleBuilder).build(); ActionSchedule waitForEndedAndSwitchSchedule = addSurfaceSwitch(scheduleBuilder).build();
new ExoPlayerTestRunner.Builder() new ExoPlayerTestRunner.Builder()
.setTimeline(Timeline.EMPTY) .setTimeline(Timeline.EMPTY)
...@@ -2336,7 +2335,7 @@ public final class ExoPlayerTest { ...@@ -2336,7 +2335,7 @@ public final class ExoPlayerTest {
new TimelineWindowDefinition(/* periodCount= */ 1, /* id= */ 3)); new TimelineWindowDefinition(/* periodCount= */ 1, /* id= */ 3));
final FakeMediaSource mediaSource = new FakeMediaSource(timeline1, Builder.VIDEO_FORMAT); final FakeMediaSource mediaSource = new FakeMediaSource(timeline1, Builder.VIDEO_FORMAT);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testTimelineUpdateDropsPeriods") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
// Ensure next period is pre-buffered by playing until end of first period. // Ensure next period is pre-buffered by playing until end of first period.
...@@ -2387,7 +2386,7 @@ public final class ExoPlayerTest { ...@@ -2387,7 +2386,7 @@ public final class ExoPlayerTest {
/* durationUs= */ 10 * C.MICROS_PER_SECOND)); /* durationUs= */ 10 * C.MICROS_PER_SECOND));
FakeMediaSource mediaSource = new FakeMediaSource(timeline); FakeMediaSource mediaSource = new FakeMediaSource(timeline);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSeekToUnpreparedPeriod") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.seek(/* windowIndex= */ 0, /* positionMs= */ 9999) .seek(/* windowIndex= */ 0, /* positionMs= */ 9999)
...@@ -2436,7 +2435,7 @@ public final class ExoPlayerTest { ...@@ -2436,7 +2435,7 @@ public final class ExoPlayerTest {
final int[] windowCount = {C.INDEX_UNSET}; final int[] windowCount = {C.INDEX_UNSET};
final long[] position = {C.TIME_UNSET}; final long[] position = {C.TIME_UNSET};
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testInvalidSeekFallsBackToSubsequentPeriodOfTheRemovedPeriod") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.executeRunnable( .executeRunnable(
...@@ -2508,7 +2507,7 @@ public final class ExoPlayerTest { ...@@ -2508,7 +2507,7 @@ public final class ExoPlayerTest {
} }
}; };
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testRecursivePlayerChanges") new ActionSchedule.Builder(TAG)
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
@Override @Override
...@@ -2569,7 +2568,7 @@ public final class ExoPlayerTest { ...@@ -2569,7 +2568,7 @@ public final class ExoPlayerTest {
} }
}; };
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testRecursivePlayerChanges") new ActionSchedule.Builder(TAG)
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
@Override @Override
...@@ -2608,7 +2607,7 @@ public final class ExoPlayerTest { ...@@ -2608,7 +2607,7 @@ public final class ExoPlayerTest {
} }
}; };
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testRecursiveTimelineChangeInStopAreReportedInCorrectOrder") new ActionSchedule.Builder(TAG)
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
@Override @Override
...@@ -2678,7 +2677,7 @@ public final class ExoPlayerTest { ...@@ -2678,7 +2677,7 @@ public final class ExoPlayerTest {
} }
}; };
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testClippedLoopedPeriodsArePlayedFully") new ActionSchedule.Builder(TAG)
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
@Override @Override
...@@ -2723,7 +2722,7 @@ public final class ExoPlayerTest { ...@@ -2723,7 +2722,7 @@ public final class ExoPlayerTest {
new FakeMediaSource(timelineUnsetDuration, Builder.VIDEO_FORMAT), new FakeMediaSource(timelineUnsetDuration, Builder.VIDEO_FORMAT),
new FakeMediaSource(timelineSetDuration, Builder.AUDIO_FORMAT)); new FakeMediaSource(timelineSetDuration, Builder.AUDIO_FORMAT));
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testUpdateTrackSelectorThenSeekToUnpreparedPeriod") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.seek(/* windowIndex= */ 1, /* positionMs= */ 0) .seek(/* windowIndex= */ 1, /* positionMs= */ 0)
...@@ -2814,7 +2813,7 @@ public final class ExoPlayerTest { ...@@ -2814,7 +2813,7 @@ public final class ExoPlayerTest {
ConcatenatingMediaSource concatenatingMediaSource = ConcatenatingMediaSource concatenatingMediaSource =
new ConcatenatingMediaSource(workingMediaSource); new ConcatenatingMediaSource(workingMediaSource);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testFailingSecondMediaSourceInPlaylistOnlyThrowsLater") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.executeRunnable(() -> concatenatingMediaSource.addMediaSource(failingMediaSource)) .executeRunnable(() -> concatenatingMediaSource.addMediaSource(failingMediaSource))
...@@ -2846,7 +2845,7 @@ public final class ExoPlayerTest { ...@@ -2846,7 +2845,7 @@ public final class ExoPlayerTest {
MediaSource mediaSource = new FakeMediaSource(timeline); MediaSource mediaSource = new FakeMediaSource(timeline);
ConcatenatingMediaSource concatenatingMediaSource = new ConcatenatingMediaSource(mediaSource); ConcatenatingMediaSource concatenatingMediaSource = new ConcatenatingMediaSource(mediaSource);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("removingLoopingLastPeriodFromPlaylistDoesNotThrow") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
// Play almost to end to ensure the current period is fully buffered. // Play almost to end to ensure the current period is fully buffered.
...@@ -2877,7 +2876,7 @@ public final class ExoPlayerTest { ...@@ -2877,7 +2876,7 @@ public final class ExoPlayerTest {
MediaSource concatenatedMediaSource = new ConcatenatingMediaSource(clippedMediaSource); MediaSource concatenatedMediaSource = new ConcatenatingMediaSource(clippedMediaSource);
AtomicLong positionWhenReady = new AtomicLong(); AtomicLong positionWhenReady = new AtomicLong();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("seekToUnpreparedWindowWithNonZeroOffsetInConcatenation") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_BUFFERING) .waitForPlaybackState(Player.STATE_BUFFERING)
.seek(/* positionMs= */ 10) .seek(/* positionMs= */ 10)
...@@ -2921,7 +2920,7 @@ public final class ExoPlayerTest { ...@@ -2921,7 +2920,7 @@ public final class ExoPlayerTest {
AtomicInteger periodIndexWhenReady = new AtomicInteger(); AtomicInteger periodIndexWhenReady = new AtomicInteger();
AtomicLong positionWhenReady = new AtomicLong(); AtomicLong positionWhenReady = new AtomicLong();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("seekToUnpreparedWindowWithMultiplePeriodsInConcatenation") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_BUFFERING) .waitForPlaybackState(Player.STATE_BUFFERING)
// Seek 10ms into the second period. // Seek 10ms into the second period.
...@@ -2979,7 +2978,7 @@ public final class ExoPlayerTest { ...@@ -2979,7 +2978,7 @@ public final class ExoPlayerTest {
} }
}; };
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("periodTransitionReportsCorrectBufferedPosition") new ActionSchedule.Builder(TAG)
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
@Override @Override
...@@ -3030,7 +3029,7 @@ public final class ExoPlayerTest { ...@@ -3030,7 +3029,7 @@ public final class ExoPlayerTest {
} }
}; };
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("contentWithInitialSeekAfterPrerollAd") new ActionSchedule.Builder(TAG)
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
@Override @Override
...@@ -3083,7 +3082,7 @@ public final class ExoPlayerTest { ...@@ -3083,7 +3082,7 @@ public final class ExoPlayerTest {
} }
}; };
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("contentWithoutInitialSeekStartsAtDefaultPositionAfterPrerollAd") new ActionSchedule.Builder(TAG)
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
@Override @Override
...@@ -3109,7 +3108,7 @@ public final class ExoPlayerTest { ...@@ -3109,7 +3108,7 @@ public final class ExoPlayerTest {
public void setPlaybackParametersConsecutivelyNotifiesListenerForEveryChangeOnce() public void setPlaybackParametersConsecutivelyNotifiesListenerForEveryChangeOnce()
throws Exception { throws Exception {
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("setPlaybackParametersNotifiesListenerForEveryChangeOnce") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.setPlaybackParameters(new PlaybackParameters(1.1f)) .setPlaybackParameters(new PlaybackParameters(1.1f))
...@@ -3160,7 +3159,7 @@ public final class ExoPlayerTest { ...@@ -3160,7 +3159,7 @@ public final class ExoPlayerTest {
} }
}; };
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("setUnsupportedPlaybackParametersNotifiesListenersCorrectly") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.setPlaybackParameters(new PlaybackParameters(1.1f)) .setPlaybackParameters(new PlaybackParameters(1.1f))
...@@ -3197,7 +3196,7 @@ public final class ExoPlayerTest { ...@@ -3197,7 +3196,7 @@ public final class ExoPlayerTest {
@Test @Test
public void simplePlaybackHasNoPlaybackSuppression() throws Exception { public void simplePlaybackHasNoPlaybackSuppression() throws Exception {
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("simplePlaybackHasNoPlaybackSuppression") new ActionSchedule.Builder(TAG)
.play() .play()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.pause() .pause()
...@@ -3229,7 +3228,7 @@ public final class ExoPlayerTest { ...@@ -3229,7 +3228,7 @@ public final class ExoPlayerTest {
PlayerStateGrabber playerStateGrabber = new PlayerStateGrabber(); PlayerStateGrabber playerStateGrabber = new PlayerStateGrabber();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("audioFocusDenied") new ActionSchedule.Builder(TAG)
.setAudioAttributes(AudioAttributes.DEFAULT, /* handleAudioFocus= */ true) .setAudioAttributes(AudioAttributes.DEFAULT, /* handleAudioFocus= */ true)
.play() .play()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
...@@ -3307,7 +3306,7 @@ public final class ExoPlayerTest { ...@@ -3307,7 +3306,7 @@ public final class ExoPlayerTest {
long[] windowCounts = new long[1]; long[] windowCounts = new long[1];
int seekToWindowIndex = 1; int seekToWindowIndex = 1;
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testDelegatingMediaSourceApproach") new ActionSchedule.Builder(TAG)
.seek(/* windowIndex= */ 1, /* positionMs= */ 5000) .seek(/* windowIndex= */ 1, /* positionMs= */ 5000)
.waitForSeekProcessed() .waitForSeekProcessed()
.waitForTimelineChanged( .waitForTimelineChanged(
...@@ -3346,7 +3345,7 @@ public final class ExoPlayerTest { ...@@ -3346,7 +3345,7 @@ public final class ExoPlayerTest {
final int[] windowIndex = {C.INDEX_UNSET}; final int[] windowIndex = {C.INDEX_UNSET};
final long[] positionMs = {C.TIME_UNSET}; final long[] positionMs = {C.TIME_UNSET};
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSeekTo_windowIndexIsReset_deprecated") new ActionSchedule.Builder(TAG)
.pause() .pause()
.seek(/* windowIndex= */ 1, /* positionMs= */ C.TIME_UNSET) .seek(/* windowIndex= */ 1, /* positionMs= */ C.TIME_UNSET)
.playUntilPosition(/* windowIndex= */ 1, /* positionMs= */ 5000) .playUntilPosition(/* windowIndex= */ 1, /* positionMs= */ 5000)
...@@ -3387,7 +3386,7 @@ public final class ExoPlayerTest { ...@@ -3387,7 +3386,7 @@ public final class ExoPlayerTest {
final int[] windowIndex = {C.INDEX_UNSET}; final int[] windowIndex = {C.INDEX_UNSET};
final long[] positionMs = {C.TIME_UNSET}; final long[] positionMs = {C.TIME_UNSET};
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSeekTo_windowIndexIsReset") new ActionSchedule.Builder(TAG)
.pause() .pause()
.seek(/* windowIndex= */ 1, /* positionMs= */ C.TIME_UNSET) .seek(/* windowIndex= */ 1, /* positionMs= */ C.TIME_UNSET)
.playUntilPosition(/* windowIndex= */ 1, /* positionMs= */ 5000) .playUntilPosition(/* windowIndex= */ 1, /* positionMs= */ 5000)
...@@ -3425,7 +3424,7 @@ public final class ExoPlayerTest { ...@@ -3425,7 +3424,7 @@ public final class ExoPlayerTest {
CountDownLatch becomingNoisyDelivered = new CountDownLatch(1); CountDownLatch becomingNoisyDelivered = new CountDownLatch(1);
PlayerStateGrabber playerStateGrabber = new PlayerStateGrabber(); PlayerStateGrabber playerStateGrabber = new PlayerStateGrabber();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("becomingNoisyIgnoredIfBecomingNoisyHandlingIsDisabled") new ActionSchedule.Builder(TAG)
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
@Override @Override
...@@ -3459,7 +3458,7 @@ public final class ExoPlayerTest { ...@@ -3459,7 +3458,7 @@ public final class ExoPlayerTest {
public void pausesWhenBecomingNoisyIfBecomingNoisyHandlingIsEnabled() throws Exception { public void pausesWhenBecomingNoisyIfBecomingNoisyHandlingIsEnabled() throws Exception {
CountDownLatch becomingNoisyHandlingEnabled = new CountDownLatch(1); CountDownLatch becomingNoisyHandlingEnabled = new CountDownLatch(1);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("pausesWhenBecomingNoisyIfBecomingNoisyHandlingIsEnabled") new ActionSchedule.Builder(TAG)
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
@Override @Override
...@@ -3577,7 +3576,7 @@ public final class ExoPlayerTest { ...@@ -3577,7 +3576,7 @@ public final class ExoPlayerTest {
TimelineWindowDefinition.createDummy(/* tag= */ 1), TimelineWindowDefinition.createDummy(/* tag= */ 1),
TimelineWindowDefinition.createDummy(/* tag= */ 2)); TimelineWindowDefinition.createDummy(/* tag= */ 2));
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testMoveMediaItem") new ActionSchedule.Builder(TAG)
.waitForTimelineChanged( .waitForTimelineChanged(
/* expectedTimeline= */ null, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE) /* expectedTimeline= */ null, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE)
.moveMediaItem(/* currentIndex= */ 0, /* newIndex= */ 1) .moveMediaItem(/* currentIndex= */ 0, /* newIndex= */ 1)
...@@ -3632,7 +3631,7 @@ public final class ExoPlayerTest { ...@@ -3632,7 +3631,7 @@ public final class ExoPlayerTest {
MediaSource mediaSource2 = new FakeMediaSource(timeline2); MediaSource mediaSource2 = new FakeMediaSource(timeline2);
MediaSource mediaSource3 = new FakeMediaSource(timeline3); MediaSource mediaSource3 = new FakeMediaSource(timeline3);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testRemoveMediaItems") new ActionSchedule.Builder(TAG)
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.removeMediaItem(/* index= */ 0) .removeMediaItem(/* index= */ 0)
.build(); .build();
...@@ -3692,7 +3691,7 @@ public final class ExoPlayerTest { ...@@ -3692,7 +3691,7 @@ public final class ExoPlayerTest {
MediaSource mediaSource2 = new FakeMediaSource(timeline2); MediaSource mediaSource2 = new FakeMediaSource(timeline2);
MediaSource mediaSource3 = new FakeMediaSource(timeline3); MediaSource mediaSource3 = new FakeMediaSource(timeline3);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testRemoveMediaItems") new ActionSchedule.Builder(TAG)
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.removeMediaItems(/* fromIndex= */ 1, /* toIndex= */ 3) .removeMediaItems(/* fromIndex= */ 1, /* toIndex= */ 3)
.build(); .build();
...@@ -3725,7 +3724,7 @@ public final class ExoPlayerTest { ...@@ -3725,7 +3724,7 @@ public final class ExoPlayerTest {
public void clearMediaItems() throws Exception { public void clearMediaItems() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testClearMediaItems") new ActionSchedule.Builder(TAG)
.waitForTimelineChanged(timeline, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE) .waitForTimelineChanged(timeline, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE)
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.clearMediaItems() .clearMediaItems()
...@@ -3756,7 +3755,7 @@ public final class ExoPlayerTest { ...@@ -3756,7 +3755,7 @@ public final class ExoPlayerTest {
Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 2); Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 2);
MediaSource secondMediaSource = new FakeMediaSource(secondTimeline); MediaSource secondMediaSource = new FakeMediaSource(secondTimeline);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testMultipleModificationWithRecursiveListenerInvocations") new ActionSchedule.Builder(TAG)
.waitForTimelineChanged(timeline, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE) .waitForTimelineChanged(timeline, Player.TIMELINE_CHANGE_REASON_SOURCE_UPDATE)
.clearMediaItems() .clearMediaItems()
.setMediaSources(secondMediaSource) .setMediaSources(secondMediaSource)
...@@ -3992,7 +3991,7 @@ public final class ExoPlayerTest { ...@@ -3992,7 +3991,7 @@ public final class ExoPlayerTest {
public void prepareWithInvalidInitialSeek_expectEndedImmediately() throws Exception { public void prepareWithInvalidInitialSeek_expectEndedImmediately() throws Exception {
final int[] currentWindowIndices = {C.INDEX_UNSET}; final int[] currentWindowIndices = {C.INDEX_UNSET};
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testPrepareWithInvalidInitialSeek_expectEnded") new ActionSchedule.Builder(TAG)
.waitForPlaybackState(Player.STATE_ENDED) .waitForPlaybackState(Player.STATE_ENDED)
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
...@@ -4023,10 +4022,7 @@ public final class ExoPlayerTest { ...@@ -4023,10 +4022,7 @@ public final class ExoPlayerTest {
public void prepareWhenAlreadyPreparedIsANoop() throws Exception { public void prepareWhenAlreadyPreparedIsANoop() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testPrepareWhenAlreadyPreparedIsANoop") new ActionSchedule.Builder(TAG).waitForPlaybackState(Player.STATE_READY).prepare().build();
.waitForPlaybackState(Player.STATE_READY)
.prepare()
.build();
ExoPlayerTestRunner exoPlayerTestRunner = ExoPlayerTestRunner exoPlayerTestRunner =
new Builder() new Builder()
.setTimeline(timeline) .setTimeline(timeline)
...@@ -4059,7 +4055,7 @@ public final class ExoPlayerTest { ...@@ -4059,7 +4055,7 @@ public final class ExoPlayerTest {
long[] currentPlaybackPositions = new long[1]; long[] currentPlaybackPositions = new long[1];
int seekToWindowIndex = 1; int seekToWindowIndex = 1;
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSeekToIndexLargerThanNumberOfPlaylistItems") new ActionSchedule.Builder(TAG)
.waitForSeekProcessed() .waitForSeekProcessed()
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
...@@ -4095,7 +4091,7 @@ public final class ExoPlayerTest { ...@@ -4095,7 +4091,7 @@ public final class ExoPlayerTest {
long[] windowCounts = new long[2]; long[] windowCounts = new long[2];
int seekToWindowIndex = 1; int seekToWindowIndex = 1;
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSeekToIndexWithEmptyMultiWindowMediaSource") new ActionSchedule.Builder(TAG)
.waitForTimelineChanged() .waitForTimelineChanged()
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
...@@ -4142,9 +4138,7 @@ public final class ExoPlayerTest { ...@@ -4142,9 +4138,7 @@ public final class ExoPlayerTest {
ConcatenatingMediaSource concatenatingMediaSource = ConcatenatingMediaSource concatenatingMediaSource =
new ConcatenatingMediaSource(/* isAtomic= */ false); new ConcatenatingMediaSource(/* isAtomic= */ false);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testEmptyMultiWindowMediaSource_doesNotEnterBufferState") new ActionSchedule.Builder(TAG).waitForTimelineChanged().build();
.waitForTimelineChanged()
.build();
ExoPlayerTestRunner exoPlayerTestRunner = ExoPlayerTestRunner exoPlayerTestRunner =
new Builder() new Builder()
.setMediaSources(concatenatingMediaSource) .setMediaSources(concatenatingMediaSource)
...@@ -4169,7 +4163,7 @@ public final class ExoPlayerTest { ...@@ -4169,7 +4163,7 @@ public final class ExoPlayerTest {
long[] windowCounts = new long[2]; long[] windowCounts = new long[2];
int seekToWindowIndex = 1; int seekToWindowIndex = 1;
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSeekToIndexWithEmptyMultiWindowMediaSource") new ActionSchedule.Builder(TAG)
.waitForTimelineChanged() .waitForTimelineChanged()
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
...@@ -4218,7 +4212,7 @@ public final class ExoPlayerTest { ...@@ -4218,7 +4212,7 @@ public final class ExoPlayerTest {
MediaSource secondMediaSource = new FakeMediaSource(secondTimeline); MediaSource secondMediaSource = new FakeMediaSource(secondTimeline);
final int[] currentWindowIndices = {C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET}; final int[] currentWindowIndices = {C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET};
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSetMediaSources_empty_whenEmpty_correctMaskingWindowIndex") new ActionSchedule.Builder(TAG)
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
@Override @Override
...@@ -4345,7 +4339,7 @@ public final class ExoPlayerTest { ...@@ -4345,7 +4339,7 @@ public final class ExoPlayerTest {
MediaSource secondMediaSource = new FakeMediaSource(secondTimeline); MediaSource secondMediaSource = new FakeMediaSource(secondTimeline);
final int[] currentWindowIndices = {C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET}; final int[] currentWindowIndices = {C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET};
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSetMediaSources_whenEmpty_correctMaskingWindowIndex") new ActionSchedule.Builder(TAG)
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
...@@ -4495,7 +4489,7 @@ public final class ExoPlayerTest { ...@@ -4495,7 +4489,7 @@ public final class ExoPlayerTest {
MediaSource secondMediaSource = new FakeMediaSource(secondTimeline); MediaSource secondMediaSource = new FakeMediaSource(secondTimeline);
final int[] currentWindowIndices = {C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET}; final int[] currentWindowIndices = {C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET};
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSetMediaSources_correctMaskingWindowIndex") new ActionSchedule.Builder(TAG)
.waitForTimelineChanged() .waitForTimelineChanged()
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
...@@ -4535,7 +4529,7 @@ public final class ExoPlayerTest { ...@@ -4535,7 +4529,7 @@ public final class ExoPlayerTest {
final int[] maskingPlaybackStates = new int[4]; final int[] maskingPlaybackStates = new int[4];
Arrays.fill(maskingPlaybackStates, C.INDEX_UNSET); Arrays.fill(maskingPlaybackStates, C.INDEX_UNSET);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSetMediaSources_whenIdle_correctMaskingPlaybackState") new ActionSchedule.Builder(TAG)
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
@Override @Override
...@@ -4720,7 +4714,7 @@ public final class ExoPlayerTest { ...@@ -4720,7 +4714,7 @@ public final class ExoPlayerTest {
final int[] maskingPlaybackStates = new int[4]; final int[] maskingPlaybackStates = new int[4];
Arrays.fill(maskingPlaybackStates, C.INDEX_UNSET); Arrays.fill(maskingPlaybackStates, C.INDEX_UNSET);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSetMediaSources_whenEnded_correctMaskingPlaybackState") new ActionSchedule.Builder(TAG)
.waitForPlaybackState(Player.STATE_ENDED) .waitForPlaybackState(Player.STATE_ENDED)
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
...@@ -4931,7 +4925,7 @@ public final class ExoPlayerTest { ...@@ -4931,7 +4925,7 @@ public final class ExoPlayerTest {
final int[] maskingPlaybackStates = new int[4]; final int[] maskingPlaybackStates = new int[4];
Arrays.fill(maskingPlaybackStates, C.INDEX_UNSET); Arrays.fill(maskingPlaybackStates, C.INDEX_UNSET);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSetMediaSources_whenPrepared_correctMaskingPlaybackState") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.executeRunnable( .executeRunnable(
...@@ -5186,7 +5180,7 @@ public final class ExoPlayerTest { ...@@ -5186,7 +5180,7 @@ public final class ExoPlayerTest {
C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET
}; };
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testMoveMediaItems_correctMaskingWindowIndex") new ActionSchedule.Builder(TAG)
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
...@@ -5267,7 +5261,7 @@ public final class ExoPlayerTest { ...@@ -5267,7 +5261,7 @@ public final class ExoPlayerTest {
MediaSource secondMediaSource = new FakeMediaSource(secondTimeline); MediaSource secondMediaSource = new FakeMediaSource(secondTimeline);
final int[] currentWindowIndices = {C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET}; final int[] currentWindowIndices = {C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET};
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testMoveMediaItems_unprepared_correctMaskingWindowIndex") new ActionSchedule.Builder(TAG)
.waitForTimelineChanged() .waitForTimelineChanged()
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
...@@ -5307,7 +5301,7 @@ public final class ExoPlayerTest { ...@@ -5307,7 +5301,7 @@ public final class ExoPlayerTest {
MediaSource secondMediaSource = new FakeMediaSource(secondTimeline); MediaSource secondMediaSource = new FakeMediaSource(secondTimeline);
final int[] currentWindowIndices = {C.INDEX_UNSET, C.INDEX_UNSET}; final int[] currentWindowIndices = {C.INDEX_UNSET, C.INDEX_UNSET};
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testRemoveMediaItems_correctMaskingWindowIndex") new ActionSchedule.Builder(TAG)
.waitForSeekProcessed() .waitForSeekProcessed()
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
...@@ -5522,7 +5516,7 @@ public final class ExoPlayerTest { ...@@ -5522,7 +5516,7 @@ public final class ExoPlayerTest {
final int[] currentWindowIndices = {C.INDEX_UNSET, C.INDEX_UNSET}; final int[] currentWindowIndices = {C.INDEX_UNSET, C.INDEX_UNSET};
final int[] maskingPlaybackState = {C.INDEX_UNSET}; final int[] maskingPlaybackState = {C.INDEX_UNSET};
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testClearMediaItems_correctMaskingWindowIndex") new ActionSchedule.Builder(TAG)
.waitForSeekProcessed() .waitForSeekProcessed()
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
...@@ -5556,7 +5550,7 @@ public final class ExoPlayerTest { ...@@ -5556,7 +5550,7 @@ public final class ExoPlayerTest {
final int[] currentWindowIndices = {C.INDEX_UNSET, C.INDEX_UNSET}; final int[] currentWindowIndices = {C.INDEX_UNSET, C.INDEX_UNSET};
final int[] currentStates = {C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET}; final int[] currentStates = {C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET};
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testClearMediaItems_correctMaskingWindowIndex") new ActionSchedule.Builder(TAG)
.waitForSeekProcessed() .waitForSeekProcessed()
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
...@@ -5612,7 +5606,7 @@ public final class ExoPlayerTest { ...@@ -5612,7 +5606,7 @@ public final class ExoPlayerTest {
AtomicReference<TrackSelectionArray> trackSelectionsAfterError = new AtomicReference<>(); AtomicReference<TrackSelectionArray> trackSelectionsAfterError = new AtomicReference<>();
AtomicInteger windowIndexAfterError = new AtomicInteger(); AtomicInteger windowIndexAfterError = new AtomicInteger();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("errorDuringEnableAtPeriodTransition_isReportedForNewPeriod") new ActionSchedule.Builder(TAG)
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
@Override @Override
...@@ -5671,7 +5665,7 @@ public final class ExoPlayerTest { ...@@ -5671,7 +5665,7 @@ public final class ExoPlayerTest {
AtomicReference<TrackSelectionArray> trackSelectionsAfterError = new AtomicReference<>(); AtomicReference<TrackSelectionArray> trackSelectionsAfterError = new AtomicReference<>();
AtomicInteger windowIndexAfterError = new AtomicInteger(); AtomicInteger windowIndexAfterError = new AtomicInteger();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("errorDuringDisableAtTransition_isReportedForCurrentPeriod") new ActionSchedule.Builder(TAG)
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
@Override @Override
...@@ -5734,7 +5728,7 @@ public final class ExoPlayerTest { ...@@ -5734,7 +5728,7 @@ public final class ExoPlayerTest {
AtomicReference<TrackSelectionArray> trackSelectionsAfterError = new AtomicReference<>(); AtomicReference<TrackSelectionArray> trackSelectionsAfterError = new AtomicReference<>();
AtomicInteger windowIndexAfterError = new AtomicInteger(); AtomicInteger windowIndexAfterError = new AtomicInteger();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("errorDuringReplaceStreamAtTransition_isReportedForNewPeriod") new ActionSchedule.Builder(TAG)
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
@Override @Override
...@@ -5795,7 +5789,7 @@ public final class ExoPlayerTest { ...@@ -5795,7 +5789,7 @@ public final class ExoPlayerTest {
AtomicReference<TrackSelectionArray> trackSelectionsAfterError = new AtomicReference<>(); AtomicReference<TrackSelectionArray> trackSelectionsAfterError = new AtomicReference<>();
AtomicInteger windowIndexAfterError = new AtomicInteger(); AtomicInteger windowIndexAfterError = new AtomicInteger();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("errorThrownDuringPlaylistUpdate_keepsConsistentPlayerState") new ActionSchedule.Builder(TAG)
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
@Override @Override
...@@ -5850,7 +5844,7 @@ public final class ExoPlayerTest { ...@@ -5850,7 +5844,7 @@ public final class ExoPlayerTest {
MediaSource mediaSource = new FakeMediaSource(new FakeTimeline(/* windowCount = */ 1)); MediaSource mediaSource = new FakeMediaSource(new FakeTimeline(/* windowCount = */ 1));
AtomicInteger windowIndexAfterFinalEndedState = new AtomicInteger(); AtomicInteger windowIndexAfterFinalEndedState = new AtomicInteger();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("seekToCurrentPosition_inEndedState") new ActionSchedule.Builder(TAG)
.waitForPlaybackState(Player.STATE_ENDED) .waitForPlaybackState(Player.STATE_ENDED)
.addMediaSources(mediaSource) .addMediaSources(mediaSource)
.executeRunnable( .executeRunnable(
......
...@@ -69,6 +69,8 @@ import org.robolectric.annotation.LooperMode.Mode; ...@@ -69,6 +69,8 @@ import org.robolectric.annotation.LooperMode.Mode;
@LooperMode(Mode.PAUSED) @LooperMode(Mode.PAUSED)
public final class AnalyticsCollectorTest { public final class AnalyticsCollectorTest {
private static final String TAG = "AnalyticsCollectorTest";
private static final int EVENT_PLAYER_STATE_CHANGED = 0; private static final int EVENT_PLAYER_STATE_CHANGED = 0;
private static final int EVENT_TIMELINE_CHANGED = 1; private static final int EVENT_TIMELINE_CHANGED = 1;
private static final int EVENT_POSITION_DISCONTINUITY = 2; private static final int EVENT_POSITION_DISCONTINUITY = 2;
...@@ -309,7 +311,7 @@ public final class AnalyticsCollectorTest { ...@@ -309,7 +311,7 @@ public final class AnalyticsCollectorTest {
new FakeMediaSource(SINGLE_PERIOD_TIMELINE, ExoPlayerTestRunner.Builder.VIDEO_FORMAT), new FakeMediaSource(SINGLE_PERIOD_TIMELINE, ExoPlayerTestRunner.Builder.VIDEO_FORMAT),
new FakeMediaSource(SINGLE_PERIOD_TIMELINE, ExoPlayerTestRunner.Builder.AUDIO_FORMAT)); new FakeMediaSource(SINGLE_PERIOD_TIMELINE, ExoPlayerTestRunner.Builder.AUDIO_FORMAT));
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("AnalyticsCollectorTest") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.seek(/* windowIndex= */ 1, /* positionMs= */ 0) .seek(/* windowIndex= */ 1, /* positionMs= */ 0)
...@@ -379,7 +381,7 @@ public final class AnalyticsCollectorTest { ...@@ -379,7 +381,7 @@ public final class AnalyticsCollectorTest {
long periodDurationMs = long periodDurationMs =
SINGLE_PERIOD_TIMELINE.getWindow(/* windowIndex= */ 0, new Window()).getDurationMs(); SINGLE_PERIOD_TIMELINE.getWindow(/* windowIndex= */ 0, new Window()).getDurationMs();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("AnalyticsCollectorTest") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.playUntilPosition(/* windowIndex= */ 0, periodDurationMs) .playUntilPosition(/* windowIndex= */ 0, periodDurationMs)
...@@ -460,7 +462,7 @@ public final class AnalyticsCollectorTest { ...@@ -460,7 +462,7 @@ public final class AnalyticsCollectorTest {
MediaSource mediaSource2 = MediaSource mediaSource2 =
new FakeMediaSource(SINGLE_PERIOD_TIMELINE, ExoPlayerTestRunner.Builder.VIDEO_FORMAT); new FakeMediaSource(SINGLE_PERIOD_TIMELINE, ExoPlayerTestRunner.Builder.VIDEO_FORMAT);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("AnalyticsCollectorTest") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.setMediaSources(/* resetPosition= */ false, mediaSource2) .setMediaSources(/* resetPosition= */ false, mediaSource2)
...@@ -536,7 +538,7 @@ public final class AnalyticsCollectorTest { ...@@ -536,7 +538,7 @@ public final class AnalyticsCollectorTest {
MediaSource mediaSource = MediaSource mediaSource =
new FakeMediaSource(SINGLE_PERIOD_TIMELINE, ExoPlayerTestRunner.Builder.VIDEO_FORMAT); new FakeMediaSource(SINGLE_PERIOD_TIMELINE, ExoPlayerTestRunner.Builder.VIDEO_FORMAT);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("AnalyticsCollectorTest") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.throwPlaybackException(ExoPlaybackException.createForSource(new IOException())) .throwPlaybackException(ExoPlaybackException.createForSource(new IOException()))
...@@ -611,7 +613,7 @@ public final class AnalyticsCollectorTest { ...@@ -611,7 +613,7 @@ public final class AnalyticsCollectorTest {
long periodDurationMs = long periodDurationMs =
SINGLE_PERIOD_TIMELINE.getWindow(/* windowIndex= */ 0, new Window()).getDurationMs(); SINGLE_PERIOD_TIMELINE.getWindow(/* windowIndex= */ 0, new Window()).getDurationMs();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("AnalyticsCollectorTest") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
// Ensure second period is already being read from. // Ensure second period is already being read from.
...@@ -687,7 +689,7 @@ public final class AnalyticsCollectorTest { ...@@ -687,7 +689,7 @@ public final class AnalyticsCollectorTest {
MediaSource fakeMediaSource = MediaSource fakeMediaSource =
new FakeMediaSource(SINGLE_PERIOD_TIMELINE, ExoPlayerTestRunner.Builder.VIDEO_FORMAT); new FakeMediaSource(SINGLE_PERIOD_TIMELINE, ExoPlayerTestRunner.Builder.VIDEO_FORMAT);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("AnalyticsCollectorTest") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.addMediaSources(fakeMediaSource) .addMediaSources(fakeMediaSource)
...@@ -778,7 +780,7 @@ public final class AnalyticsCollectorTest { ...@@ -778,7 +780,7 @@ public final class AnalyticsCollectorTest {
FakeMediaSource fakeMediaSource = FakeMediaSource fakeMediaSource =
new FakeMediaSource(adTimeline, ExoPlayerTestRunner.Builder.VIDEO_FORMAT); new FakeMediaSource(adTimeline, ExoPlayerTestRunner.Builder.VIDEO_FORMAT);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("AnalyticsCollectorTest") new ActionSchedule.Builder(TAG)
.executeRunnable( .executeRunnable(
new PlayerRunnable() { new PlayerRunnable() {
@Override @Override
...@@ -1004,7 +1006,7 @@ public final class AnalyticsCollectorTest { ...@@ -1004,7 +1006,7 @@ public final class AnalyticsCollectorTest {
FakeMediaSource fakeMediaSource = FakeMediaSource fakeMediaSource =
new FakeMediaSource(adTimeline, ExoPlayerTestRunner.Builder.VIDEO_FORMAT); new FakeMediaSource(adTimeline, ExoPlayerTestRunner.Builder.VIDEO_FORMAT);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("AnalyticsCollectorTest") new ActionSchedule.Builder(TAG)
.pause() .pause()
// Ensure everything is preloaded. // Ensure everything is preloaded.
.waitForIsLoading(true) .waitForIsLoading(true)
...@@ -1112,7 +1114,7 @@ public final class AnalyticsCollectorTest { ...@@ -1112,7 +1114,7 @@ public final class AnalyticsCollectorTest {
public void notifyExternalEvents() throws Exception { public void notifyExternalEvents() throws Exception {
MediaSource mediaSource = new FakeMediaSource(SINGLE_PERIOD_TIMELINE); MediaSource mediaSource = new FakeMediaSource(SINGLE_PERIOD_TIMELINE);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("AnalyticsCollectorTest") new ActionSchedule.Builder(TAG)
.pause() .pause()
.waitForPlaybackState(Player.STATE_READY) .waitForPlaybackState(Player.STATE_READY)
.executeRunnable( .executeRunnable(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment