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