Commit 95ba4f85 by olly Committed by Oliver Woodman

Drop prefix test- from core test methods

This is one step toward following the google3's test naming convention.
See go/java-testing/getting_started#basic-test-template for details
why prefix test isn't necessary.

This CL is generated by following command
$ find -name '*Test.java' | xargs -I{} sed -i 's/^\ \ public\ void\ test\([A-Z]\)\(.*\)$/  public void \L\1\E\2/' {}

PiperOrigin-RevId: 296169886
parent 7e6a1418
Showing with 722 additions and 749 deletions
...@@ -46,37 +46,37 @@ public final class ContentDataSourceTest { ...@@ -46,37 +46,37 @@ public final class ContentDataSourceTest {
private static final String DATA_PATH = "mp3/1024_incrementing_bytes.mp3"; private static final String DATA_PATH = "mp3/1024_incrementing_bytes.mp3";
@Test @Test
public void testRead() throws Exception { public void read() throws Exception {
assertData(0, C.LENGTH_UNSET, false); assertData(0, C.LENGTH_UNSET, false);
} }
@Test @Test
public void testReadPipeMode() throws Exception { public void readPipeMode() throws Exception {
assertData(0, C.LENGTH_UNSET, true); assertData(0, C.LENGTH_UNSET, true);
} }
@Test @Test
public void testReadFixedLength() throws Exception { public void readFixedLength() throws Exception {
assertData(0, 100, false); assertData(0, 100, false);
} }
@Test @Test
public void testReadFromOffsetToEndOfInput() throws Exception { public void readFromOffsetToEndOfInput() throws Exception {
assertData(1, C.LENGTH_UNSET, false); assertData(1, C.LENGTH_UNSET, false);
} }
@Test @Test
public void testReadFromOffsetToEndOfInputPipeMode() throws Exception { public void readFromOffsetToEndOfInputPipeMode() throws Exception {
assertData(1, C.LENGTH_UNSET, true); assertData(1, C.LENGTH_UNSET, true);
} }
@Test @Test
public void testReadFromOffsetFixedLength() throws Exception { public void readFromOffsetFixedLength() throws Exception {
assertData(1, 100, false); assertData(1, 100, false);
} }
@Test @Test
public void testReadInvalidUri() throws Exception { public void readInvalidUri() throws Exception {
ContentDataSource dataSource = ContentDataSource dataSource =
new ContentDataSource(InstrumentationRegistry.getTargetContext()); new ContentDataSource(InstrumentationRegistry.getTargetContext());
Uri contentUri = TestContentProvider.buildUri("does/not.exist", false); Uri contentUri = TestContentProvider.buildUri("does/not.exist", false);
......
...@@ -44,7 +44,7 @@ public class DefaultLoadControlTest { ...@@ -44,7 +44,7 @@ public class DefaultLoadControlTest {
} }
@Test @Test
public void testShouldContinueLoading_untilMaxBufferExceeded() { public void shouldContinueLoading_untilMaxBufferExceeded() {
createDefaultLoadControl(); createDefaultLoadControl();
assertThat(loadControl.shouldContinueLoading(/* bufferedDurationUs= */ 0, SPEED)).isTrue(); assertThat(loadControl.shouldContinueLoading(/* bufferedDurationUs= */ 0, SPEED)).isTrue();
...@@ -54,7 +54,7 @@ public class DefaultLoadControlTest { ...@@ -54,7 +54,7 @@ public class DefaultLoadControlTest {
} }
@Test @Test
public void testShouldNotContinueLoadingOnceBufferingStopped_untilBelowMinBuffer() { public void shouldNotContinueLoadingOnceBufferingStopped_untilBelowMinBuffer() {
createDefaultLoadControl(); createDefaultLoadControl();
assertThat(loadControl.shouldContinueLoading(MAX_BUFFER_US, SPEED)).isFalse(); assertThat(loadControl.shouldContinueLoading(MAX_BUFFER_US, SPEED)).isFalse();
...@@ -79,7 +79,7 @@ public class DefaultLoadControlTest { ...@@ -79,7 +79,7 @@ public class DefaultLoadControlTest {
} }
@Test @Test
public void testShouldContinueLoadingWithTargetBufferBytesReached_untilMinBufferReached() { public void shouldContinueLoadingWithTargetBufferBytesReached_untilMinBufferReached() {
createDefaultLoadControl(); createDefaultLoadControl();
makeSureTargetBufferBytesReached(); makeSureTargetBufferBytesReached();
...@@ -90,7 +90,7 @@ public class DefaultLoadControlTest { ...@@ -90,7 +90,7 @@ public class DefaultLoadControlTest {
} }
@Test @Test
public void testShouldNeverContinueLoading_ifMaxBufferReachedAndNotPrioritizeTimeOverSize() { public void shouldNeverContinueLoading_ifMaxBufferReachedAndNotPrioritizeTimeOverSize() {
builder.setPrioritizeTimeOverSizeThresholds(false); builder.setPrioritizeTimeOverSizeThresholds(false);
createDefaultLoadControl(); createDefaultLoadControl();
// Put loadControl in buffering state. // Put loadControl in buffering state.
...@@ -104,7 +104,7 @@ public class DefaultLoadControlTest { ...@@ -104,7 +104,7 @@ public class DefaultLoadControlTest {
} }
@Test @Test
public void testShouldContinueLoadingWithMinBufferReached_inFastPlayback() { public void shouldContinueLoadingWithMinBufferReached_inFastPlayback() {
createDefaultLoadControl(); createDefaultLoadControl();
// At normal playback speed, we stop buffering when the buffer reaches the minimum. // At normal playback speed, we stop buffering when the buffer reaches the minimum.
...@@ -114,7 +114,7 @@ public class DefaultLoadControlTest { ...@@ -114,7 +114,7 @@ public class DefaultLoadControlTest {
} }
@Test @Test
public void testShouldNotContinueLoadingWithMaxBufferReached_inFastPlayback() { public void shouldNotContinueLoadingWithMaxBufferReached_inFastPlayback() {
createDefaultLoadControl(); createDefaultLoadControl();
assertThat(loadControl.shouldContinueLoading(MAX_BUFFER_US, /* playbackSpeed= */ 100f)) assertThat(loadControl.shouldContinueLoading(MAX_BUFFER_US, /* playbackSpeed= */ 100f))
...@@ -122,7 +122,7 @@ public class DefaultLoadControlTest { ...@@ -122,7 +122,7 @@ public class DefaultLoadControlTest {
} }
@Test @Test
public void testStartsPlayback_whenMinBufferSizeReached() { public void startsPlayback_whenMinBufferSizeReached() {
createDefaultLoadControl(); createDefaultLoadControl();
assertThat(loadControl.shouldStartPlayback(MIN_BUFFER_US, SPEED, /* rebuffering= */ false)) assertThat(loadControl.shouldStartPlayback(MIN_BUFFER_US, SPEED, /* rebuffering= */ false))
......
...@@ -114,7 +114,7 @@ public final class ExoPlayerTest { ...@@ -114,7 +114,7 @@ public final class ExoPlayerTest {
* error. * error.
*/ */
@Test @Test
public void testPlayEmptyTimeline() throws Exception { public void playEmptyTimeline() throws Exception {
Timeline timeline = Timeline.EMPTY; Timeline timeline = Timeline.EMPTY;
Timeline expectedMaskingTimeline = new MaskingMediaSource.DummyTimeline(/* tag= */ null); Timeline expectedMaskingTimeline = new MaskingMediaSource.DummyTimeline(/* tag= */ null);
FakeRenderer renderer = new FakeRenderer(); FakeRenderer renderer = new FakeRenderer();
...@@ -137,7 +137,7 @@ public final class ExoPlayerTest { ...@@ -137,7 +137,7 @@ public final class ExoPlayerTest {
/** Tests playback of a source that exposes a single period. */ /** Tests playback of a source that exposes a single period. */
@Test @Test
public void testPlaySinglePeriodTimeline() throws Exception { public void playSinglePeriodTimeline() throws Exception {
Object manifest = new Object(); Object manifest = new Object();
Timeline timeline = new FakeTimeline(/* windowCount= */ 1, manifest); Timeline timeline = new FakeTimeline(/* windowCount= */ 1, manifest);
FakeRenderer renderer = new FakeRenderer(Builder.VIDEO_FORMAT); FakeRenderer renderer = new FakeRenderer(Builder.VIDEO_FORMAT);
...@@ -162,7 +162,7 @@ public final class ExoPlayerTest { ...@@ -162,7 +162,7 @@ public final class ExoPlayerTest {
/** Tests playback of a source that exposes three periods. */ /** Tests playback of a source that exposes three periods. */
@Test @Test
public void testPlayMultiPeriodTimeline() throws Exception { public void playMultiPeriodTimeline() throws Exception {
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);
ExoPlayerTestRunner testRunner = ExoPlayerTestRunner testRunner =
...@@ -186,7 +186,7 @@ public final class ExoPlayerTest { ...@@ -186,7 +186,7 @@ public final class ExoPlayerTest {
/** Tests playback of periods with very short duration. */ /** Tests playback of periods with very short duration. */
@Test @Test
public void testPlayShortDurationPeriods() throws Exception { public void playShortDurationPeriods() throws Exception {
// TimelineWindowDefinition.DEFAULT_WINDOW_DURATION_US / 100 = 1000 us per period. // TimelineWindowDefinition.DEFAULT_WINDOW_DURATION_US / 100 = 1000 us per period.
Timeline timeline = Timeline timeline =
new FakeTimeline(new TimelineWindowDefinition(/* periodCount= */ 100, /* id= */ 0)); new FakeTimeline(new TimelineWindowDefinition(/* periodCount= */ 100, /* id= */ 0));
...@@ -215,7 +215,7 @@ public final class ExoPlayerTest { ...@@ -215,7 +215,7 @@ public final class ExoPlayerTest {
* source. * source.
*/ */
@Test @Test
public void testReadAheadToEndDoesNotResetRenderer() throws Exception { public void readAheadToEndDoesNotResetRenderer() throws Exception {
// Use sufficiently short periods to ensure the player attempts to read all at once. // Use sufficiently short periods to ensure the player attempts to read all at once.
TimelineWindowDefinition windowDefinition0 = TimelineWindowDefinition windowDefinition0 =
new TimelineWindowDefinition( new TimelineWindowDefinition(
...@@ -286,7 +286,7 @@ public final class ExoPlayerTest { ...@@ -286,7 +286,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testResettingMediaSourcesGivesFreshSourceInfo() throws Exception { public void resettingMediaSourcesGivesFreshSourceInfo() throws Exception {
FakeRenderer renderer = new FakeRenderer(Builder.VIDEO_FORMAT); FakeRenderer renderer = new FakeRenderer(Builder.VIDEO_FORMAT);
Timeline firstTimeline = Timeline firstTimeline =
new FakeTimeline( new FakeTimeline(
...@@ -365,7 +365,7 @@ public final class ExoPlayerTest { ...@@ -365,7 +365,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testRepeatModeChanges() throws Exception { public void repeatModeChanges() throws Exception {
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 =
...@@ -415,7 +415,7 @@ public final class ExoPlayerTest { ...@@ -415,7 +415,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testShuffleModeEnabledChanges() throws Exception { public void shuffleModeEnabledChanges() throws Exception {
Timeline fakeTimeline = new FakeTimeline(/* windowCount= */ 1); Timeline fakeTimeline = new FakeTimeline(/* windowCount= */ 1);
MediaSource[] fakeMediaSources = { MediaSource[] fakeMediaSources = {
new FakeMediaSource(fakeTimeline, Builder.VIDEO_FORMAT), new FakeMediaSource(fakeTimeline, Builder.VIDEO_FORMAT),
...@@ -456,7 +456,7 @@ public final class ExoPlayerTest { ...@@ -456,7 +456,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testAdGroupWithLoadErrorIsSkipped() throws Exception { public void adGroupWithLoadErrorIsSkipped() throws Exception {
AdPlaybackState initialAdPlaybackState = AdPlaybackState initialAdPlaybackState =
FakeTimeline.createAdPlaybackState( FakeTimeline.createAdPlaybackState(
/* adsPerAdGroup= */ 1, /* adGroupTimesUs=... */ 5 * C.MICROS_PER_SECOND); /* adsPerAdGroup= */ 1, /* adGroupTimesUs=... */ 5 * C.MICROS_PER_SECOND);
...@@ -501,7 +501,7 @@ public final class ExoPlayerTest { ...@@ -501,7 +501,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testPeriodHoldersReleasedAfterSeekWithRepeatModeAll() 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("testPeriodHoldersReleased")
...@@ -521,7 +521,7 @@ public final class ExoPlayerTest { ...@@ -521,7 +521,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSeekProcessedCallback() 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("testSeekProcessedCallback")
...@@ -586,7 +586,7 @@ public final class ExoPlayerTest { ...@@ -586,7 +586,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testIllegalSeekPositionDoesThrow() 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("testIllegalSeekPositionDoesThrow")
...@@ -614,7 +614,7 @@ public final class ExoPlayerTest { ...@@ -614,7 +614,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSeekDiscontinuity() throws Exception { public void seekDiscontinuity() throws Exception {
FakeTimeline timeline = new FakeTimeline(1); FakeTimeline timeline = new FakeTimeline(1);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
new ActionSchedule.Builder("testSeekDiscontinuity").seek(10).build(); new ActionSchedule.Builder("testSeekDiscontinuity").seek(10).build();
...@@ -629,7 +629,7 @@ public final class ExoPlayerTest { ...@@ -629,7 +629,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSeekDiscontinuityWithAdjustment() throws Exception { public void seekDiscontinuityWithAdjustment() throws Exception {
FakeTimeline timeline = new FakeTimeline(1); FakeTimeline timeline = new FakeTimeline(1);
FakeMediaSource mediaSource = FakeMediaSource mediaSource =
new FakeMediaSource(timeline, Builder.VIDEO_FORMAT) { new FakeMediaSource(timeline, Builder.VIDEO_FORMAT) {
...@@ -664,7 +664,7 @@ public final class ExoPlayerTest { ...@@ -664,7 +664,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testInternalDiscontinuityAtNewPosition() throws Exception { public void internalDiscontinuityAtNewPosition() throws Exception {
FakeTimeline timeline = new FakeTimeline(1); FakeTimeline timeline = new FakeTimeline(1);
FakeMediaSource mediaSource = FakeMediaSource mediaSource =
new FakeMediaSource(timeline, Builder.VIDEO_FORMAT) { new FakeMediaSource(timeline, Builder.VIDEO_FORMAT) {
...@@ -690,7 +690,7 @@ public final class ExoPlayerTest { ...@@ -690,7 +690,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testInternalDiscontinuityAtInitialPosition() throws Exception { public void internalDiscontinuityAtInitialPosition() throws Exception {
FakeTimeline timeline = new FakeTimeline(1); FakeTimeline timeline = new FakeTimeline(1);
FakeMediaSource mediaSource = FakeMediaSource mediaSource =
new FakeMediaSource(timeline, Builder.VIDEO_FORMAT) { new FakeMediaSource(timeline, Builder.VIDEO_FORMAT) {
...@@ -717,7 +717,7 @@ public final class ExoPlayerTest { ...@@ -717,7 +717,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testAllActivatedTrackSelectionAreReleasedForSinglePeriod() throws Exception { public void allActivatedTrackSelectionAreReleasedForSinglePeriod() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
MediaSource mediaSource = MediaSource mediaSource =
new FakeMediaSource(timeline, Builder.VIDEO_FORMAT, Builder.AUDIO_FORMAT); new FakeMediaSource(timeline, Builder.VIDEO_FORMAT, Builder.AUDIO_FORMAT);
...@@ -746,7 +746,7 @@ public final class ExoPlayerTest { ...@@ -746,7 +746,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testAllActivatedTrackSelectionAreReleasedForMultiPeriods() throws Exception { public void allActivatedTrackSelectionAreReleasedForMultiPeriods() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 2); Timeline timeline = new FakeTimeline(/* windowCount= */ 2);
MediaSource mediaSource = MediaSource mediaSource =
new FakeMediaSource(timeline, Builder.VIDEO_FORMAT, Builder.AUDIO_FORMAT); new FakeMediaSource(timeline, Builder.VIDEO_FORMAT, Builder.AUDIO_FORMAT);
...@@ -775,8 +775,7 @@ public final class ExoPlayerTest { ...@@ -775,8 +775,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testAllActivatedTrackSelectionAreReleasedWhenTrackSelectionsAreRemade() public void allActivatedTrackSelectionAreReleasedWhenTrackSelectionsAreRemade() throws Exception {
throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
MediaSource mediaSource = MediaSource mediaSource =
new FakeMediaSource(timeline, Builder.VIDEO_FORMAT, Builder.AUDIO_FORMAT); new FakeMediaSource(timeline, Builder.VIDEO_FORMAT, Builder.AUDIO_FORMAT);
...@@ -814,8 +813,7 @@ public final class ExoPlayerTest { ...@@ -814,8 +813,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testAllActivatedTrackSelectionAreReleasedWhenTrackSelectionsAreReused() public void allActivatedTrackSelectionAreReleasedWhenTrackSelectionsAreReused() throws Exception {
throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
MediaSource mediaSource = MediaSource mediaSource =
new FakeMediaSource(timeline, Builder.VIDEO_FORMAT, Builder.AUDIO_FORMAT); new FakeMediaSource(timeline, Builder.VIDEO_FORMAT, Builder.AUDIO_FORMAT);
...@@ -855,7 +853,7 @@ public final class ExoPlayerTest { ...@@ -855,7 +853,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testDynamicTimelineChangeReason() throws Exception { public void dynamicTimelineChangeReason() throws Exception {
Timeline timeline = new FakeTimeline(new TimelineWindowDefinition(false, false, 100000)); Timeline timeline = new FakeTimeline(new TimelineWindowDefinition(false, false, 100000));
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);
...@@ -884,7 +882,7 @@ public final class ExoPlayerTest { ...@@ -884,7 +882,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testResetMediaSourcesWithPositionResetAndShufflingUsesFirstPeriod() throws Exception { public void resetMediaSourcesWithPositionResetAndShufflingUsesFirstPeriod() throws Exception {
Timeline fakeTimeline = Timeline fakeTimeline =
new FakeTimeline( new FakeTimeline(
new TimelineWindowDefinition( new TimelineWindowDefinition(
...@@ -926,7 +924,7 @@ public final class ExoPlayerTest { ...@@ -926,7 +924,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSetPlaybackParametersBeforePreparationCompletesSucceeds() throws Exception { public void setPlaybackParametersBeforePreparationCompletesSucceeds() throws Exception {
// Test that no exception is thrown when playback parameters are updated between creating a // Test that no exception is thrown when playback parameters are updated between creating a
// period and preparation of the period completing. // period and preparation of the period completing.
final CountDownLatch createPeriodCalledCountDownLatch = new CountDownLatch(1); final CountDownLatch createPeriodCalledCountDownLatch = new CountDownLatch(1);
...@@ -973,7 +971,7 @@ public final class ExoPlayerTest { ...@@ -973,7 +971,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testStopDoesNotResetPosition() throws Exception { public void stopDoesNotResetPosition() throws Exception {
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 =
...@@ -1007,7 +1005,7 @@ public final class ExoPlayerTest { ...@@ -1007,7 +1005,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testStopWithoutResetDoesNotResetPosition() throws Exception { public void stopWithoutResetDoesNotResetPosition() throws Exception {
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 =
...@@ -1041,7 +1039,7 @@ public final class ExoPlayerTest { ...@@ -1041,7 +1039,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testStopWithResetDoesResetPosition() throws Exception { public void stopWithResetDoesResetPosition() throws Exception {
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 =
...@@ -1076,7 +1074,7 @@ public final class ExoPlayerTest { ...@@ -1076,7 +1074,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testStopWithoutResetReleasesMediaSource() throws Exception { public void stopWithoutResetReleasesMediaSource() throws Exception {
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 =
...@@ -1096,7 +1094,7 @@ public final class ExoPlayerTest { ...@@ -1096,7 +1094,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testStopWithResetReleasesMediaSource() throws Exception { public void stopWithResetReleasesMediaSource() throws Exception {
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 =
...@@ -1116,7 +1114,7 @@ public final class ExoPlayerTest { ...@@ -1116,7 +1114,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSettingNewStartPositionPossibleAfterStopWithReset() throws Exception { public void settingNewStartPositionPossibleAfterStopWithReset() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 2); Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 2);
MediaSource secondSource = new FakeMediaSource(secondTimeline, Builder.VIDEO_FORMAT); MediaSource secondSource = new FakeMediaSource(secondTimeline, Builder.VIDEO_FORMAT);
...@@ -1173,7 +1171,7 @@ public final class ExoPlayerTest { ...@@ -1173,7 +1171,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testResetPlaylistWithPreviousPosition() throws Exception { public void resetPlaylistWithPreviousPosition() throws Exception {
Object firstWindowId = new Object(); Object firstWindowId = new Object();
Timeline timeline = Timeline timeline =
new FakeTimeline( new FakeTimeline(
...@@ -1225,7 +1223,7 @@ public final class ExoPlayerTest { ...@@ -1225,7 +1223,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testResetPlaylistStartsFromDefaultPosition() throws Exception { public void resetPlaylistStartsFromDefaultPosition() throws Exception {
Object firstWindowId = new Object(); Object firstWindowId = new Object();
Timeline timeline = Timeline timeline =
new FakeTimeline( new FakeTimeline(
...@@ -1277,7 +1275,7 @@ public final class ExoPlayerTest { ...@@ -1277,7 +1275,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testResetPlaylistWithoutResettingPositionStartsFromOldPosition() throws Exception { public void resetPlaylistWithoutResettingPositionStartsFromOldPosition() throws Exception {
Object firstWindowId = new Object(); Object firstWindowId = new Object();
Timeline timeline = Timeline timeline =
new FakeTimeline( new FakeTimeline(
...@@ -1329,7 +1327,7 @@ public final class ExoPlayerTest { ...@@ -1329,7 +1327,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testStopDuringPreparationOverwritesPreparation() 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("testStopOverwritesPrepare")
...@@ -1354,7 +1352,7 @@ public final class ExoPlayerTest { ...@@ -1354,7 +1352,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testStopAndSeekAfterStopDoesNotResetTimeline() throws Exception { public void stopAndSeekAfterStopDoesNotResetTimeline() throws Exception {
// Combining additional stop and seek after initial stop in one test to get the seek processed // Combining additional stop and seek after initial stop in one test to get the seek processed
// 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);
...@@ -1382,7 +1380,7 @@ public final class ExoPlayerTest { ...@@ -1382,7 +1380,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testReprepareAfterPlaybackError() 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("testReprepareAfterPlaybackError")
...@@ -1410,7 +1408,7 @@ public final class ExoPlayerTest { ...@@ -1410,7 +1408,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSeekAndReprepareAfterPlaybackError() throws Exception { public void seekAndReprepareAfterPlaybackError() throws Exception {
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 =
...@@ -1494,7 +1492,7 @@ public final class ExoPlayerTest { ...@@ -1494,7 +1492,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testRestartAfterEmptyTimelineWithShuffleModeEnabledUsesCorrectFirstPeriod() public void restartAfterEmptyTimelineWithShuffleModeEnabledUsesCorrectFirstPeriod()
throws Exception { throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
FakeMediaSource mediaSource = new FakeMediaSource(timeline); FakeMediaSource mediaSource = new FakeMediaSource(timeline);
...@@ -1533,7 +1531,7 @@ public final class ExoPlayerTest { ...@@ -1533,7 +1531,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testPlaybackErrorAndReprepareDoesNotResetPosition() throws Exception { public void playbackErrorAndReprepareDoesNotResetPosition() throws Exception {
final Timeline timeline = new FakeTimeline(/* windowCount= */ 2); final Timeline timeline = new FakeTimeline(/* windowCount= */ 2);
final long[] positionHolder = new long[3]; final long[] positionHolder = new long[3];
final int[] windowIndexHolder = new int[3]; final int[] windowIndexHolder = new int[3];
...@@ -1596,7 +1594,7 @@ public final class ExoPlayerTest { ...@@ -1596,7 +1594,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSeekAfterPlaybackError() throws Exception { public void seekAfterPlaybackError() throws Exception {
final Timeline timeline = new FakeTimeline(/* windowCount= */ 2); final Timeline timeline = new FakeTimeline(/* windowCount= */ 2);
final long[] positionHolder = {C.TIME_UNSET, C.TIME_UNSET, C.TIME_UNSET}; final long[] positionHolder = {C.TIME_UNSET, C.TIME_UNSET, C.TIME_UNSET};
final int[] windowIndexHolder = {C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET}; final int[] windowIndexHolder = {C.INDEX_UNSET, C.INDEX_UNSET, C.INDEX_UNSET};
...@@ -1701,7 +1699,7 @@ public final class ExoPlayerTest { ...@@ -1701,7 +1699,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testPlaybackErrorTwiceStillKeepsTimeline() throws Exception { public void playbackErrorTwiceStillKeepsTimeline() throws Exception {
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 =
...@@ -1737,7 +1735,7 @@ public final class ExoPlayerTest { ...@@ -1737,7 +1735,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSendMessagesDuringPreparation() throws Exception { public void sendMessagesDuringPreparation() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
...@@ -1757,7 +1755,7 @@ public final class ExoPlayerTest { ...@@ -1757,7 +1755,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSendMessagesAfterPreparation() throws Exception { public void sendMessagesAfterPreparation() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
...@@ -1778,7 +1776,7 @@ public final class ExoPlayerTest { ...@@ -1778,7 +1776,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testMultipleSendMessages() throws Exception { public void multipleSendMessages() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
PositionGrabbingMessageTarget target50 = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target50 = new PositionGrabbingMessageTarget();
PositionGrabbingMessageTarget target80 = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target80 = new PositionGrabbingMessageTarget();
...@@ -1802,7 +1800,7 @@ public final class ExoPlayerTest { ...@@ -1802,7 +1800,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSendMessagesFromStartPositionOnlyOnce() throws Exception { public void sendMessagesFromStartPositionOnlyOnce() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
AtomicInteger counter = new AtomicInteger(); AtomicInteger counter = new AtomicInteger();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
...@@ -1831,7 +1829,7 @@ public final class ExoPlayerTest { ...@@ -1831,7 +1829,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testMultipleSendMessagesAtSameTime() throws Exception { public void multipleSendMessagesAtSameTime() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
PositionGrabbingMessageTarget target1 = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target1 = new PositionGrabbingMessageTarget();
PositionGrabbingMessageTarget target2 = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target2 = new PositionGrabbingMessageTarget();
...@@ -1854,7 +1852,7 @@ public final class ExoPlayerTest { ...@@ -1854,7 +1852,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSendMessagesMultiPeriodResolution() throws Exception { public void sendMessagesMultiPeriodResolution() throws Exception {
Timeline timeline = Timeline timeline =
new FakeTimeline(new TimelineWindowDefinition(/* periodCount= */ 10, /* id= */ 0)); new FakeTimeline(new TimelineWindowDefinition(/* periodCount= */ 10, /* id= */ 0));
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
...@@ -1875,7 +1873,7 @@ public final class ExoPlayerTest { ...@@ -1875,7 +1873,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSendMessagesAtStartAndEndOfPeriod() throws Exception { public void sendMessagesAtStartAndEndOfPeriod() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 2); Timeline timeline = new FakeTimeline(/* windowCount= */ 2);
PositionGrabbingMessageTarget targetStartFirstPeriod = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget targetStartFirstPeriod = new PositionGrabbingMessageTarget();
PositionGrabbingMessageTarget targetEndMiddlePeriodResolved = PositionGrabbingMessageTarget targetEndMiddlePeriodResolved =
...@@ -1936,7 +1934,7 @@ public final class ExoPlayerTest { ...@@ -1936,7 +1934,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSendMessagesSeekOnDeliveryTimeDuringPreparation() throws Exception { public void sendMessagesSeekOnDeliveryTimeDuringPreparation() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
...@@ -1955,7 +1953,7 @@ public final class ExoPlayerTest { ...@@ -1955,7 +1953,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSendMessagesSeekOnDeliveryTimeAfterPreparation() throws Exception { public void sendMessagesSeekOnDeliveryTimeAfterPreparation() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
...@@ -1976,7 +1974,7 @@ public final class ExoPlayerTest { ...@@ -1976,7 +1974,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSendMessagesSeekAfterDeliveryTimeDuringPreparation() throws Exception { public void sendMessagesSeekAfterDeliveryTimeDuringPreparation() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
...@@ -1997,7 +1995,7 @@ public final class ExoPlayerTest { ...@@ -1997,7 +1995,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSendMessagesSeekAfterDeliveryTimeAfterPreparation() throws Exception { public void sendMessagesSeekAfterDeliveryTimeAfterPreparation() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
...@@ -2019,7 +2017,7 @@ public final class ExoPlayerTest { ...@@ -2019,7 +2017,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSendMessagesRepeatDoesNotRepost() throws Exception { public void sendMessagesRepeatDoesNotRepost() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
...@@ -2043,7 +2041,7 @@ public final class ExoPlayerTest { ...@@ -2043,7 +2041,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSendMessagesRepeatWithoutDeletingDoesRepost() throws Exception { public void sendMessagesRepeatWithoutDeletingDoesRepost() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
...@@ -2072,7 +2070,7 @@ public final class ExoPlayerTest { ...@@ -2072,7 +2070,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSendMessagesMoveCurrentWindowIndex() throws Exception { public void sendMessagesMoveCurrentWindowIndex() throws Exception {
Timeline timeline = Timeline timeline =
new FakeTimeline(new TimelineWindowDefinition(/* periodCount= */ 1, /* id= */ 0)); new FakeTimeline(new TimelineWindowDefinition(/* periodCount= */ 1, /* id= */ 0));
final Timeline secondTimeline = final Timeline secondTimeline =
...@@ -2103,7 +2101,7 @@ public final class ExoPlayerTest { ...@@ -2103,7 +2101,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSendMessagesMultiWindowDuringPreparation() throws Exception { public void sendMessagesMultiWindowDuringPreparation() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 3); Timeline timeline = new FakeTimeline(/* windowCount= */ 3);
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
...@@ -2124,7 +2122,7 @@ public final class ExoPlayerTest { ...@@ -2124,7 +2122,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSendMessagesMultiWindowAfterPreparation() throws Exception { public void sendMessagesMultiWindowAfterPreparation() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 3); Timeline timeline = new FakeTimeline(/* windowCount= */ 3);
PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
...@@ -2146,7 +2144,7 @@ public final class ExoPlayerTest { ...@@ -2146,7 +2144,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSendMessagesMoveWindowIndex() throws Exception { public void sendMessagesMoveWindowIndex() throws Exception {
Timeline timeline = Timeline timeline =
new FakeTimeline( new FakeTimeline(
new TimelineWindowDefinition(/* periodCount= */ 1, /* id= */ 0), new TimelineWindowDefinition(/* periodCount= */ 1, /* id= */ 0),
...@@ -2180,7 +2178,7 @@ public final class ExoPlayerTest { ...@@ -2180,7 +2178,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSendMessagesNonLinearPeriodOrder() throws Exception { public void sendMessagesNonLinearPeriodOrder() throws Exception {
Timeline fakeTimeline = new FakeTimeline(/* windowCount= */ 1); Timeline fakeTimeline = new FakeTimeline(/* windowCount= */ 1);
MediaSource[] fakeMediaSources = { MediaSource[] fakeMediaSources = {
new FakeMediaSource(fakeTimeline, Builder.VIDEO_FORMAT), new FakeMediaSource(fakeTimeline, Builder.VIDEO_FORMAT),
...@@ -2215,7 +2213,7 @@ public final class ExoPlayerTest { ...@@ -2215,7 +2213,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testCancelMessageBeforeDelivery() throws Exception { public void cancelMessageBeforeDelivery() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
final PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget(); final PositionGrabbingMessageTarget target = new PositionGrabbingMessageTarget();
final AtomicReference<PlayerMessage> message = new AtomicReference<>(); final AtomicReference<PlayerMessage> message = new AtomicReference<>();
...@@ -2247,7 +2245,7 @@ public final class ExoPlayerTest { ...@@ -2247,7 +2245,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testCancelRepeatedMessageAfterDelivery() throws Exception { public void cancelRepeatedMessageAfterDelivery() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
final CountingMessageTarget target = new CountingMessageTarget(); final CountingMessageTarget target = new CountingMessageTarget();
final AtomicReference<PlayerMessage> message = new AtomicReference<>(); final AtomicReference<PlayerMessage> message = new AtomicReference<>();
...@@ -2285,7 +2283,7 @@ public final class ExoPlayerTest { ...@@ -2285,7 +2283,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSetAndSwitchSurface() throws Exception { public void setAndSwitchSurface() throws Exception {
final List<Integer> rendererMessages = new ArrayList<>(); final List<Integer> rendererMessages = new ArrayList<>();
Renderer videoRenderer = Renderer videoRenderer =
new FakeRenderer(Builder.VIDEO_FORMAT) { new FakeRenderer(Builder.VIDEO_FORMAT) {
...@@ -2308,7 +2306,7 @@ public final class ExoPlayerTest { ...@@ -2308,7 +2306,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSwitchSurfaceOnEndedState() throws Exception { public void switchSurfaceOnEndedState() throws Exception {
ActionSchedule.Builder scheduleBuilder = ActionSchedule.Builder scheduleBuilder =
new ActionSchedule.Builder("testSwitchSurfaceOnEndedState") new ActionSchedule.Builder("testSwitchSurfaceOnEndedState")
.waitForPlaybackState(Player.STATE_ENDED); .waitForPlaybackState(Player.STATE_ENDED);
...@@ -2323,7 +2321,7 @@ public final class ExoPlayerTest { ...@@ -2323,7 +2321,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testTimelineUpdateDropsPrebufferedPeriods() throws Exception { public void timelineUpdateDropsPrebufferedPeriods() throws Exception {
Timeline timeline1 = Timeline timeline1 =
new FakeTimeline( new FakeTimeline(
new TimelineWindowDefinition(/* periodCount= */ 1, /* id= */ 1), new TimelineWindowDefinition(/* periodCount= */ 1, /* id= */ 1),
...@@ -2373,7 +2371,7 @@ public final class ExoPlayerTest { ...@@ -2373,7 +2371,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testRepeatedSeeksToUnpreparedPeriodInSameWindowKeepsWindowSequenceNumber() public void repeatedSeeksToUnpreparedPeriodInSameWindowKeepsWindowSequenceNumber()
throws Exception { throws Exception {
Timeline timeline = Timeline timeline =
new FakeTimeline( new FakeTimeline(
...@@ -2418,7 +2416,7 @@ public final class ExoPlayerTest { ...@@ -2418,7 +2416,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testInvalidSeekFallsBackToSubsequentPeriodOfTheRemovedPeriod() throws Exception { public void invalidSeekFallsBackToSubsequentPeriodOfTheRemovedPeriod() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
CountDownLatch sourceReleasedCountDownLatch = new CountDownLatch(/* count= */ 1); CountDownLatch sourceReleasedCountDownLatch = new CountDownLatch(/* count= */ 1);
MediaSource mediaSourceToRemove = MediaSource mediaSourceToRemove =
...@@ -2482,7 +2480,7 @@ public final class ExoPlayerTest { ...@@ -2482,7 +2480,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testRecursivePlayerChangesReportConsistentValuesForAllListeners() throws Exception { public void recursivePlayerChangesReportConsistentValuesForAllListeners() throws Exception {
// We add two listeners to the player. The first stops the player as soon as it's ready and both // We add two listeners to the player. The first stops the player as soon as it's ready and both
// record the state change events they receive. // record the state change events they receive.
final AtomicReference<Player> playerReference = new AtomicReference<>(); final AtomicReference<Player> playerReference = new AtomicReference<>();
...@@ -2532,7 +2530,7 @@ public final class ExoPlayerTest { ...@@ -2532,7 +2530,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testRecursivePlayerChangesAreReportedInCorrectOrder() throws Exception { public void recursivePlayerChangesAreReportedInCorrectOrder() throws Exception {
// The listener stops the player as soon as it's ready (which should report a timeline and state // The listener stops the player as soon as it's ready (which should report a timeline and state
// change) and sets playWhenReady to false when the timeline callback is received. // change) and sets playWhenReady to false when the timeline callback is received.
final AtomicReference<Player> playerReference = new AtomicReference<>(); final AtomicReference<Player> playerReference = new AtomicReference<>();
...@@ -2591,7 +2589,7 @@ public final class ExoPlayerTest { ...@@ -2591,7 +2589,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testRecursiveTimelineChangeInStopAreReportedInCorrectOrder() throws Exception { public void recursiveTimelineChangeInStopAreReportedInCorrectOrder() throws Exception {
Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 2); Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 2);
Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 3); Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 3);
final AtomicReference<ExoPlayer> playerReference = new AtomicReference<>(); final AtomicReference<ExoPlayer> playerReference = new AtomicReference<>();
...@@ -2645,7 +2643,7 @@ public final class ExoPlayerTest { ...@@ -2645,7 +2643,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testClippedLoopedPeriodsArePlayedFully() throws Exception { public void clippedLoopedPeriodsArePlayedFully() throws Exception {
long startPositionUs = 300_000; long startPositionUs = 300_000;
long expectedDurationUs = 700_000; long expectedDurationUs = 700_000;
MediaSource mediaSource = MediaSource mediaSource =
...@@ -2708,7 +2706,7 @@ public final class ExoPlayerTest { ...@@ -2708,7 +2706,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testUpdateTrackSelectorThenSeekToUnpreparedPeriod_returnsEmptyTrackGroups() public void updateTrackSelectorThenSeekToUnpreparedPeriod_returnsEmptyTrackGroups()
throws Exception { throws Exception {
// Use unset duration to prevent pre-loading of the second window. // Use unset duration to prevent pre-loading of the second window.
Timeline timelineUnsetDuration = Timeline timelineUnsetDuration =
...@@ -2757,7 +2755,7 @@ public final class ExoPlayerTest { ...@@ -2757,7 +2755,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSecondMediaSourceInPlaylistOnlyThrowsWhenPreviousPeriodIsFullyRead() public void secondMediaSourceInPlaylistOnlyThrowsWhenPreviousPeriodIsFullyRead()
throws Exception { throws Exception {
Timeline fakeTimeline = Timeline fakeTimeline =
new FakeTimeline( new FakeTimeline(
...@@ -3253,7 +3251,7 @@ public final class ExoPlayerTest { ...@@ -3253,7 +3251,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testDelegatingMediaSourceApproach() throws Exception { public void delegatingMediaSourceApproach() throws Exception {
Timeline fakeTimeline = Timeline fakeTimeline =
new FakeTimeline( new FakeTimeline(
new TimelineWindowDefinition( new TimelineWindowDefinition(
...@@ -3336,7 +3334,7 @@ public final class ExoPlayerTest { ...@@ -3336,7 +3334,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSeekTo_windowIndexIsReset_deprecated() throws Exception { public void seekTo_windowIndexIsReset_deprecated() throws Exception {
FakeTimeline fakeTimeline = new FakeTimeline(/* windowCount= */ 1); FakeTimeline fakeTimeline = new FakeTimeline(/* windowCount= */ 1);
FakeMediaSource mediaSource = new FakeMediaSource(fakeTimeline); FakeMediaSource mediaSource = new FakeMediaSource(fakeTimeline);
LoopingMediaSource loopingMediaSource = new LoopingMediaSource(mediaSource, 2); LoopingMediaSource loopingMediaSource = new LoopingMediaSource(mediaSource, 2);
...@@ -3377,7 +3375,7 @@ public final class ExoPlayerTest { ...@@ -3377,7 +3375,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSeekTo_windowIndexIsReset() throws Exception { public void seekTo_windowIndexIsReset() throws Exception {
FakeTimeline fakeTimeline = new FakeTimeline(/* windowCount= */ 1); FakeTimeline fakeTimeline = new FakeTimeline(/* windowCount= */ 1);
FakeMediaSource mediaSource = new FakeMediaSource(fakeTimeline); FakeMediaSource mediaSource = new FakeMediaSource(fakeTimeline);
LoopingMediaSource loopingMediaSource = new LoopingMediaSource(mediaSource, 2); LoopingMediaSource loopingMediaSource = new LoopingMediaSource(mediaSource, 2);
...@@ -3550,7 +3548,7 @@ public final class ExoPlayerTest { ...@@ -3550,7 +3548,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testMoveMediaItem() throws Exception { public void moveMediaItem() throws Exception {
TimelineWindowDefinition firstWindowDefinition = TimelineWindowDefinition firstWindowDefinition =
new TimelineWindowDefinition( new TimelineWindowDefinition(
/* periodCount= */ 1, /* periodCount= */ 1,
...@@ -3600,7 +3598,7 @@ public final class ExoPlayerTest { ...@@ -3600,7 +3598,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testRemoveMediaItem() throws Exception { public void removeMediaItem() throws Exception {
TimelineWindowDefinition firstWindowDefinition = TimelineWindowDefinition firstWindowDefinition =
new TimelineWindowDefinition( new TimelineWindowDefinition(
/* periodCount= */ 1, /* periodCount= */ 1,
...@@ -3660,7 +3658,7 @@ public final class ExoPlayerTest { ...@@ -3660,7 +3658,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testRemoveMediaItems() throws Exception { public void removeMediaItems() throws Exception {
TimelineWindowDefinition firstWindowDefinition = TimelineWindowDefinition firstWindowDefinition =
new TimelineWindowDefinition( new TimelineWindowDefinition(
/* periodCount= */ 1, /* periodCount= */ 1,
...@@ -3719,7 +3717,7 @@ public final class ExoPlayerTest { ...@@ -3719,7 +3717,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testClearMediaItems() 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("testClearMediaItems")
...@@ -3747,7 +3745,7 @@ public final class ExoPlayerTest { ...@@ -3747,7 +3745,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testMultipleModificationWithRecursiveListenerInvocations() throws Exception { public void multipleModificationWithRecursiveListenerInvocations() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
MediaSource mediaSource = new FakeMediaSource(timeline); MediaSource mediaSource = new FakeMediaSource(timeline);
Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 2); Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 2);
...@@ -3783,8 +3781,7 @@ public final class ExoPlayerTest { ...@@ -3783,8 +3781,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testModifyPlaylistUnprepared_remainsInIdle_needsPrepareForBuffering() public void modifyPlaylistUnprepared_remainsInIdle_needsPrepareForBuffering() throws Exception {
throws Exception {
Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1); Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1);
MediaSource firstMediaSource = new FakeMediaSource(firstTimeline); MediaSource firstMediaSource = new FakeMediaSource(firstTimeline);
Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1); Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1);
...@@ -3873,7 +3870,7 @@ public final class ExoPlayerTest { ...@@ -3873,7 +3870,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testModifyPlaylistPrepared_remainsInEnded_needsSeekForBuffering() throws Exception { public void modifyPlaylistPrepared_remainsInEnded_needsSeekForBuffering() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
FakeMediaSource secondMediaSource = new FakeMediaSource(timeline); FakeMediaSource secondMediaSource = new FakeMediaSource(timeline);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
...@@ -3933,7 +3930,7 @@ public final class ExoPlayerTest { ...@@ -3933,7 +3930,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testStopWithNoReset_modifyingPlaylistRemainsInIdleState_needsPrepareForBuffering() public void stopWithNoReset_modifyingPlaylistRemainsInIdleState_needsPrepareForBuffering()
throws Exception { throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
FakeMediaSource secondMediaSource = new FakeMediaSource(timeline); FakeMediaSource secondMediaSource = new FakeMediaSource(timeline);
...@@ -3987,7 +3984,7 @@ public final class ExoPlayerTest { ...@@ -3987,7 +3984,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testPrepareWithInvalidInitialSeek_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("testPrepareWithInvalidInitialSeek_expectEnded")
...@@ -4018,7 +4015,7 @@ public final class ExoPlayerTest { ...@@ -4018,7 +4015,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testPrepareWhenAlreadyPreparedIsANoop() 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("testPrepareWhenAlreadyPreparedIsANoop")
...@@ -4043,7 +4040,7 @@ public final class ExoPlayerTest { ...@@ -4043,7 +4040,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSeekToIndexLargerThanNumberOfPlaylistItems() throws Exception { public void seekToIndexLargerThanNumberOfPlaylistItems() throws Exception {
Timeline fakeTimeline = Timeline fakeTimeline =
new FakeTimeline( new FakeTimeline(
new TimelineWindowDefinition( new TimelineWindowDefinition(
...@@ -4081,7 +4078,7 @@ public final class ExoPlayerTest { ...@@ -4081,7 +4078,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSeekToIndexWithEmptyMultiWindowMediaSource() throws Exception { public void seekToIndexWithEmptyMultiWindowMediaSource() throws Exception {
Timeline fakeTimeline = Timeline fakeTimeline =
new FakeTimeline( new FakeTimeline(
new TimelineWindowDefinition( new TimelineWindowDefinition(
...@@ -4136,7 +4133,7 @@ public final class ExoPlayerTest { ...@@ -4136,7 +4133,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testEmptyMultiWindowMediaSource_doesNotEnterBufferState() throws Exception { public void emptyMultiWindowMediaSource_doesNotEnterBufferState() throws Exception {
ConcatenatingMediaSource concatenatingMediaSource = ConcatenatingMediaSource concatenatingMediaSource =
new ConcatenatingMediaSource(/* isAtomic= */ false); new ConcatenatingMediaSource(/* isAtomic= */ false);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
...@@ -4155,8 +4152,7 @@ public final class ExoPlayerTest { ...@@ -4155,8 +4152,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSeekToIndexWithEmptyMultiWindowMediaSource_usesLazyPreparation() public void seekToIndexWithEmptyMultiWindowMediaSource_usesLazyPreparation() throws Exception {
throws Exception {
Timeline fakeTimeline = Timeline fakeTimeline =
new FakeTimeline( new FakeTimeline(
new TimelineWindowDefinition( new TimelineWindowDefinition(
...@@ -4212,7 +4208,7 @@ public final class ExoPlayerTest { ...@@ -4212,7 +4208,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSetMediaSources_empty_whenEmpty_correctMaskingWindowIndex() throws Exception { public void setMediaSources_empty_whenEmpty_correctMaskingWindowIndex() throws Exception {
Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1); Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1);
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};
...@@ -4251,7 +4247,7 @@ public final class ExoPlayerTest { ...@@ -4251,7 +4247,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSetMediaSources_empty_whenEmpty_validInitialSeek_correctMaskingWindowIndex() public void setMediaSources_empty_whenEmpty_validInitialSeek_correctMaskingWindowIndex()
throws Exception { throws Exception {
Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1); Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1);
MediaSource secondMediaSource = new FakeMediaSource(secondTimeline); MediaSource secondMediaSource = new FakeMediaSource(secondTimeline);
...@@ -4294,7 +4290,7 @@ public final class ExoPlayerTest { ...@@ -4294,7 +4290,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSetMediaSources_empty_whenEmpty_invalidInitialSeek_correctMaskingWindowIndex() public void setMediaSources_empty_whenEmpty_invalidInitialSeek_correctMaskingWindowIndex()
throws Exception { throws Exception {
Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1); Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1);
MediaSource secondMediaSource = new FakeMediaSource(secondTimeline); MediaSource secondMediaSource = new FakeMediaSource(secondTimeline);
...@@ -4337,7 +4333,7 @@ public final class ExoPlayerTest { ...@@ -4337,7 +4333,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSetMediaSources_whenEmpty_correctMaskingWindowIndex() throws Exception { public void setMediaSources_whenEmpty_correctMaskingWindowIndex() throws Exception {
Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1); Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1);
MediaSource firstMediaSource = new FakeMediaSource(firstTimeline); MediaSource firstMediaSource = new FakeMediaSource(firstTimeline);
Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1); Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1);
...@@ -4400,7 +4396,7 @@ public final class ExoPlayerTest { ...@@ -4400,7 +4396,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSetMediaSources_whenEmpty_validInitialSeek_correctMaskingWindowIndex() public void setMediaSources_whenEmpty_validInitialSeek_correctMaskingWindowIndex()
throws Exception { throws Exception {
Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 2); Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 2);
MediaSource firstMediaSource = new FakeMediaSource(firstTimeline); MediaSource firstMediaSource = new FakeMediaSource(firstTimeline);
...@@ -4443,7 +4439,7 @@ public final class ExoPlayerTest { ...@@ -4443,7 +4439,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSetMediaSources_whenEmpty_invalidInitialSeek_correctMaskingWindowIndex() public void setMediaSources_whenEmpty_invalidInitialSeek_correctMaskingWindowIndex()
throws Exception { throws Exception {
Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1); Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1);
MediaSource firstMediaSource = new FakeMediaSource(firstTimeline); MediaSource firstMediaSource = new FakeMediaSource(firstTimeline);
...@@ -4487,7 +4483,7 @@ public final class ExoPlayerTest { ...@@ -4487,7 +4483,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSetMediaSources_correctMaskingWindowIndex() throws Exception { public void setMediaSources_correctMaskingWindowIndex() throws Exception {
Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1); Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1);
MediaSource firstMediaSource = new FakeMediaSource(firstTimeline); MediaSource firstMediaSource = new FakeMediaSource(firstTimeline);
Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1, new Object()); Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1, new Object());
...@@ -4526,7 +4522,7 @@ public final class ExoPlayerTest { ...@@ -4526,7 +4522,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSetMediaSources_whenIdle_correctMaskingPlaybackState() throws Exception { public void setMediaSources_whenIdle_correctMaskingPlaybackState() throws Exception {
Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1, 1L); Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1, 1L);
MediaSource firstMediaSource = new FakeMediaSource(firstTimeline); MediaSource firstMediaSource = new FakeMediaSource(firstTimeline);
Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1, 2L); Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1, 2L);
...@@ -4595,8 +4591,7 @@ public final class ExoPlayerTest { ...@@ -4595,8 +4591,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSetMediaSources_whenIdle_invalidSeek_correctMaskingPlaybackState() public void setMediaSources_whenIdle_invalidSeek_correctMaskingPlaybackState() throws Exception {
throws Exception {
final int[] maskingPlaybackStates = new int[1]; final int[] maskingPlaybackStates = new int[1];
Arrays.fill(maskingPlaybackStates, C.INDEX_UNSET); Arrays.fill(maskingPlaybackStates, C.INDEX_UNSET);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
...@@ -4637,7 +4632,7 @@ public final class ExoPlayerTest { ...@@ -4637,7 +4632,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSetMediaSources_whenIdle_noSeek_correctMaskingPlaybackState() throws Exception { public void setMediaSources_whenIdle_noSeek_correctMaskingPlaybackState() throws Exception {
final int[] maskingPlaybackStates = new int[1]; final int[] maskingPlaybackStates = new int[1];
Arrays.fill(maskingPlaybackStates, C.INDEX_UNSET); Arrays.fill(maskingPlaybackStates, C.INDEX_UNSET);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
...@@ -4674,8 +4669,7 @@ public final class ExoPlayerTest { ...@@ -4674,8 +4669,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSetMediaSources_whenIdle_noSeekEmpty_correctMaskingPlaybackState() public void setMediaSources_whenIdle_noSeekEmpty_correctMaskingPlaybackState() throws Exception {
throws Exception {
final int[] maskingPlaybackStates = new int[1]; final int[] maskingPlaybackStates = new int[1];
Arrays.fill(maskingPlaybackStates, C.INDEX_UNSET); Arrays.fill(maskingPlaybackStates, C.INDEX_UNSET);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
...@@ -4713,7 +4707,7 @@ public final class ExoPlayerTest { ...@@ -4713,7 +4707,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSetMediaSources_whenEnded_correctMaskingPlaybackState() throws Exception { public void setMediaSources_whenEnded_correctMaskingPlaybackState() throws Exception {
Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1, 1L); Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1, 1L);
MediaSource firstMediaSource = new FakeMediaSource(firstTimeline); MediaSource firstMediaSource = new FakeMediaSource(firstTimeline);
Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1, 2L); Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1, 2L);
...@@ -4801,8 +4795,7 @@ public final class ExoPlayerTest { ...@@ -4801,8 +4795,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSetMediaSources_whenEnded_invalidSeek_correctMaskingPlaybackState() public void setMediaSources_whenEnded_invalidSeek_correctMaskingPlaybackState() throws Exception {
throws Exception {
final int[] maskingPlaybackStates = new int[1]; final int[] maskingPlaybackStates = new int[1];
Arrays.fill(maskingPlaybackStates, C.INDEX_UNSET); Arrays.fill(maskingPlaybackStates, C.INDEX_UNSET);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
...@@ -4843,7 +4836,7 @@ public final class ExoPlayerTest { ...@@ -4843,7 +4836,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSetMediaSources_whenEnded_noSeek_correctMaskingPlaybackState() throws Exception { public void setMediaSources_whenEnded_noSeek_correctMaskingPlaybackState() throws Exception {
final int[] maskingPlaybackStates = new int[1]; final int[] maskingPlaybackStates = new int[1];
Arrays.fill(maskingPlaybackStates, C.INDEX_UNSET); Arrays.fill(maskingPlaybackStates, C.INDEX_UNSET);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
...@@ -4886,8 +4879,7 @@ public final class ExoPlayerTest { ...@@ -4886,8 +4879,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSetMediaSources_whenEnded_noSeekEmpty_correctMaskingPlaybackState() public void setMediaSources_whenEnded_noSeekEmpty_correctMaskingPlaybackState() throws Exception {
throws Exception {
final int[] maskingPlaybackStates = new int[1]; final int[] maskingPlaybackStates = new int[1];
Arrays.fill(maskingPlaybackStates, C.INDEX_UNSET); Arrays.fill(maskingPlaybackStates, C.INDEX_UNSET);
ActionSchedule actionSchedule = ActionSchedule actionSchedule =
...@@ -4926,7 +4918,7 @@ public final class ExoPlayerTest { ...@@ -4926,7 +4918,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSetMediaSources_whenPrepared_correctMaskingPlaybackState() throws Exception { public void setMediaSources_whenPrepared_correctMaskingPlaybackState() throws Exception {
Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1, 1L); Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1, 1L);
MediaSource firstMediaSource = new FakeMediaSource(firstTimeline); MediaSource firstMediaSource = new FakeMediaSource(firstTimeline);
Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1, 2L); Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1, 2L);
...@@ -5040,7 +5032,7 @@ public final class ExoPlayerTest { ...@@ -5040,7 +5032,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testSetMediaSources_whenPrepared_invalidSeek_correctMaskingPlaybackState() public void setMediaSources_whenPrepared_invalidSeek_correctMaskingPlaybackState()
throws Exception { throws Exception {
Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1, 1L); Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1, 1L);
MediaSource firstMediaSource = new FakeMediaSource(firstTimeline); MediaSource firstMediaSource = new FakeMediaSource(firstTimeline);
...@@ -5093,7 +5085,7 @@ public final class ExoPlayerTest { ...@@ -5093,7 +5085,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testAddMediaSources_skipSettingMediaItems_validInitialSeek_correctMaskingWindowIndex() public void addMediaSources_skipSettingMediaItems_validInitialSeek_correctMaskingWindowIndex()
throws Exception { throws Exception {
final int[] currentWindowIndices = new int[5]; final int[] currentWindowIndices = new int[5];
Arrays.fill(currentWindowIndices, C.INDEX_UNSET); Arrays.fill(currentWindowIndices, C.INDEX_UNSET);
...@@ -5180,7 +5172,7 @@ public final class ExoPlayerTest { ...@@ -5180,7 +5172,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testMoveMediaItems_correctMaskingWindowIndex() throws Exception { public void moveMediaItems_correctMaskingWindowIndex() throws Exception {
Timeline timeline = new FakeTimeline(/* windowCount= */ 1); Timeline timeline = new FakeTimeline(/* windowCount= */ 1);
MediaSource firstMediaSource = new FakeMediaSource(timeline); MediaSource firstMediaSource = new FakeMediaSource(timeline);
MediaSource secondMediaSource = new FakeMediaSource(timeline); MediaSource secondMediaSource = new FakeMediaSource(timeline);
...@@ -5263,7 +5255,7 @@ public final class ExoPlayerTest { ...@@ -5263,7 +5255,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testMoveMediaItems_unprepared_correctMaskingWindowIndex() throws Exception { public void moveMediaItems_unprepared_correctMaskingWindowIndex() throws Exception {
Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1); Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1);
MediaSource firstMediaSource = new FakeMediaSource(firstTimeline); MediaSource firstMediaSource = new FakeMediaSource(firstTimeline);
Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1); Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1);
...@@ -5303,7 +5295,7 @@ public final class ExoPlayerTest { ...@@ -5303,7 +5295,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testRemoveMediaItems_correctMaskingWindowIndex() throws Exception { public void removeMediaItems_correctMaskingWindowIndex() throws Exception {
Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1); Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1);
MediaSource firstMediaSource = new FakeMediaSource(firstTimeline); MediaSource firstMediaSource = new FakeMediaSource(firstTimeline);
Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1); Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1);
...@@ -5335,7 +5327,7 @@ public final class ExoPlayerTest { ...@@ -5335,7 +5327,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testRemoveMediaItems_currentItemRemoved_correctMaskingWindowIndex() throws Exception { public void removeMediaItems_currentItemRemoved_correctMaskingWindowIndex() throws Exception {
Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1); Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1);
MediaSource firstMediaSource = new FakeMediaSource(firstTimeline); MediaSource firstMediaSource = new FakeMediaSource(firstTimeline);
Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1); Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1);
...@@ -5373,8 +5365,7 @@ public final class ExoPlayerTest { ...@@ -5373,8 +5365,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testRemoveMediaItems_currentItemRemovedThatIsTheLast_correctMasking() public void removeMediaItems_currentItemRemovedThatIsTheLast_correctMasking() throws Exception {
throws Exception {
Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1, 1L); Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1, 1L);
MediaSource firstMediaSource = new FakeMediaSource(firstTimeline); MediaSource firstMediaSource = new FakeMediaSource(firstTimeline);
Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1, 2L); Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1, 2L);
...@@ -5490,7 +5481,7 @@ public final class ExoPlayerTest { ...@@ -5490,7 +5481,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testRemoveMediaItems_removeTailWithCurrentWindow_whenIdle_finishesPlayback() public void removeMediaItems_removeTailWithCurrentWindow_whenIdle_finishesPlayback()
throws Exception { throws Exception {
Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1); Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1);
MediaSource firstMediaSource = new FakeMediaSource(firstTimeline); MediaSource firstMediaSource = new FakeMediaSource(firstTimeline);
...@@ -5518,7 +5509,7 @@ public final class ExoPlayerTest { ...@@ -5518,7 +5509,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testClearMediaItems_correctMasking() throws Exception { public void clearMediaItems_correctMasking() throws Exception {
Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1); Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1);
MediaSource firstMediaSource = new FakeMediaSource(firstTimeline); MediaSource firstMediaSource = new FakeMediaSource(firstTimeline);
Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1); Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1);
...@@ -5552,7 +5543,7 @@ public final class ExoPlayerTest { ...@@ -5552,7 +5543,7 @@ public final class ExoPlayerTest {
} }
@Test @Test
public void testClearMediaItems_unprepared_correctMaskingWindowIndex_notEnded() throws Exception { public void clearMediaItems_unprepared_correctMaskingWindowIndex_notEnded() throws Exception {
Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1); Timeline firstTimeline = new FakeTimeline(/* windowCount= */ 1);
MediaSource firstMediaSource = new FakeMediaSource(firstTimeline); MediaSource firstMediaSource = new FakeMediaSource(firstTimeline);
Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1); Timeline secondTimeline = new FakeTimeline(/* windowCount= */ 1);
......
...@@ -51,7 +51,7 @@ public class PlaylistTest { ...@@ -51,7 +51,7 @@ public class PlaylistTest {
} }
@Test @Test
public void testEmptyPlaylist_expectConstantTimelineInstanceEMPTY() { public void emptyPlaylist_expectConstantTimelineInstanceEMPTY() {
ShuffleOrder.DefaultShuffleOrder shuffleOrder = ShuffleOrder.DefaultShuffleOrder shuffleOrder =
new ShuffleOrder.DefaultShuffleOrder(/* length= */ 0); new ShuffleOrder.DefaultShuffleOrder(/* length= */ 0);
List<Playlist.MediaSourceHolder> fakeHolders = createFakeHolders(); List<Playlist.MediaSourceHolder> fakeHolders = createFakeHolders();
...@@ -73,7 +73,7 @@ public class PlaylistTest { ...@@ -73,7 +73,7 @@ public class PlaylistTest {
} }
@Test @Test
public void testPrepareAndReprepareAfterRelease_expectSourcePreparationAfterPlaylistPrepare() { public void prepareAndReprepareAfterRelease_expectSourcePreparationAfterPlaylistPrepare() {
MediaSource mockMediaSource1 = mock(MediaSource.class); MediaSource mockMediaSource1 = mock(MediaSource.class);
MediaSource mockMediaSource2 = mock(MediaSource.class); MediaSource mockMediaSource2 = mock(MediaSource.class);
playlist.setMediaSources( playlist.setMediaSources(
...@@ -110,7 +110,7 @@ public class PlaylistTest { ...@@ -110,7 +110,7 @@ public class PlaylistTest {
} }
@Test @Test
public void testSetMediaSources_playlistUnprepared_notUsingLazyPreparation() { public void setMediaSources_playlistUnprepared_notUsingLazyPreparation() {
ShuffleOrder.DefaultShuffleOrder shuffleOrder = ShuffleOrder.DefaultShuffleOrder shuffleOrder =
new ShuffleOrder.DefaultShuffleOrder(/* length= */ 2); new ShuffleOrder.DefaultShuffleOrder(/* length= */ 2);
MediaSource mockMediaSource1 = mock(MediaSource.class); MediaSource mockMediaSource1 = mock(MediaSource.class);
...@@ -152,7 +152,7 @@ public class PlaylistTest { ...@@ -152,7 +152,7 @@ public class PlaylistTest {
} }
@Test @Test
public void testSetMediaSources_playlistPrepared_notUsingLazyPreparation() { public void setMediaSources_playlistPrepared_notUsingLazyPreparation() {
ShuffleOrder.DefaultShuffleOrder shuffleOrder = ShuffleOrder.DefaultShuffleOrder shuffleOrder =
new ShuffleOrder.DefaultShuffleOrder(/* length= */ 2); new ShuffleOrder.DefaultShuffleOrder(/* length= */ 2);
MediaSource mockMediaSource1 = mock(MediaSource.class); MediaSource mockMediaSource1 = mock(MediaSource.class);
...@@ -190,7 +190,7 @@ public class PlaylistTest { ...@@ -190,7 +190,7 @@ public class PlaylistTest {
} }
@Test @Test
public void testAddMediaSources_playlistUnprepared_notUsingLazyPreparation_expectUnprepared() { public void addMediaSources_playlistUnprepared_notUsingLazyPreparation_expectUnprepared() {
MediaSource mockMediaSource1 = mock(MediaSource.class); MediaSource mockMediaSource1 = mock(MediaSource.class);
MediaSource mockMediaSource2 = mock(MediaSource.class); MediaSource mockMediaSource2 = mock(MediaSource.class);
List<Playlist.MediaSourceHolder> mediaSources = List<Playlist.MediaSourceHolder> mediaSources =
...@@ -224,7 +224,7 @@ public class PlaylistTest { ...@@ -224,7 +224,7 @@ public class PlaylistTest {
} }
@Test @Test
public void testAddMediaSources_playlistPrepared_notUsingLazyPreparation_expectPrepared() { public void addMediaSources_playlistPrepared_notUsingLazyPreparation_expectPrepared() {
MediaSource mockMediaSource1 = mock(MediaSource.class); MediaSource mockMediaSource1 = mock(MediaSource.class);
MediaSource mockMediaSource2 = mock(MediaSource.class); MediaSource mockMediaSource2 = mock(MediaSource.class);
playlist.prepare(/* mediaTransferListener= */ null); playlist.prepare(/* mediaTransferListener= */ null);
...@@ -244,7 +244,7 @@ public class PlaylistTest { ...@@ -244,7 +244,7 @@ public class PlaylistTest {
} }
@Test @Test
public void testMoveMediaSources() { public void moveMediaSources() {
ShuffleOrder.DefaultShuffleOrder shuffleOrder = ShuffleOrder.DefaultShuffleOrder shuffleOrder =
new ShuffleOrder.DefaultShuffleOrder(/* length= */ 4); new ShuffleOrder.DefaultShuffleOrder(/* length= */ 4);
List<Playlist.MediaSourceHolder> holders = createFakeHolders(); List<Playlist.MediaSourceHolder> holders = createFakeHolders();
...@@ -283,7 +283,7 @@ public class PlaylistTest { ...@@ -283,7 +283,7 @@ public class PlaylistTest {
} }
@Test @Test
public void testRemoveMediaSources_whenUnprepared_expectNoRelease() { public void removeMediaSources_whenUnprepared_expectNoRelease() {
MediaSource mockMediaSource1 = mock(MediaSource.class); MediaSource mockMediaSource1 = mock(MediaSource.class);
MediaSource mockMediaSource2 = mock(MediaSource.class); MediaSource mockMediaSource2 = mock(MediaSource.class);
MediaSource mockMediaSource3 = mock(MediaSource.class); MediaSource mockMediaSource3 = mock(MediaSource.class);
...@@ -315,7 +315,7 @@ public class PlaylistTest { ...@@ -315,7 +315,7 @@ public class PlaylistTest {
} }
@Test @Test
public void testRemoveMediaSources_whenPrepared_expectRelease() { public void removeMediaSources_whenPrepared_expectRelease() {
MediaSource mockMediaSource1 = mock(MediaSource.class); MediaSource mockMediaSource1 = mock(MediaSource.class);
MediaSource mockMediaSource2 = mock(MediaSource.class); MediaSource mockMediaSource2 = mock(MediaSource.class);
MediaSource mockMediaSource3 = mock(MediaSource.class); MediaSource mockMediaSource3 = mock(MediaSource.class);
...@@ -346,7 +346,7 @@ public class PlaylistTest { ...@@ -346,7 +346,7 @@ public class PlaylistTest {
} }
@Test @Test
public void testRelease_playlistUnprepared_expectSourcesNotReleased() { public void release_playlistUnprepared_expectSourcesNotReleased() {
MediaSource mockMediaSource = mock(MediaSource.class); MediaSource mockMediaSource = mock(MediaSource.class);
Playlist.MediaSourceHolder mediaSourceHolder = Playlist.MediaSourceHolder mediaSourceHolder =
new Playlist.MediaSourceHolder(mockMediaSource, /* useLazyPreparation= */ false); new Playlist.MediaSourceHolder(mockMediaSource, /* useLazyPreparation= */ false);
...@@ -363,7 +363,7 @@ public class PlaylistTest { ...@@ -363,7 +363,7 @@ public class PlaylistTest {
} }
@Test @Test
public void testRelease_playlistPrepared_expectSourcesReleasedNotRemoved() { public void release_playlistPrepared_expectSourcesReleasedNotRemoved() {
MediaSource mockMediaSource = mock(MediaSource.class); MediaSource mockMediaSource = mock(MediaSource.class);
Playlist.MediaSourceHolder mediaSourceHolder = Playlist.MediaSourceHolder mediaSourceHolder =
new Playlist.MediaSourceHolder(mockMediaSource, /* useLazyPreparation= */ false); new Playlist.MediaSourceHolder(mockMediaSource, /* useLazyPreparation= */ false);
...@@ -381,7 +381,7 @@ public class PlaylistTest { ...@@ -381,7 +381,7 @@ public class PlaylistTest {
} }
@Test @Test
public void testClearPlaylist_expectSourcesReleasedAndRemoved() { public void clearPlaylist_expectSourcesReleasedAndRemoved() {
ShuffleOrder.DefaultShuffleOrder shuffleOrder = ShuffleOrder.DefaultShuffleOrder shuffleOrder =
new ShuffleOrder.DefaultShuffleOrder(/* length= */ 4); new ShuffleOrder.DefaultShuffleOrder(/* length= */ 4);
MediaSource mockMediaSource1 = mock(MediaSource.class); MediaSource mockMediaSource1 = mock(MediaSource.class);
...@@ -401,14 +401,14 @@ public class PlaylistTest { ...@@ -401,14 +401,14 @@ public class PlaylistTest {
} }
@Test @Test
public void testSetMediaSources_expectTimelineUsesCustomShuffleOrder() { public void setMediaSources_expectTimelineUsesCustomShuffleOrder() {
Timeline timeline = Timeline timeline =
playlist.setMediaSources(createFakeHolders(), new FakeShuffleOrder(/* length=*/ 4)); playlist.setMediaSources(createFakeHolders(), new FakeShuffleOrder(/* length=*/ 4));
assertTimelineUsesFakeShuffleOrder(timeline); assertTimelineUsesFakeShuffleOrder(timeline);
} }
@Test @Test
public void testAddMediaSources_expectTimelineUsesCustomShuffleOrder() { public void addMediaSources_expectTimelineUsesCustomShuffleOrder() {
Timeline timeline = Timeline timeline =
playlist.addMediaSources( playlist.addMediaSources(
/* index= */ 0, createFakeHolders(), new FakeShuffleOrder(PLAYLIST_SIZE)); /* index= */ 0, createFakeHolders(), new FakeShuffleOrder(PLAYLIST_SIZE));
...@@ -416,7 +416,7 @@ public class PlaylistTest { ...@@ -416,7 +416,7 @@ public class PlaylistTest {
} }
@Test @Test
public void testMoveMediaSources_expectTimelineUsesCustomShuffleOrder() { public void moveMediaSources_expectTimelineUsesCustomShuffleOrder() {
ShuffleOrder shuffleOrder = new ShuffleOrder.DefaultShuffleOrder(/* length= */ PLAYLIST_SIZE); ShuffleOrder shuffleOrder = new ShuffleOrder.DefaultShuffleOrder(/* length= */ PLAYLIST_SIZE);
playlist.addMediaSources(/* index= */ 0, createFakeHolders(), shuffleOrder); playlist.addMediaSources(/* index= */ 0, createFakeHolders(), shuffleOrder);
Timeline timeline = Timeline timeline =
...@@ -426,7 +426,7 @@ public class PlaylistTest { ...@@ -426,7 +426,7 @@ public class PlaylistTest {
} }
@Test @Test
public void testMoveMediaSourceRange_expectTimelineUsesCustomShuffleOrder() { public void moveMediaSourceRange_expectTimelineUsesCustomShuffleOrder() {
ShuffleOrder shuffleOrder = new ShuffleOrder.DefaultShuffleOrder(/* length= */ PLAYLIST_SIZE); ShuffleOrder shuffleOrder = new ShuffleOrder.DefaultShuffleOrder(/* length= */ PLAYLIST_SIZE);
playlist.addMediaSources(/* index= */ 0, createFakeHolders(), shuffleOrder); playlist.addMediaSources(/* index= */ 0, createFakeHolders(), shuffleOrder);
Timeline timeline = Timeline timeline =
...@@ -439,7 +439,7 @@ public class PlaylistTest { ...@@ -439,7 +439,7 @@ public class PlaylistTest {
} }
@Test @Test
public void testRemoveMediaSourceRange_expectTimelineUsesCustomShuffleOrder() { public void removeMediaSourceRange_expectTimelineUsesCustomShuffleOrder() {
ShuffleOrder shuffleOrder = new ShuffleOrder.DefaultShuffleOrder(/* length= */ PLAYLIST_SIZE); ShuffleOrder shuffleOrder = new ShuffleOrder.DefaultShuffleOrder(/* length= */ PLAYLIST_SIZE);
playlist.addMediaSources(/* index= */ 0, createFakeHolders(), shuffleOrder); playlist.addMediaSources(/* index= */ 0, createFakeHolders(), shuffleOrder);
Timeline timeline = Timeline timeline =
...@@ -449,7 +449,7 @@ public class PlaylistTest { ...@@ -449,7 +449,7 @@ public class PlaylistTest {
} }
@Test @Test
public void testSetShuffleOrder_expectTimelineUsesCustomShuffleOrder() { public void setShuffleOrder_expectTimelineUsesCustomShuffleOrder() {
playlist.setMediaSources( playlist.setMediaSources(
createFakeHolders(), new ShuffleOrder.DefaultShuffleOrder(/* length= */ PLAYLIST_SIZE)); createFakeHolders(), new ShuffleOrder.DefaultShuffleOrder(/* length= */ PLAYLIST_SIZE));
assertTimelineUsesFakeShuffleOrder( assertTimelineUsesFakeShuffleOrder(
......
...@@ -29,12 +29,12 @@ import org.junit.runner.RunWith; ...@@ -29,12 +29,12 @@ import org.junit.runner.RunWith;
public class TimelineTest { public class TimelineTest {
@Test @Test
public void testEmptyTimeline() { public void emptyTimeline() {
TimelineAsserts.assertEmpty(Timeline.EMPTY); TimelineAsserts.assertEmpty(Timeline.EMPTY);
} }
@Test @Test
public void testSinglePeriodTimeline() { public void singlePeriodTimeline() {
Timeline timeline = new FakeTimeline(new TimelineWindowDefinition(1, 111)); Timeline timeline = new FakeTimeline(new TimelineWindowDefinition(1, 111));
TimelineAsserts.assertWindowTags(timeline, 111); TimelineAsserts.assertWindowTags(timeline, 111);
TimelineAsserts.assertPeriodCounts(timeline, 1); TimelineAsserts.assertPeriodCounts(timeline, 1);
...@@ -48,7 +48,7 @@ public class TimelineTest { ...@@ -48,7 +48,7 @@ public class TimelineTest {
} }
@Test @Test
public void testMultiPeriodTimeline() { public void multiPeriodTimeline() {
Timeline timeline = new FakeTimeline(new TimelineWindowDefinition(5, 111)); Timeline timeline = new FakeTimeline(new TimelineWindowDefinition(5, 111));
TimelineAsserts.assertWindowTags(timeline, 111); TimelineAsserts.assertWindowTags(timeline, 111);
TimelineAsserts.assertPeriodCounts(timeline, 5); TimelineAsserts.assertPeriodCounts(timeline, 5);
...@@ -62,7 +62,7 @@ public class TimelineTest { ...@@ -62,7 +62,7 @@ public class TimelineTest {
} }
@Test @Test
public void testWindowEquals() { public void windowEquals() {
Timeline.Window window = new Timeline.Window(); Timeline.Window window = new Timeline.Window();
assertThat(window).isEqualTo(new Timeline.Window()); assertThat(window).isEqualTo(new Timeline.Window());
...@@ -151,7 +151,7 @@ public class TimelineTest { ...@@ -151,7 +151,7 @@ public class TimelineTest {
} }
@Test @Test
public void testWindowHashCode() { public void windowHashCode() {
Timeline.Window window = new Timeline.Window(); Timeline.Window window = new Timeline.Window();
Timeline.Window otherWindow = new Timeline.Window(); Timeline.Window otherWindow = new Timeline.Window();
assertThat(window.hashCode()).isEqualTo(otherWindow.hashCode()); assertThat(window.hashCode()).isEqualTo(otherWindow.hashCode());
...@@ -163,7 +163,7 @@ public class TimelineTest { ...@@ -163,7 +163,7 @@ public class TimelineTest {
} }
@Test @Test
public void testPeriodEquals() { public void periodEquals() {
Timeline.Period period = new Timeline.Period(); Timeline.Period period = new Timeline.Period();
assertThat(period).isEqualTo(new Timeline.Period()); assertThat(period).isEqualTo(new Timeline.Period());
...@@ -199,7 +199,7 @@ public class TimelineTest { ...@@ -199,7 +199,7 @@ public class TimelineTest {
} }
@Test @Test
public void testPeriodHashCode() { public void periodHashCode() {
Timeline.Period period = new Timeline.Period(); Timeline.Period period = new Timeline.Period();
Timeline.Period otherPeriod = new Timeline.Period(); Timeline.Period otherPeriod = new Timeline.Period();
assertThat(period.hashCode()).isEqualTo(otherPeriod.hashCode()); assertThat(period.hashCode()).isEqualTo(otherPeriod.hashCode());
......
...@@ -127,7 +127,7 @@ public final class AnalyticsCollectorTest { ...@@ -127,7 +127,7 @@ public final class AnalyticsCollectorTest {
private EventWindowAndPeriodId window1Period0Seq1; private EventWindowAndPeriodId window1Period0Seq1;
@Test @Test
public void testEmptyTimeline() throws Exception { public void emptyTimeline() throws Exception {
FakeMediaSource mediaSource = FakeMediaSource mediaSource =
new FakeMediaSource( new FakeMediaSource(
Timeline.EMPTY, Timeline.EMPTY,
...@@ -144,7 +144,7 @@ public final class AnalyticsCollectorTest { ...@@ -144,7 +144,7 @@ public final class AnalyticsCollectorTest {
} }
@Test @Test
public void testSinglePeriod() throws Exception { public void singlePeriod() throws Exception {
FakeMediaSource mediaSource = FakeMediaSource mediaSource =
new FakeMediaSource( new FakeMediaSource(
SINGLE_PERIOD_TIMELINE, SINGLE_PERIOD_TIMELINE,
...@@ -187,7 +187,7 @@ public final class AnalyticsCollectorTest { ...@@ -187,7 +187,7 @@ public final class AnalyticsCollectorTest {
} }
@Test @Test
public void testAutomaticPeriodTransition() throws Exception { public void automaticPeriodTransition() throws Exception {
MediaSource mediaSource = MediaSource mediaSource =
new ConcatenatingMediaSource( new ConcatenatingMediaSource(
new FakeMediaSource( new FakeMediaSource(
...@@ -248,7 +248,7 @@ public final class AnalyticsCollectorTest { ...@@ -248,7 +248,7 @@ public final class AnalyticsCollectorTest {
} }
@Test @Test
public void testPeriodTransitionWithRendererChange() throws Exception { public void periodTransitionWithRendererChange() throws Exception {
MediaSource mediaSource = MediaSource mediaSource =
new ConcatenatingMediaSource( new ConcatenatingMediaSource(
new FakeMediaSource(SINGLE_PERIOD_TIMELINE, ExoPlayerTestRunner.Builder.VIDEO_FORMAT), new FakeMediaSource(SINGLE_PERIOD_TIMELINE, ExoPlayerTestRunner.Builder.VIDEO_FORMAT),
...@@ -303,7 +303,7 @@ public final class AnalyticsCollectorTest { ...@@ -303,7 +303,7 @@ public final class AnalyticsCollectorTest {
} }
@Test @Test
public void testSeekToOtherPeriod() throws Exception { public void seekToOtherPeriod() throws Exception {
MediaSource mediaSource = MediaSource mediaSource =
new ConcatenatingMediaSource( new ConcatenatingMediaSource(
new FakeMediaSource(SINGLE_PERIOD_TIMELINE, ExoPlayerTestRunner.Builder.VIDEO_FORMAT), new FakeMediaSource(SINGLE_PERIOD_TIMELINE, ExoPlayerTestRunner.Builder.VIDEO_FORMAT),
...@@ -368,7 +368,7 @@ public final class AnalyticsCollectorTest { ...@@ -368,7 +368,7 @@ public final class AnalyticsCollectorTest {
} }
@Test @Test
public void testSeekBackAfterReadingAhead() throws Exception { public void seekBackAfterReadingAhead() throws Exception {
MediaSource mediaSource = MediaSource mediaSource =
new ConcatenatingMediaSource( new ConcatenatingMediaSource(
new FakeMediaSource(SINGLE_PERIOD_TIMELINE, ExoPlayerTestRunner.Builder.VIDEO_FORMAT), new FakeMediaSource(SINGLE_PERIOD_TIMELINE, ExoPlayerTestRunner.Builder.VIDEO_FORMAT),
...@@ -454,7 +454,7 @@ public final class AnalyticsCollectorTest { ...@@ -454,7 +454,7 @@ public final class AnalyticsCollectorTest {
} }
@Test @Test
public void testPrepareNewSource() throws Exception { public void prepareNewSource() throws Exception {
MediaSource mediaSource1 = MediaSource mediaSource1 =
new FakeMediaSource(SINGLE_PERIOD_TIMELINE, ExoPlayerTestRunner.Builder.VIDEO_FORMAT); new FakeMediaSource(SINGLE_PERIOD_TIMELINE, ExoPlayerTestRunner.Builder.VIDEO_FORMAT);
MediaSource mediaSource2 = MediaSource mediaSource2 =
...@@ -532,7 +532,7 @@ public final class AnalyticsCollectorTest { ...@@ -532,7 +532,7 @@ public final class AnalyticsCollectorTest {
} }
@Test @Test
public void testReprepareAfterError() throws Exception { public void reprepareAfterError() throws Exception {
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 =
...@@ -603,7 +603,7 @@ public final class AnalyticsCollectorTest { ...@@ -603,7 +603,7 @@ public final class AnalyticsCollectorTest {
} }
@Test @Test
public void testDynamicTimelineChange() throws Exception { public void dynamicTimelineChange() throws Exception {
MediaSource childMediaSource = MediaSource childMediaSource =
new FakeMediaSource(SINGLE_PERIOD_TIMELINE, ExoPlayerTestRunner.Builder.VIDEO_FORMAT); new FakeMediaSource(SINGLE_PERIOD_TIMELINE, ExoPlayerTestRunner.Builder.VIDEO_FORMAT);
final ConcatenatingMediaSource concatenatedMediaSource = final ConcatenatingMediaSource concatenatedMediaSource =
...@@ -683,7 +683,7 @@ public final class AnalyticsCollectorTest { ...@@ -683,7 +683,7 @@ public final class AnalyticsCollectorTest {
} }
@Test @Test
public void testPlaylistOperations() throws Exception { public void playlistOperations() throws Exception {
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 =
...@@ -755,7 +755,7 @@ public final class AnalyticsCollectorTest { ...@@ -755,7 +755,7 @@ public final class AnalyticsCollectorTest {
} }
@Test @Test
public void testAdPlayback() throws Exception { public void adPlayback() throws Exception {
long contentDurationsUs = 10 * C.MICROS_PER_SECOND; long contentDurationsUs = 10 * C.MICROS_PER_SECOND;
AtomicReference<AdPlaybackState> adPlaybackState = AtomicReference<AdPlaybackState> adPlaybackState =
new AtomicReference<>( new AtomicReference<>(
...@@ -988,7 +988,7 @@ public final class AnalyticsCollectorTest { ...@@ -988,7 +988,7 @@ public final class AnalyticsCollectorTest {
} }
@Test @Test
public void testSeekAfterMidroll() throws Exception { public void seekAfterMidroll() throws Exception {
Timeline adTimeline = Timeline adTimeline =
new FakeTimeline( new FakeTimeline(
new TimelineWindowDefinition( new TimelineWindowDefinition(
...@@ -1107,7 +1107,7 @@ public final class AnalyticsCollectorTest { ...@@ -1107,7 +1107,7 @@ public final class AnalyticsCollectorTest {
} }
@Test @Test
public void testNotifyExternalEvents() 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("AnalyticsCollectorTest")
......
...@@ -49,7 +49,7 @@ public final class SilenceSkippingAudioProcessorTest { ...@@ -49,7 +49,7 @@ public final class SilenceSkippingAudioProcessorTest {
} }
@Test @Test
public void testEnabledProcessor_isActive() throws Exception { public void enabledProcessor_isActive() throws Exception {
// Given an enabled processor. // Given an enabled processor.
silenceSkippingAudioProcessor.setEnabled(true); silenceSkippingAudioProcessor.setEnabled(true);
...@@ -61,7 +61,7 @@ public final class SilenceSkippingAudioProcessorTest { ...@@ -61,7 +61,7 @@ public final class SilenceSkippingAudioProcessorTest {
} }
@Test @Test
public void testDisabledProcessor_isNotActive() throws Exception { public void disabledProcessor_isNotActive() throws Exception {
// Given a disabled processor. // Given a disabled processor.
silenceSkippingAudioProcessor.setEnabled(false); silenceSkippingAudioProcessor.setEnabled(false);
...@@ -73,7 +73,7 @@ public final class SilenceSkippingAudioProcessorTest { ...@@ -73,7 +73,7 @@ public final class SilenceSkippingAudioProcessorTest {
} }
@Test @Test
public void testDefaultProcessor_isNotEnabled() throws Exception { public void defaultProcessor_isNotEnabled() throws Exception {
// Given a processor in its default state. // Given a processor in its default state.
// When reconfigured. // When reconfigured.
silenceSkippingAudioProcessor.configure(AUDIO_FORMAT); silenceSkippingAudioProcessor.configure(AUDIO_FORMAT);
...@@ -83,7 +83,7 @@ public final class SilenceSkippingAudioProcessorTest { ...@@ -83,7 +83,7 @@ public final class SilenceSkippingAudioProcessorTest {
} }
@Test @Test
public void testSkipInSilentSignal_skipsEverything() throws Exception { public void skipInSilentSignal_skipsEverything() throws Exception {
// Given a signal with only noise. // Given a signal with only noise.
InputBufferProvider inputBufferProvider = InputBufferProvider inputBufferProvider =
getInputBufferProviderForAlternatingSilenceAndNoise( getInputBufferProviderForAlternatingSilenceAndNoise(
...@@ -105,7 +105,7 @@ public final class SilenceSkippingAudioProcessorTest { ...@@ -105,7 +105,7 @@ public final class SilenceSkippingAudioProcessorTest {
} }
@Test @Test
public void testSkipInNoisySignal_skipsNothing() throws Exception { public void skipInNoisySignal_skipsNothing() throws Exception {
// Given a signal with only silence. // Given a signal with only silence.
InputBufferProvider inputBufferProvider = InputBufferProvider inputBufferProvider =
getInputBufferProviderForAlternatingSilenceAndNoise( getInputBufferProviderForAlternatingSilenceAndNoise(
...@@ -129,8 +129,7 @@ public final class SilenceSkippingAudioProcessorTest { ...@@ -129,8 +129,7 @@ public final class SilenceSkippingAudioProcessorTest {
} }
@Test @Test
public void testSkipInAlternatingTestSignal_hasCorrectOutputAndSkippedFrameCounts() public void skipInAlternatingTestSignal_hasCorrectOutputAndSkippedFrameCounts() throws Exception {
throws Exception {
// Given a signal that alternates between silence and noise. // Given a signal that alternates between silence and noise.
InputBufferProvider inputBufferProvider = InputBufferProvider inputBufferProvider =
getInputBufferProviderForAlternatingSilenceAndNoise( getInputBufferProviderForAlternatingSilenceAndNoise(
...@@ -154,7 +153,7 @@ public final class SilenceSkippingAudioProcessorTest { ...@@ -154,7 +153,7 @@ public final class SilenceSkippingAudioProcessorTest {
} }
@Test @Test
public void testSkipWithSmallerInputBufferSize_hasCorrectOutputAndSkippedFrameCounts() public void skipWithSmallerInputBufferSize_hasCorrectOutputAndSkippedFrameCounts()
throws Exception { throws Exception {
// Given a signal that alternates between silence and noise. // Given a signal that alternates between silence and noise.
InputBufferProvider inputBufferProvider = InputBufferProvider inputBufferProvider =
...@@ -179,7 +178,7 @@ public final class SilenceSkippingAudioProcessorTest { ...@@ -179,7 +178,7 @@ public final class SilenceSkippingAudioProcessorTest {
} }
@Test @Test
public void testSkipWithLargerInputBufferSize_hasCorrectOutputAndSkippedFrameCounts() public void skipWithLargerInputBufferSize_hasCorrectOutputAndSkippedFrameCounts()
throws Exception { throws Exception {
// Given a signal that alternates between silence and noise. // Given a signal that alternates between silence and noise.
InputBufferProvider inputBufferProvider = InputBufferProvider inputBufferProvider =
...@@ -204,7 +203,7 @@ public final class SilenceSkippingAudioProcessorTest { ...@@ -204,7 +203,7 @@ public final class SilenceSkippingAudioProcessorTest {
} }
@Test @Test
public void testSkipThenFlush_resetsSkippedFrameCount() throws Exception { public void skipThenFlush_resetsSkippedFrameCount() throws Exception {
// Given a signal that alternates between silence and noise. // Given a signal that alternates between silence and noise.
InputBufferProvider inputBufferProvider = InputBufferProvider inputBufferProvider =
getInputBufferProviderForAlternatingSilenceAndNoise( getInputBufferProviderForAlternatingSilenceAndNoise(
......
...@@ -78,21 +78,21 @@ public class SimpleDecoderAudioRendererTest { ...@@ -78,21 +78,21 @@ public class SimpleDecoderAudioRendererTest {
@Config(sdk = 19) @Config(sdk = 19)
@Test @Test
public void testSupportsFormatAtApi19() { public void supportsFormatAtApi19() {
assertThat(audioRenderer.supportsFormat(FORMAT)) assertThat(audioRenderer.supportsFormat(FORMAT))
.isEqualTo(ADAPTIVE_NOT_SEAMLESS | TUNNELING_NOT_SUPPORTED | FORMAT_HANDLED); .isEqualTo(ADAPTIVE_NOT_SEAMLESS | TUNNELING_NOT_SUPPORTED | FORMAT_HANDLED);
} }
@Config(sdk = 21) @Config(sdk = 21)
@Test @Test
public void testSupportsFormatAtApi21() { public void supportsFormatAtApi21() {
// From API 21, tunneling is supported. // From API 21, tunneling is supported.
assertThat(audioRenderer.supportsFormat(FORMAT)) assertThat(audioRenderer.supportsFormat(FORMAT))
.isEqualTo(ADAPTIVE_NOT_SEAMLESS | TUNNELING_SUPPORTED | FORMAT_HANDLED); .isEqualTo(ADAPTIVE_NOT_SEAMLESS | TUNNELING_SUPPORTED | FORMAT_HANDLED);
} }
@Test @Test
public void testImmediatelyReadEndOfStreamPlaysAudioSinkToEndOfStream() throws Exception { public void immediatelyReadEndOfStreamPlaysAudioSinkToEndOfStream() throws Exception {
audioRenderer.enable( audioRenderer.enable(
RendererConfiguration.DEFAULT, RendererConfiguration.DEFAULT,
new Format[] {FORMAT}, new Format[] {FORMAT},
......
...@@ -48,7 +48,7 @@ public final class SonicAudioProcessorTest { ...@@ -48,7 +48,7 @@ public final class SonicAudioProcessorTest {
} }
@Test @Test
public void testReconfigureWithSameSampleRate() throws Exception { public void reconfigureWithSameSampleRate() throws Exception {
// When configured for resampling from 44.1 kHz to 48 kHz, the output sample rate is correct. // When configured for resampling from 44.1 kHz to 48 kHz, the output sample rate is correct.
sonicAudioProcessor.setOutputSampleRateHz(48000); sonicAudioProcessor.setOutputSampleRateHz(48000);
AudioFormat outputAudioFormat = sonicAudioProcessor.configure(AUDIO_FORMAT_44100_HZ); AudioFormat outputAudioFormat = sonicAudioProcessor.configure(AUDIO_FORMAT_44100_HZ);
...@@ -65,7 +65,7 @@ public final class SonicAudioProcessorTest { ...@@ -65,7 +65,7 @@ public final class SonicAudioProcessorTest {
} }
@Test @Test
public void testNoSampleRateChange() throws Exception { public void noSampleRateChange() throws Exception {
// Configure for resampling 44.1 kHz to 48 kHz. // Configure for resampling 44.1 kHz to 48 kHz.
sonicAudioProcessor.setOutputSampleRateHz(48000); sonicAudioProcessor.setOutputSampleRateHz(48000);
sonicAudioProcessor.configure(AUDIO_FORMAT_44100_HZ); sonicAudioProcessor.configure(AUDIO_FORMAT_44100_HZ);
...@@ -78,7 +78,7 @@ public final class SonicAudioProcessorTest { ...@@ -78,7 +78,7 @@ public final class SonicAudioProcessorTest {
} }
@Test @Test
public void testIsActiveWithSpeedChange() throws Exception { public void isActiveWithSpeedChange() throws Exception {
sonicAudioProcessor.setSpeed(1.5f); sonicAudioProcessor.setSpeed(1.5f);
sonicAudioProcessor.configure(AUDIO_FORMAT_44100_HZ); sonicAudioProcessor.configure(AUDIO_FORMAT_44100_HZ);
sonicAudioProcessor.flush(); sonicAudioProcessor.flush();
...@@ -86,13 +86,13 @@ public final class SonicAudioProcessorTest { ...@@ -86,13 +86,13 @@ public final class SonicAudioProcessorTest {
} }
@Test @Test
public void testIsNotActiveWithNoChange() throws Exception { public void isNotActiveWithNoChange() throws Exception {
sonicAudioProcessor.configure(AUDIO_FORMAT_44100_HZ); sonicAudioProcessor.configure(AUDIO_FORMAT_44100_HZ);
assertThat(sonicAudioProcessor.isActive()).isFalse(); assertThat(sonicAudioProcessor.isActive()).isFalse();
} }
@Test @Test
public void testDoesNotSupportNon16BitInput() throws Exception { public void doesNotSupportNon16BitInput() throws Exception {
try { try {
sonicAudioProcessor.configure( sonicAudioProcessor.configure(
new AudioFormat( new AudioFormat(
......
...@@ -69,7 +69,7 @@ public final class ClearKeyUtilTest { ...@@ -69,7 +69,7 @@ public final class ClearKeyUtilTest {
@Config(sdk = 26) @Config(sdk = 26)
@Test @Test
public void testAdjustSingleKeyResponseDataV26() { public void adjustSingleKeyResponseDataV26() {
// Everything but the keys should be removed. Within each key only the k, kid and kty parameters // Everything but the keys should be removed. Within each key only the k, kid and kty parameters
// should remain. Any "-" and "_" characters in the k and kid values should be replaced with "+" // should remain. Any "-" and "_" characters in the k and kid values should be replaced with "+"
// and "/". // and "/".
...@@ -87,7 +87,7 @@ public final class ClearKeyUtilTest { ...@@ -87,7 +87,7 @@ public final class ClearKeyUtilTest {
@Config(sdk = 26) @Config(sdk = 26)
@Test @Test
public void testAdjustMultiKeyResponseDataV26() { public void adjustMultiKeyResponseDataV26() {
// Everything but the keys should be removed. Within each key only the k, kid and kty parameters // Everything but the keys should be removed. Within each key only the k, kid and kty parameters
// should remain. Any "-" and "_" characters in the k and kid values should be replaced with "+" // should remain. Any "-" and "_" characters in the k and kid values should be replaced with "+"
// and "/". // and "/".
...@@ -107,14 +107,14 @@ public final class ClearKeyUtilTest { ...@@ -107,14 +107,14 @@ public final class ClearKeyUtilTest {
@Config(sdk = 27) @Config(sdk = 27)
@Test @Test
public void testAdjustResponseDataV27() { public void adjustResponseDataV27() {
// Response should be unchanged. // Response should be unchanged.
assertThat(ClearKeyUtil.adjustResponseData(SINGLE_KEY_RESPONSE)).isEqualTo(SINGLE_KEY_RESPONSE); assertThat(ClearKeyUtil.adjustResponseData(SINGLE_KEY_RESPONSE)).isEqualTo(SINGLE_KEY_RESPONSE);
} }
@Config(sdk = 26) @Config(sdk = 26)
@Test @Test
public void testAdjustRequestDataV26() { public void adjustRequestDataV26() {
// We expect "+" and "/" to be replaced with "-" and "_" respectively, for "kids". // We expect "+" and "/" to be replaced with "-" and "_" respectively, for "kids".
byte[] expected = byte[] expected =
Util.getUtf8Bytes( Util.getUtf8Bytes(
...@@ -130,7 +130,7 @@ public final class ClearKeyUtilTest { ...@@ -130,7 +130,7 @@ public final class ClearKeyUtilTest {
@Config(sdk = 27) @Config(sdk = 27)
@Test @Test
public void testAdjustRequestDataV27() { public void adjustRequestDataV27() {
// Request should be unchanged. // Request should be unchanged.
assertThat(ClearKeyUtil.adjustRequestData(KEY_REQUEST)).isEqualTo(KEY_REQUEST); assertThat(ClearKeyUtil.adjustRequestData(KEY_REQUEST)).isEqualTo(KEY_REQUEST);
} }
......
...@@ -65,7 +65,7 @@ public class OfflineLicenseHelperTest { ...@@ -65,7 +65,7 @@ public class OfflineLicenseHelperTest {
} }
@Test @Test
public void testDownloadRenewReleaseKey() throws Exception { public void downloadRenewReleaseKey() throws Exception {
setStubLicenseAndPlaybackDurationValues(1000, 200); setStubLicenseAndPlaybackDurationValues(1000, 200);
byte[] keySetId = {2, 5, 8}; byte[] keySetId = {2, 5, 8};
...@@ -86,7 +86,7 @@ public class OfflineLicenseHelperTest { ...@@ -86,7 +86,7 @@ public class OfflineLicenseHelperTest {
} }
@Test @Test
public void testDownloadLicenseFailsIfNullInitData() throws Exception { public void downloadLicenseFailsIfNullInitData() throws Exception {
try { try {
offlineLicenseHelper.downloadLicense(null); offlineLicenseHelper.downloadLicense(null);
fail(); fail();
...@@ -96,7 +96,7 @@ public class OfflineLicenseHelperTest { ...@@ -96,7 +96,7 @@ public class OfflineLicenseHelperTest {
} }
@Test @Test
public void testDownloadLicenseFailsIfNoKeySetIdIsReturned() throws Exception { public void downloadLicenseFailsIfNoKeySetIdIsReturned() throws Exception {
setStubLicenseAndPlaybackDurationValues(1000, 200); setStubLicenseAndPlaybackDurationValues(1000, 200);
try { try {
...@@ -108,7 +108,7 @@ public class OfflineLicenseHelperTest { ...@@ -108,7 +108,7 @@ public class OfflineLicenseHelperTest {
} }
@Test @Test
public void testDownloadLicenseDoesNotFailIfDurationNotAvailable() throws Exception { public void downloadLicenseDoesNotFailIfDurationNotAvailable() throws Exception {
setDefaultStubKeySetId(); setDefaultStubKeySetId();
byte[] offlineLicenseKeySetId = offlineLicenseHelper.downloadLicense(newDrmInitData()); byte[] offlineLicenseKeySetId = offlineLicenseHelper.downloadLicense(newDrmInitData());
...@@ -117,7 +117,7 @@ public class OfflineLicenseHelperTest { ...@@ -117,7 +117,7 @@ public class OfflineLicenseHelperTest {
} }
@Test @Test
public void testGetLicenseDurationRemainingSec() throws Exception { public void getLicenseDurationRemainingSec() throws Exception {
long licenseDuration = 1000; long licenseDuration = 1000;
int playbackDuration = 200; int playbackDuration = 200;
setStubLicenseAndPlaybackDurationValues(licenseDuration, playbackDuration); setStubLicenseAndPlaybackDurationValues(licenseDuration, playbackDuration);
...@@ -133,7 +133,7 @@ public class OfflineLicenseHelperTest { ...@@ -133,7 +133,7 @@ public class OfflineLicenseHelperTest {
} }
@Test @Test
public void testGetLicenseDurationRemainingSecExpiredLicense() throws Exception { public void getLicenseDurationRemainingSecExpiredLicense() throws Exception {
long licenseDuration = 0; long licenseDuration = 0;
int playbackDuration = 0; int playbackDuration = 0;
setStubLicenseAndPlaybackDurationValues(licenseDuration, playbackDuration); setStubLicenseAndPlaybackDurationValues(licenseDuration, playbackDuration);
......
...@@ -42,7 +42,7 @@ public final class SpliceInfoDecoderTest { ...@@ -42,7 +42,7 @@ public final class SpliceInfoDecoderTest {
} }
@Test @Test
public void testWrappedAroundTimeSignalCommand() { public void wrappedAroundTimeSignalCommand() {
byte[] rawTimeSignalSection = new byte[] { byte[] rawTimeSignalSection = new byte[] {
0, // table_id. 0, // table_id.
(byte) 0x80, // section_syntax_indicator, private_indicator, reserved, section_length(4). (byte) 0x80, // section_syntax_indicator, private_indicator, reserved, section_length(4).
......
...@@ -56,7 +56,7 @@ public class ActionFileTest { ...@@ -56,7 +56,7 @@ public class ActionFileTest {
} }
@Test @Test
public void testLoadNoDataThrowsIOException() throws Exception { public void loadNoDataThrowsIOException() throws Exception {
ActionFile actionFile = getActionFile("offline/action_file_no_data.exi"); ActionFile actionFile = getActionFile("offline/action_file_no_data.exi");
try { try {
actionFile.load(); actionFile.load();
...@@ -67,7 +67,7 @@ public class ActionFileTest { ...@@ -67,7 +67,7 @@ public class ActionFileTest {
} }
@Test @Test
public void testLoadIncompleteHeaderThrowsIOException() throws Exception { public void loadIncompleteHeaderThrowsIOException() throws Exception {
ActionFile actionFile = getActionFile("offline/action_file_incomplete_header.exi"); ActionFile actionFile = getActionFile("offline/action_file_incomplete_header.exi");
try { try {
actionFile.load(); actionFile.load();
...@@ -78,7 +78,7 @@ public class ActionFileTest { ...@@ -78,7 +78,7 @@ public class ActionFileTest {
} }
@Test @Test
public void testLoadZeroActions() throws Exception { public void loadZeroActions() throws Exception {
ActionFile actionFile = getActionFile("offline/action_file_zero_actions.exi"); ActionFile actionFile = getActionFile("offline/action_file_zero_actions.exi");
DownloadRequest[] actions = actionFile.load(); DownloadRequest[] actions = actionFile.load();
assertThat(actions).isNotNull(); assertThat(actions).isNotNull();
...@@ -86,7 +86,7 @@ public class ActionFileTest { ...@@ -86,7 +86,7 @@ public class ActionFileTest {
} }
@Test @Test
public void testLoadOneAction() throws Exception { public void loadOneAction() throws Exception {
ActionFile actionFile = getActionFile("offline/action_file_one_action.exi"); ActionFile actionFile = getActionFile("offline/action_file_one_action.exi");
DownloadRequest[] actions = actionFile.load(); DownloadRequest[] actions = actionFile.load();
assertThat(actions).hasLength(1); assertThat(actions).hasLength(1);
...@@ -94,7 +94,7 @@ public class ActionFileTest { ...@@ -94,7 +94,7 @@ public class ActionFileTest {
} }
@Test @Test
public void testLoadTwoActions() throws Exception { public void loadTwoActions() throws Exception {
ActionFile actionFile = getActionFile("offline/action_file_two_actions.exi"); ActionFile actionFile = getActionFile("offline/action_file_two_actions.exi");
DownloadRequest[] actions = actionFile.load(); DownloadRequest[] actions = actionFile.load();
assertThat(actions).hasLength(2); assertThat(actions).hasLength(2);
...@@ -103,7 +103,7 @@ public class ActionFileTest { ...@@ -103,7 +103,7 @@ public class ActionFileTest {
} }
@Test @Test
public void testLoadUnsupportedVersion() throws Exception { public void loadUnsupportedVersion() throws Exception {
ActionFile actionFile = getActionFile("offline/action_file_unsupported_version.exi"); ActionFile actionFile = getActionFile("offline/action_file_unsupported_version.exi");
try { try {
actionFile.load(); actionFile.load();
......
...@@ -45,7 +45,7 @@ public class DownloadRequestTest { ...@@ -45,7 +45,7 @@ public class DownloadRequestTest {
} }
@Test @Test
public void testMergeRequests_withDifferentIds_fails() { public void mergeRequests_withDifferentIds_fails() {
DownloadRequest request1 = DownloadRequest request1 =
new DownloadRequest( new DownloadRequest(
"id1", "id1",
...@@ -71,7 +71,7 @@ public class DownloadRequestTest { ...@@ -71,7 +71,7 @@ public class DownloadRequestTest {
} }
@Test @Test
public void testMergeRequests_withDifferentTypes_fails() { public void mergeRequests_withDifferentTypes_fails() {
DownloadRequest request1 = DownloadRequest request1 =
new DownloadRequest( new DownloadRequest(
"id1", "id1",
...@@ -97,7 +97,7 @@ public class DownloadRequestTest { ...@@ -97,7 +97,7 @@ public class DownloadRequestTest {
} }
@Test @Test
public void testMergeRequest_withSameRequest() { public void mergeRequest_withSameRequest() {
DownloadRequest request1 = createRequest(uri1, new StreamKey(0, 0, 0)); DownloadRequest request1 = createRequest(uri1, new StreamKey(0, 0, 0));
DownloadRequest mergedRequest = request1.copyWithMergedRequest(request1); DownloadRequest mergedRequest = request1.copyWithMergedRequest(request1);
...@@ -105,7 +105,7 @@ public class DownloadRequestTest { ...@@ -105,7 +105,7 @@ public class DownloadRequestTest {
} }
@Test @Test
public void testMergeRequests_withEmptyStreamKeys() { public void mergeRequests_withEmptyStreamKeys() {
DownloadRequest request1 = createRequest(uri1, new StreamKey(0, 0, 0)); DownloadRequest request1 = createRequest(uri1, new StreamKey(0, 0, 0));
DownloadRequest request2 = createRequest(uri1); DownloadRequest request2 = createRequest(uri1);
...@@ -118,7 +118,7 @@ public class DownloadRequestTest { ...@@ -118,7 +118,7 @@ public class DownloadRequestTest {
} }
@Test @Test
public void testMergeRequests_withOverlappingStreamKeys() { public void mergeRequests_withOverlappingStreamKeys() {
StreamKey streamKey1 = new StreamKey(0, 1, 2); StreamKey streamKey1 = new StreamKey(0, 1, 2);
StreamKey streamKey2 = new StreamKey(3, 4, 5); StreamKey streamKey2 = new StreamKey(3, 4, 5);
StreamKey streamKey3 = new StreamKey(6, 7, 8); StreamKey streamKey3 = new StreamKey(6, 7, 8);
...@@ -134,7 +134,7 @@ public class DownloadRequestTest { ...@@ -134,7 +134,7 @@ public class DownloadRequestTest {
} }
@Test @Test
public void testMergeRequests_withDifferentFields() { public void mergeRequests_withDifferentFields() {
byte[] data1 = new byte[] {0, 1, 2}; byte[] data1 = new byte[] {0, 1, 2};
byte[] data2 = new byte[] {3, 4, 5}; byte[] data2 = new byte[] {3, 4, 5};
DownloadRequest request1 = DownloadRequest request1 =
...@@ -167,7 +167,7 @@ public class DownloadRequestTest { ...@@ -167,7 +167,7 @@ public class DownloadRequestTest {
} }
@Test @Test
public void testParcelable() { public void parcelable() {
ArrayList<StreamKey> streamKeys = new ArrayList<>(); ArrayList<StreamKey> streamKeys = new ArrayList<>();
streamKeys.add(new StreamKey(1, 2, 3)); streamKeys.add(new StreamKey(1, 2, 3));
streamKeys.add(new StreamKey(4, 5, 6)); streamKeys.add(new StreamKey(4, 5, 6));
...@@ -191,7 +191,7 @@ public class DownloadRequestTest { ...@@ -191,7 +191,7 @@ public class DownloadRequestTest {
@SuppressWarnings("EqualsWithItself") @SuppressWarnings("EqualsWithItself")
@Test @Test
public void testEquals() { public void equals() {
DownloadRequest request1 = createRequest(uri1); DownloadRequest request1 = createRequest(uri1);
assertThat(request1.equals(request1)).isTrue(); assertThat(request1.equals(request1)).isTrue();
......
...@@ -27,7 +27,7 @@ import org.junit.runner.RunWith; ...@@ -27,7 +27,7 @@ import org.junit.runner.RunWith;
public class StreamKeyTest { public class StreamKeyTest {
@Test @Test
public void testParcelable() { public void parcelable() {
StreamKey streamKeyToParcel = new StreamKey(1, 2, 3); StreamKey streamKeyToParcel = new StreamKey(1, 2, 3);
Parcel parcel = Parcel.obtain(); Parcel parcel = Parcel.obtain();
streamKeyToParcel.writeToParcel(parcel, 0); streamKeyToParcel.writeToParcel(parcel, 0);
......
...@@ -62,7 +62,7 @@ public final class ClippingMediaSourceTest { ...@@ -62,7 +62,7 @@ public final class ClippingMediaSourceTest {
} }
@Test @Test
public void testNoClipping() throws IOException { public void noClipping() throws IOException {
Timeline timeline = Timeline timeline =
new SinglePeriodTimeline( new SinglePeriodTimeline(
TEST_PERIOD_DURATION_US, TEST_PERIOD_DURATION_US,
...@@ -81,7 +81,7 @@ public final class ClippingMediaSourceTest { ...@@ -81,7 +81,7 @@ public final class ClippingMediaSourceTest {
} }
@Test @Test
public void testClippingUnseekableWindowThrows() throws IOException { public void clippingUnseekableWindowThrows() throws IOException {
Timeline timeline = Timeline timeline =
new SinglePeriodTimeline( new SinglePeriodTimeline(
TEST_PERIOD_DURATION_US, TEST_PERIOD_DURATION_US,
...@@ -101,7 +101,7 @@ public final class ClippingMediaSourceTest { ...@@ -101,7 +101,7 @@ public final class ClippingMediaSourceTest {
} }
@Test @Test
public void testClippingStart() throws IOException { public void clippingStart() throws IOException {
Timeline timeline = Timeline timeline =
new SinglePeriodTimeline( new SinglePeriodTimeline(
TEST_PERIOD_DURATION_US, TEST_PERIOD_DURATION_US,
...@@ -118,7 +118,7 @@ public final class ClippingMediaSourceTest { ...@@ -118,7 +118,7 @@ public final class ClippingMediaSourceTest {
} }
@Test @Test
public void testClippingEnd() throws IOException { public void clippingEnd() throws IOException {
Timeline timeline = Timeline timeline =
new SinglePeriodTimeline( new SinglePeriodTimeline(
TEST_PERIOD_DURATION_US, TEST_PERIOD_DURATION_US,
...@@ -135,7 +135,7 @@ public final class ClippingMediaSourceTest { ...@@ -135,7 +135,7 @@ public final class ClippingMediaSourceTest {
} }
@Test @Test
public void testClippingStartAndEndInitial() throws IOException { public void clippingStartAndEndInitial() throws IOException {
// Timeline that's dynamic and not seekable. A child source might report such a timeline prior // Timeline that's dynamic and not seekable. A child source might report such a timeline prior
// to it having loaded sufficient data to establish its duration and seekability. Such timelines // to it having loaded sufficient data to establish its duration and seekability. Such timelines
// should not result in clipping failure. // should not result in clipping failure.
...@@ -153,7 +153,7 @@ public final class ClippingMediaSourceTest { ...@@ -153,7 +153,7 @@ public final class ClippingMediaSourceTest {
} }
@Test @Test
public void testClippingToEndOfSourceWithDurationSetsDuration() throws IOException { public void clippingToEndOfSourceWithDurationSetsDuration() throws IOException {
// Create a child timeline that has a known duration. // Create a child timeline that has a known duration.
Timeline timeline = Timeline timeline =
new SinglePeriodTimeline( new SinglePeriodTimeline(
...@@ -170,7 +170,7 @@ public final class ClippingMediaSourceTest { ...@@ -170,7 +170,7 @@ public final class ClippingMediaSourceTest {
} }
@Test @Test
public void testClippingToEndOfSourceWithUnsetDurationDoesNotSetDuration() throws IOException { public void clippingToEndOfSourceWithUnsetDurationDoesNotSetDuration() throws IOException {
// Create a child timeline that has an unknown duration. // Create a child timeline that has an unknown duration.
Timeline timeline = Timeline timeline =
new SinglePeriodTimeline( new SinglePeriodTimeline(
...@@ -187,7 +187,7 @@ public final class ClippingMediaSourceTest { ...@@ -187,7 +187,7 @@ public final class ClippingMediaSourceTest {
} }
@Test @Test
public void testClippingStartAndEnd() throws IOException { public void clippingStartAndEnd() throws IOException {
Timeline timeline = Timeline timeline =
new SinglePeriodTimeline( new SinglePeriodTimeline(
TEST_PERIOD_DURATION_US, TEST_PERIOD_DURATION_US,
...@@ -205,7 +205,7 @@ public final class ClippingMediaSourceTest { ...@@ -205,7 +205,7 @@ public final class ClippingMediaSourceTest {
} }
@Test @Test
public void testClippingFromDefaultPosition() throws IOException { public void clippingFromDefaultPosition() throws IOException {
Timeline timeline = Timeline timeline =
new SinglePeriodTimeline( new SinglePeriodTimeline(
/* periodDurationUs= */ 3 * TEST_PERIOD_DURATION_US, /* periodDurationUs= */ 3 * TEST_PERIOD_DURATION_US,
...@@ -228,7 +228,7 @@ public final class ClippingMediaSourceTest { ...@@ -228,7 +228,7 @@ public final class ClippingMediaSourceTest {
} }
@Test @Test
public void testAllowDynamicUpdatesWithOverlappingLiveWindow() throws IOException { public void allowDynamicUpdatesWithOverlappingLiveWindow() throws IOException {
Timeline timeline1 = Timeline timeline1 =
new SinglePeriodTimeline( new SinglePeriodTimeline(
/* periodDurationUs= */ 2 * TEST_PERIOD_DURATION_US, /* periodDurationUs= */ 2 * TEST_PERIOD_DURATION_US,
...@@ -279,7 +279,7 @@ public final class ClippingMediaSourceTest { ...@@ -279,7 +279,7 @@ public final class ClippingMediaSourceTest {
} }
@Test @Test
public void testAllowDynamicUpdatesWithNonOverlappingLiveWindow() throws IOException { public void allowDynamicUpdatesWithNonOverlappingLiveWindow() throws IOException {
Timeline timeline1 = Timeline timeline1 =
new SinglePeriodTimeline( new SinglePeriodTimeline(
/* periodDurationUs= */ 2 * TEST_PERIOD_DURATION_US, /* periodDurationUs= */ 2 * TEST_PERIOD_DURATION_US,
...@@ -330,7 +330,7 @@ public final class ClippingMediaSourceTest { ...@@ -330,7 +330,7 @@ public final class ClippingMediaSourceTest {
} }
@Test @Test
public void testDisallowDynamicUpdatesWithOverlappingLiveWindow() throws IOException { public void disallowDynamicUpdatesWithOverlappingLiveWindow() throws IOException {
Timeline timeline1 = Timeline timeline1 =
new SinglePeriodTimeline( new SinglePeriodTimeline(
/* periodDurationUs= */ 2 * TEST_PERIOD_DURATION_US, /* periodDurationUs= */ 2 * TEST_PERIOD_DURATION_US,
...@@ -382,7 +382,7 @@ public final class ClippingMediaSourceTest { ...@@ -382,7 +382,7 @@ public final class ClippingMediaSourceTest {
} }
@Test @Test
public void testDisallowDynamicUpdatesWithNonOverlappingLiveWindow() throws IOException { public void disallowDynamicUpdatesWithNonOverlappingLiveWindow() throws IOException {
Timeline timeline1 = Timeline timeline1 =
new SinglePeriodTimeline( new SinglePeriodTimeline(
/* periodDurationUs= */ 2 * TEST_PERIOD_DURATION_US, /* periodDurationUs= */ 2 * TEST_PERIOD_DURATION_US,
...@@ -432,7 +432,7 @@ public final class ClippingMediaSourceTest { ...@@ -432,7 +432,7 @@ public final class ClippingMediaSourceTest {
} }
@Test @Test
public void testWindowAndPeriodIndices() throws IOException { public void windowAndPeriodIndices() throws IOException {
Timeline timeline = Timeline timeline =
new FakeTimeline( new FakeTimeline(
new TimelineWindowDefinition(1, 111, true, false, TEST_PERIOD_DURATION_US)); new TimelineWindowDefinition(1, 111, true, false, TEST_PERIOD_DURATION_US));
...@@ -452,7 +452,7 @@ public final class ClippingMediaSourceTest { ...@@ -452,7 +452,7 @@ public final class ClippingMediaSourceTest {
} }
@Test @Test
public void testEventTimeWithinClippedRange() throws IOException { public void eventTimeWithinClippedRange() throws IOException {
MediaLoadData mediaLoadData = MediaLoadData mediaLoadData =
getClippingMediaSourceMediaLoadData( getClippingMediaSourceMediaLoadData(
/* clippingStartUs= */ TEST_CLIP_AMOUNT_US, /* clippingStartUs= */ TEST_CLIP_AMOUNT_US,
...@@ -465,7 +465,7 @@ public final class ClippingMediaSourceTest { ...@@ -465,7 +465,7 @@ public final class ClippingMediaSourceTest {
} }
@Test @Test
public void testEventTimeOutsideClippedRange() throws IOException { public void eventTimeOutsideClippedRange() throws IOException {
MediaLoadData mediaLoadData = MediaLoadData mediaLoadData =
getClippingMediaSourceMediaLoadData( getClippingMediaSourceMediaLoadData(
/* clippingStartUs= */ TEST_CLIP_AMOUNT_US, /* clippingStartUs= */ TEST_CLIP_AMOUNT_US,
...@@ -478,7 +478,7 @@ public final class ClippingMediaSourceTest { ...@@ -478,7 +478,7 @@ public final class ClippingMediaSourceTest {
} }
@Test @Test
public void testUnsetEventTime() throws IOException { public void unsetEventTime() throws IOException {
MediaLoadData mediaLoadData = MediaLoadData mediaLoadData =
getClippingMediaSourceMediaLoadData( getClippingMediaSourceMediaLoadData(
/* clippingStartUs= */ TEST_CLIP_AMOUNT_US, /* clippingStartUs= */ TEST_CLIP_AMOUNT_US,
...@@ -490,7 +490,7 @@ public final class ClippingMediaSourceTest { ...@@ -490,7 +490,7 @@ public final class ClippingMediaSourceTest {
} }
@Test @Test
public void testEventTimeWithUnsetDuration() throws IOException { public void eventTimeWithUnsetDuration() throws IOException {
MediaLoadData mediaLoadData = MediaLoadData mediaLoadData =
getClippingMediaSourceMediaLoadData( getClippingMediaSourceMediaLoadData(
/* clippingStartUs= */ TEST_CLIP_AMOUNT_US, /* clippingStartUs= */ TEST_CLIP_AMOUNT_US,
......
...@@ -31,7 +31,7 @@ public final class CompositeSequenceableLoaderTest { ...@@ -31,7 +31,7 @@ public final class CompositeSequenceableLoaderTest {
* position among all sub-loaders. * position among all sub-loaders.
*/ */
@Test @Test
public void testGetBufferedPositionUsReturnsMinimumLoaderBufferedPosition() { public void getBufferedPositionUsReturnsMinimumLoaderBufferedPosition() {
FakeSequenceableLoader loader1 = FakeSequenceableLoader loader1 =
new FakeSequenceableLoader(/* bufferedPositionUs */ 1000, /* nextLoadPositionUs */ 2000); new FakeSequenceableLoader(/* bufferedPositionUs */ 1000, /* nextLoadPositionUs */ 2000);
FakeSequenceableLoader loader2 = FakeSequenceableLoader loader2 =
...@@ -46,7 +46,7 @@ public final class CompositeSequenceableLoaderTest { ...@@ -46,7 +46,7 @@ public final class CompositeSequenceableLoaderTest {
* position that is not {@link C#TIME_END_OF_SOURCE} among all sub-loaders. * position that is not {@link C#TIME_END_OF_SOURCE} among all sub-loaders.
*/ */
@Test @Test
public void testGetBufferedPositionUsReturnsMinimumNonEndOfSourceLoaderBufferedPosition() { public void getBufferedPositionUsReturnsMinimumNonEndOfSourceLoaderBufferedPosition() {
FakeSequenceableLoader loader1 = FakeSequenceableLoader loader1 =
new FakeSequenceableLoader(/* bufferedPositionUs */ 1000, /* nextLoadPositionUs */ 2000); new FakeSequenceableLoader(/* bufferedPositionUs */ 1000, /* nextLoadPositionUs */ 2000);
FakeSequenceableLoader loader2 = FakeSequenceableLoader loader2 =
...@@ -61,11 +61,11 @@ public final class CompositeSequenceableLoaderTest { ...@@ -61,11 +61,11 @@ public final class CompositeSequenceableLoaderTest {
} }
/** /**
* Tests that {@link CompositeSequenceableLoader#getBufferedPositionUs()} returns * Tests that {@link CompositeSequenceableLoader#getBufferedPositionUs()} returns {@link
* {@link C#TIME_END_OF_SOURCE} when all sub-loaders have buffered till end-of-source. * C#TIME_END_OF_SOURCE} when all sub-loaders have buffered till end-of-source.
*/ */
@Test @Test
public void testGetBufferedPositionUsReturnsEndOfSourceWhenAllLoaderBufferedTillEndOfSource() { public void getBufferedPositionUsReturnsEndOfSourceWhenAllLoaderBufferedTillEndOfSource() {
FakeSequenceableLoader loader1 = FakeSequenceableLoader loader1 =
new FakeSequenceableLoader( new FakeSequenceableLoader(
/* bufferedPositionUs */ C.TIME_END_OF_SOURCE, /* bufferedPositionUs */ C.TIME_END_OF_SOURCE,
...@@ -84,7 +84,7 @@ public final class CompositeSequenceableLoaderTest { ...@@ -84,7 +84,7 @@ public final class CompositeSequenceableLoaderTest {
* load position among all sub-loaders. * load position among all sub-loaders.
*/ */
@Test @Test
public void testGetNextLoadPositionUsReturnMinimumLoaderNextLoadPositionUs() { public void getNextLoadPositionUsReturnMinimumLoaderNextLoadPositionUs() {
FakeSequenceableLoader loader1 = FakeSequenceableLoader loader1 =
new FakeSequenceableLoader(/* bufferedPositionUs */ 1000, /* nextLoadPositionUs */ 2001); new FakeSequenceableLoader(/* bufferedPositionUs */ 1000, /* nextLoadPositionUs */ 2001);
FakeSequenceableLoader loader2 = FakeSequenceableLoader loader2 =
...@@ -99,7 +99,7 @@ public final class CompositeSequenceableLoaderTest { ...@@ -99,7 +99,7 @@ public final class CompositeSequenceableLoaderTest {
* load position that is not {@link C#TIME_END_OF_SOURCE} among all sub-loaders. * load position that is not {@link C#TIME_END_OF_SOURCE} among all sub-loaders.
*/ */
@Test @Test
public void testGetNextLoadPositionUsReturnMinimumNonEndOfSourceLoaderNextLoadPositionUs() { public void getNextLoadPositionUsReturnMinimumNonEndOfSourceLoaderNextLoadPositionUs() {
FakeSequenceableLoader loader1 = FakeSequenceableLoader loader1 =
new FakeSequenceableLoader(/* bufferedPositionUs */ 1000, /* nextLoadPositionUs */ 2000); new FakeSequenceableLoader(/* bufferedPositionUs */ 1000, /* nextLoadPositionUs */ 2000);
FakeSequenceableLoader loader2 = FakeSequenceableLoader loader2 =
...@@ -113,11 +113,11 @@ public final class CompositeSequenceableLoaderTest { ...@@ -113,11 +113,11 @@ public final class CompositeSequenceableLoaderTest {
} }
/** /**
* Tests that {@link CompositeSequenceableLoader#getNextLoadPositionUs()} returns * Tests that {@link CompositeSequenceableLoader#getNextLoadPositionUs()} returns {@link
* {@link C#TIME_END_OF_SOURCE} when all sub-loaders have next load position at end-of-source. * C#TIME_END_OF_SOURCE} when all sub-loaders have next load position at end-of-source.
*/ */
@Test @Test
public void testGetNextLoadPositionUsReturnsEndOfSourceWhenAllLoaderLoadingLastChunk() { public void getNextLoadPositionUsReturnsEndOfSourceWhenAllLoaderLoadingLastChunk() {
FakeSequenceableLoader loader1 = FakeSequenceableLoader loader1 =
new FakeSequenceableLoader( new FakeSequenceableLoader(
/* bufferedPositionUs */ 1000, /* nextLoadPositionUs */ C.TIME_END_OF_SOURCE); /* bufferedPositionUs */ 1000, /* nextLoadPositionUs */ C.TIME_END_OF_SOURCE);
...@@ -135,7 +135,7 @@ public final class CompositeSequenceableLoaderTest { ...@@ -135,7 +135,7 @@ public final class CompositeSequenceableLoaderTest {
* current playback position. * current playback position.
*/ */
@Test @Test
public void testContinueLoadingOnlyAllowFurthestBehindLoaderToLoadIfNotBehindPlaybackPosition() { public void continueLoadingOnlyAllowFurthestBehindLoaderToLoadIfNotBehindPlaybackPosition() {
FakeSequenceableLoader loader1 = FakeSequenceableLoader loader1 =
new FakeSequenceableLoader(/* bufferedPositionUs */ 1000, /* nextLoadPositionUs */ 2000); new FakeSequenceableLoader(/* bufferedPositionUs */ 1000, /* nextLoadPositionUs */ 2000);
FakeSequenceableLoader loader2 = FakeSequenceableLoader loader2 =
...@@ -149,11 +149,11 @@ public final class CompositeSequenceableLoaderTest { ...@@ -149,11 +149,11 @@ public final class CompositeSequenceableLoaderTest {
} }
/** /**
* Tests that {@link CompositeSequenceableLoader#continueLoading(long)} allows all loaders * Tests that {@link CompositeSequenceableLoader#continueLoading(long)} allows all loaders with
* with next load position behind current playback position to continue loading. * next load position behind current playback position to continue loading.
*/ */
@Test @Test
public void testContinueLoadingReturnAllowAllLoadersBehindPlaybackPositionToLoad() { public void continueLoadingReturnAllowAllLoadersBehindPlaybackPositionToLoad() {
FakeSequenceableLoader loader1 = FakeSequenceableLoader loader1 =
new FakeSequenceableLoader(/* bufferedPositionUs */ 1000, /* nextLoadPositionUs */ 2000); new FakeSequenceableLoader(/* bufferedPositionUs */ 1000, /* nextLoadPositionUs */ 2000);
FakeSequenceableLoader loader2 = FakeSequenceableLoader loader2 =
...@@ -170,11 +170,11 @@ public final class CompositeSequenceableLoaderTest { ...@@ -170,11 +170,11 @@ public final class CompositeSequenceableLoaderTest {
} }
/** /**
* Tests that {@link CompositeSequenceableLoader#continueLoading(long)} does not allow loader * Tests that {@link CompositeSequenceableLoader#continueLoading(long)} does not allow loader with
* with next load position at end-of-source to continue loading. * next load position at end-of-source to continue loading.
*/ */
@Test @Test
public void testContinueLoadingOnlyNotAllowEndOfSourceLoaderToLoad() { public void continueLoadingOnlyNotAllowEndOfSourceLoaderToLoad() {
FakeSequenceableLoader loader1 = FakeSequenceableLoader loader1 =
new FakeSequenceableLoader( new FakeSequenceableLoader(
/* bufferedPositionUs */ 1000, /* nextLoadPositionUs */ C.TIME_END_OF_SOURCE); /* bufferedPositionUs */ 1000, /* nextLoadPositionUs */ C.TIME_END_OF_SOURCE);
...@@ -191,11 +191,11 @@ public final class CompositeSequenceableLoaderTest { ...@@ -191,11 +191,11 @@ public final class CompositeSequenceableLoaderTest {
/** /**
* Tests that {@link CompositeSequenceableLoader#continueLoading(long)} returns true if the loader * Tests that {@link CompositeSequenceableLoader#continueLoading(long)} returns true if the loader
* with minimum next load position can make progress if next load positions are not behind * with minimum next load position can make progress if next load positions are not behind current
* current playback position. * playback position.
*/ */
@Test @Test
public void testContinueLoadingReturnTrueIfFurthestBehindLoaderCanMakeProgress() { public void continueLoadingReturnTrueIfFurthestBehindLoaderCanMakeProgress() {
FakeSequenceableLoader loader1 = FakeSequenceableLoader loader1 =
new FakeSequenceableLoader(/* bufferedPositionUs */ 1000, /* nextLoadPositionUs */ 2000); new FakeSequenceableLoader(/* bufferedPositionUs */ 1000, /* nextLoadPositionUs */ 2000);
FakeSequenceableLoader loader2 = FakeSequenceableLoader loader2 =
...@@ -214,7 +214,7 @@ public final class CompositeSequenceableLoaderTest { ...@@ -214,7 +214,7 @@ public final class CompositeSequenceableLoaderTest {
* minimum next load position. * minimum next load position.
*/ */
@Test @Test
public void testContinueLoadingReturnTrueIfLoaderBehindPlaybackPositionCanMakeProgress() { public void continueLoadingReturnTrueIfLoaderBehindPlaybackPositionCanMakeProgress() {
FakeSequenceableLoader loader1 = FakeSequenceableLoader loader1 =
new FakeSequenceableLoader(/* bufferedPositionUs */ 1000, /* nextLoadPositionUs */ 2000); new FakeSequenceableLoader(/* bufferedPositionUs */ 1000, /* nextLoadPositionUs */ 2000);
FakeSequenceableLoader loader2 = FakeSequenceableLoader loader2 =
......
...@@ -65,7 +65,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -65,7 +65,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testPlaylistChangesAfterPreparation() throws IOException, InterruptedException { public void playlistChangesAfterPreparation() throws IOException, InterruptedException {
Timeline timeline = testRunner.prepareSource(); Timeline timeline = testRunner.prepareSource();
TimelineAsserts.assertEmpty(timeline); TimelineAsserts.assertEmpty(timeline);
...@@ -187,7 +187,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -187,7 +187,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testPlaylistChangesBeforePreparation() throws IOException, InterruptedException { public void playlistChangesBeforePreparation() throws IOException, InterruptedException {
FakeMediaSource[] childSources = createMediaSources(4); FakeMediaSource[] childSources = createMediaSources(4);
mediaSource.addMediaSource(childSources[0]); mediaSource.addMediaSource(childSources[0]);
mediaSource.addMediaSource(childSources[1]); mediaSource.addMediaSource(childSources[1]);
...@@ -220,7 +220,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -220,7 +220,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testPlaylistWithLazyMediaSource() throws IOException, InterruptedException { public void playlistWithLazyMediaSource() throws IOException, InterruptedException {
// Create some normal (immediately preparing) sources and some lazy sources whose timeline // Create some normal (immediately preparing) sources and some lazy sources whose timeline
// updates need to be triggered. // updates need to be triggered.
FakeMediaSource[] fastSources = createMediaSources(2); FakeMediaSource[] fastSources = createMediaSources(2);
...@@ -301,7 +301,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -301,7 +301,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testEmptyTimelineMediaSource() throws IOException, InterruptedException { public void emptyTimelineMediaSource() throws IOException, InterruptedException {
Timeline timeline = testRunner.prepareSource(); Timeline timeline = testRunner.prepareSource();
TimelineAsserts.assertEmpty(timeline); TimelineAsserts.assertEmpty(timeline);
...@@ -357,7 +357,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -357,7 +357,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testDynamicChangeOfEmptyTimelines() throws IOException { public void dynamicChangeOfEmptyTimelines() throws IOException {
FakeMediaSource[] childSources = FakeMediaSource[] childSources =
new FakeMediaSource[] { new FakeMediaSource[] {
new FakeMediaSource(Timeline.EMPTY), new FakeMediaSource(Timeline.EMPTY),
...@@ -384,7 +384,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -384,7 +384,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testIllegalArguments() { public void illegalArguments() {
MediaSource validSource = new FakeMediaSource(createFakeTimeline(1)); MediaSource validSource = new FakeMediaSource(createFakeTimeline(1));
// Null sources. // Null sources.
...@@ -405,7 +405,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -405,7 +405,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testCustomCallbackBeforePreparationAddSingle() throws Exception { public void customCallbackBeforePreparationAddSingle() throws Exception {
CountDownLatch runnableInvoked = new CountDownLatch(1); CountDownLatch runnableInvoked = new CountDownLatch(1);
DummyMainThread dummyMainThread = new DummyMainThread(); DummyMainThread dummyMainThread = new DummyMainThread();
...@@ -420,7 +420,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -420,7 +420,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testCustomCallbackBeforePreparationAddMultiple() throws Exception { public void customCallbackBeforePreparationAddMultiple() throws Exception {
CountDownLatch runnableInvoked = new CountDownLatch(1); CountDownLatch runnableInvoked = new CountDownLatch(1);
DummyMainThread dummyMainThread = new DummyMainThread(); DummyMainThread dummyMainThread = new DummyMainThread();
...@@ -437,7 +437,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -437,7 +437,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testCustomCallbackBeforePreparationAddSingleWithIndex() throws Exception { public void customCallbackBeforePreparationAddSingleWithIndex() throws Exception {
CountDownLatch runnableInvoked = new CountDownLatch(1); CountDownLatch runnableInvoked = new CountDownLatch(1);
DummyMainThread dummyMainThread = new DummyMainThread(); DummyMainThread dummyMainThread = new DummyMainThread();
...@@ -455,7 +455,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -455,7 +455,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testCustomCallbackBeforePreparationAddMultipleWithIndex() throws Exception { public void customCallbackBeforePreparationAddMultipleWithIndex() throws Exception {
CountDownLatch runnableInvoked = new CountDownLatch(1); CountDownLatch runnableInvoked = new CountDownLatch(1);
DummyMainThread dummyMainThread = new DummyMainThread(); DummyMainThread dummyMainThread = new DummyMainThread();
...@@ -473,7 +473,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -473,7 +473,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testCustomCallbackBeforePreparationRemove() throws Exception { public void customCallbackBeforePreparationRemove() throws Exception {
CountDownLatch runnableInvoked = new CountDownLatch(1); CountDownLatch runnableInvoked = new CountDownLatch(1);
DummyMainThread dummyMainThread = new DummyMainThread(); DummyMainThread dummyMainThread = new DummyMainThread();
...@@ -490,7 +490,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -490,7 +490,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testCustomCallbackBeforePreparationMove() throws Exception { public void customCallbackBeforePreparationMove() throws Exception {
CountDownLatch runnableInvoked = new CountDownLatch(1); CountDownLatch runnableInvoked = new CountDownLatch(1);
DummyMainThread dummyMainThread = new DummyMainThread(); DummyMainThread dummyMainThread = new DummyMainThread();
...@@ -508,7 +508,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -508,7 +508,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testCustomCallbackAfterPreparationAddSingle() throws Exception { public void customCallbackAfterPreparationAddSingle() throws Exception {
DummyMainThread dummyMainThread = new DummyMainThread(); DummyMainThread dummyMainThread = new DummyMainThread();
try { try {
testRunner.prepareSource(); testRunner.prepareSource();
...@@ -525,7 +525,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -525,7 +525,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testCustomCallbackAfterPreparationAddMultiple() throws Exception { public void customCallbackAfterPreparationAddMultiple() throws Exception {
DummyMainThread dummyMainThread = new DummyMainThread(); DummyMainThread dummyMainThread = new DummyMainThread();
try { try {
testRunner.prepareSource(); testRunner.prepareSource();
...@@ -545,7 +545,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -545,7 +545,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testCustomCallbackAfterPreparationAddSingleWithIndex() throws Exception { public void customCallbackAfterPreparationAddSingleWithIndex() throws Exception {
DummyMainThread dummyMainThread = new DummyMainThread(); DummyMainThread dummyMainThread = new DummyMainThread();
try { try {
testRunner.prepareSource(); testRunner.prepareSource();
...@@ -562,7 +562,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -562,7 +562,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testCustomCallbackAfterPreparationAddMultipleWithIndex() throws Exception { public void customCallbackAfterPreparationAddMultipleWithIndex() throws Exception {
DummyMainThread dummyMainThread = new DummyMainThread(); DummyMainThread dummyMainThread = new DummyMainThread();
try { try {
testRunner.prepareSource(); testRunner.prepareSource();
...@@ -583,7 +583,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -583,7 +583,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testCustomCallbackAfterPreparationRemove() throws Exception { public void customCallbackAfterPreparationRemove() throws Exception {
DummyMainThread dummyMainThread = new DummyMainThread(); DummyMainThread dummyMainThread = new DummyMainThread();
try { try {
testRunner.prepareSource(); testRunner.prepareSource();
...@@ -602,7 +602,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -602,7 +602,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testCustomCallbackAfterPreparationMove() throws Exception { public void customCallbackAfterPreparationMove() throws Exception {
DummyMainThread dummyMainThread = new DummyMainThread(); DummyMainThread dummyMainThread = new DummyMainThread();
try { try {
testRunner.prepareSource(); testRunner.prepareSource();
...@@ -626,7 +626,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -626,7 +626,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testCustomCallbackIsCalledAfterRelease() throws Exception { public void customCallbackIsCalledAfterRelease() throws Exception {
DummyMainThread dummyMainThread = new DummyMainThread(); DummyMainThread dummyMainThread = new DummyMainThread();
CountDownLatch callbackCalledCondition = new CountDownLatch(1); CountDownLatch callbackCalledCondition = new CountDownLatch(1);
try { try {
...@@ -652,7 +652,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -652,7 +652,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testPeriodCreationWithAds() throws IOException, InterruptedException { public void periodCreationWithAds() throws IOException, InterruptedException {
// Create concatenated media source with ad child source. // Create concatenated media source with ad child source.
Timeline timelineContentOnly = Timeline timelineContentOnly =
new FakeTimeline( new FakeTimeline(
...@@ -708,7 +708,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -708,7 +708,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testAtomicTimelineWindowOrder() throws IOException { public void atomicTimelineWindowOrder() throws IOException {
// Release default test runner with non-atomic media source and replace with new test runner. // Release default test runner with non-atomic media source and replace with new test runner.
testRunner.release(); testRunner.release();
ConcatenatingMediaSource mediaSource = ConcatenatingMediaSource mediaSource =
...@@ -749,7 +749,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -749,7 +749,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testNestedTimeline() throws IOException { public void nestedTimeline() throws IOException {
ConcatenatingMediaSource nestedSource1 = ConcatenatingMediaSource nestedSource1 =
new ConcatenatingMediaSource(/* isAtomic= */ false, new FakeShuffleOrder(0)); new ConcatenatingMediaSource(/* isAtomic= */ false, new FakeShuffleOrder(0));
ConcatenatingMediaSource nestedSource2 = ConcatenatingMediaSource nestedSource2 =
...@@ -796,7 +796,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -796,7 +796,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testRemoveChildSourceWithActiveMediaPeriod() throws IOException { public void removeChildSourceWithActiveMediaPeriod() throws IOException {
FakeMediaSource childSource = createFakeMediaSource(); FakeMediaSource childSource = createFakeMediaSource();
mediaSource.addMediaSource(childSource); mediaSource.addMediaSource(childSource);
Timeline timeline = testRunner.prepareSource(); Timeline timeline = testRunner.prepareSource();
...@@ -812,7 +812,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -812,7 +812,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testDuplicateMediaSources() throws IOException, InterruptedException { public void duplicateMediaSources() throws IOException, InterruptedException {
Timeline childTimeline = new FakeTimeline(/* windowCount= */ 2); Timeline childTimeline = new FakeTimeline(/* windowCount= */ 2);
FakeMediaSource childSource = new FakeMediaSource(childTimeline); FakeMediaSource childSource = new FakeMediaSource(childTimeline);
...@@ -845,7 +845,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -845,7 +845,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testDuplicateNestedMediaSources() throws IOException, InterruptedException { public void duplicateNestedMediaSources() throws IOException, InterruptedException {
Timeline childTimeline = new FakeTimeline(/* windowCount= */ 1); Timeline childTimeline = new FakeTimeline(/* windowCount= */ 1);
FakeMediaSource childSource = new FakeMediaSource(childTimeline); FakeMediaSource childSource = new FakeMediaSource(childTimeline);
ConcatenatingMediaSource nestedConcatenation = new ConcatenatingMediaSource(); ConcatenatingMediaSource nestedConcatenation = new ConcatenatingMediaSource();
...@@ -878,7 +878,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -878,7 +878,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testClear() throws Exception { public void clear() throws Exception {
DummyMainThread dummyMainThread = new DummyMainThread(); DummyMainThread dummyMainThread = new DummyMainThread();
final FakeMediaSource preparedChildSource = createFakeMediaSource(); final FakeMediaSource preparedChildSource = createFakeMediaSource();
final FakeMediaSource unpreparedChildSource = new FakeMediaSource(/* timeline= */ null); final FakeMediaSource unpreparedChildSource = new FakeMediaSource(/* timeline= */ null);
...@@ -899,7 +899,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -899,7 +899,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testReleaseAndReprepareSource() throws IOException { public void releaseAndReprepareSource() throws IOException {
FakeMediaSource[] fakeMediaSources = createMediaSources(/* count= */ 2); FakeMediaSource[] fakeMediaSources = createMediaSources(/* count= */ 2);
mediaSource.addMediaSource(fakeMediaSources[0]); // Child source with 1 period. mediaSource.addMediaSource(fakeMediaSources[0]); // Child source with 1 period.
mediaSource.addMediaSource(fakeMediaSources[1]); // Child source with 2 periods. mediaSource.addMediaSource(fakeMediaSources[1]); // Child source with 2 periods.
...@@ -920,7 +920,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -920,7 +920,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testChildTimelineChangeWithActiveMediaPeriod() throws IOException { public void childTimelineChangeWithActiveMediaPeriod() throws IOException {
FakeMediaSource[] nestedChildSources = createMediaSources(/* count= */ 2); FakeMediaSource[] nestedChildSources = createMediaSources(/* count= */ 2);
ConcatenatingMediaSource childSource = new ConcatenatingMediaSource(nestedChildSources); ConcatenatingMediaSource childSource = new ConcatenatingMediaSource(nestedChildSources);
mediaSource.addMediaSource(childSource); mediaSource.addMediaSource(childSource);
...@@ -940,7 +940,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -940,7 +940,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testChildSourceIsNotPreparedWithLazyPreparation() throws IOException { public void childSourceIsNotPreparedWithLazyPreparation() throws IOException {
FakeMediaSource[] childSources = createMediaSources(/* count= */ 2); FakeMediaSource[] childSources = createMediaSources(/* count= */ 2);
mediaSource = mediaSource =
new ConcatenatingMediaSource( new ConcatenatingMediaSource(
...@@ -956,7 +956,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -956,7 +956,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testChildSourceIsPreparedWithLazyPreparationAfterPeriodCreation() throws IOException { public void childSourceIsPreparedWithLazyPreparationAfterPeriodCreation() throws IOException {
FakeMediaSource[] childSources = createMediaSources(/* count= */ 2); FakeMediaSource[] childSources = createMediaSources(/* count= */ 2);
mediaSource = mediaSource =
new ConcatenatingMediaSource( new ConcatenatingMediaSource(
...@@ -975,7 +975,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -975,7 +975,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testChildSourceWithLazyPreparationOnlyPreparesSourceOnce() throws IOException { public void childSourceWithLazyPreparationOnlyPreparesSourceOnce() throws IOException {
FakeMediaSource[] childSources = createMediaSources(/* count= */ 2); FakeMediaSource[] childSources = createMediaSources(/* count= */ 2);
mediaSource = mediaSource =
new ConcatenatingMediaSource( new ConcatenatingMediaSource(
...@@ -997,7 +997,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -997,7 +997,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testRemoveUnpreparedChildSourceWithLazyPreparation() throws IOException { public void removeUnpreparedChildSourceWithLazyPreparation() throws IOException {
FakeMediaSource[] childSources = createMediaSources(/* count= */ 2); FakeMediaSource[] childSources = createMediaSources(/* count= */ 2);
mediaSource = mediaSource =
new ConcatenatingMediaSource( new ConcatenatingMediaSource(
...@@ -1013,7 +1013,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -1013,7 +1013,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testSetShuffleOrderBeforePreparation() throws Exception { public void setShuffleOrderBeforePreparation() throws Exception {
mediaSource.setShuffleOrder(new ShuffleOrder.UnshuffledShuffleOrder(/* length= */ 0)); mediaSource.setShuffleOrder(new ShuffleOrder.UnshuffledShuffleOrder(/* length= */ 0));
mediaSource.addMediaSources( mediaSource.addMediaSources(
Arrays.asList(createFakeMediaSource(), createFakeMediaSource(), createFakeMediaSource())); Arrays.asList(createFakeMediaSource(), createFakeMediaSource(), createFakeMediaSource()));
...@@ -1023,7 +1023,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -1023,7 +1023,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testSetShuffleOrderAfterPreparation() throws Exception { public void setShuffleOrderAfterPreparation() throws Exception {
mediaSource.addMediaSources( mediaSource.addMediaSources(
Arrays.asList(createFakeMediaSource(), createFakeMediaSource(), createFakeMediaSource())); Arrays.asList(createFakeMediaSource(), createFakeMediaSource(), createFakeMediaSource()));
testRunner.prepareSource(); testRunner.prepareSource();
...@@ -1034,7 +1034,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -1034,7 +1034,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testCustomCallbackBeforePreparationSetShuffleOrder() throws Exception { public void customCallbackBeforePreparationSetShuffleOrder() throws Exception {
CountDownLatch runnableInvoked = new CountDownLatch(1); CountDownLatch runnableInvoked = new CountDownLatch(1);
DummyMainThread dummyMainThread = new DummyMainThread(); DummyMainThread dummyMainThread = new DummyMainThread();
...@@ -1051,7 +1051,7 @@ public final class ConcatenatingMediaSourceTest { ...@@ -1051,7 +1051,7 @@ public final class ConcatenatingMediaSourceTest {
} }
@Test @Test
public void testCustomCallbackAfterPreparationSetShuffleOrder() throws Exception { public void customCallbackAfterPreparationSetShuffleOrder() throws Exception {
DummyMainThread dummyMainThread = new DummyMainThread(); DummyMainThread dummyMainThread = new DummyMainThread();
try { try {
mediaSource.addMediaSources( mediaSource.addMediaSources(
......
...@@ -47,7 +47,7 @@ public class LoopingMediaSourceTest { ...@@ -47,7 +47,7 @@ public class LoopingMediaSourceTest {
} }
@Test @Test
public void testSingleLoopTimeline() throws IOException { public void singleLoopTimeline() throws IOException {
Timeline timeline = getLoopingTimeline(multiWindowTimeline, 1); Timeline timeline = getLoopingTimeline(multiWindowTimeline, 1);
TimelineAsserts.assertWindowTags(timeline, 111, 222, 333); TimelineAsserts.assertWindowTags(timeline, 111, 222, 333);
TimelineAsserts.assertPeriodCounts(timeline, 1, 1, 1); TimelineAsserts.assertPeriodCounts(timeline, 1, 1, 1);
...@@ -66,7 +66,7 @@ public class LoopingMediaSourceTest { ...@@ -66,7 +66,7 @@ public class LoopingMediaSourceTest {
} }
@Test @Test
public void testMultiLoopTimeline() throws IOException { public void multiLoopTimeline() throws IOException {
Timeline timeline = getLoopingTimeline(multiWindowTimeline, 3); Timeline timeline = getLoopingTimeline(multiWindowTimeline, 3);
TimelineAsserts.assertWindowTags(timeline, 111, 222, 333, 111, 222, 333, 111, 222, 333); TimelineAsserts.assertWindowTags(timeline, 111, 222, 333, 111, 222, 333, 111, 222, 333);
TimelineAsserts.assertPeriodCounts(timeline, 1, 1, 1, 1, 1, 1, 1, 1, 1); TimelineAsserts.assertPeriodCounts(timeline, 1, 1, 1, 1, 1, 1, 1, 1, 1);
...@@ -87,7 +87,7 @@ public class LoopingMediaSourceTest { ...@@ -87,7 +87,7 @@ public class LoopingMediaSourceTest {
} }
@Test @Test
public void testInfiniteLoopTimeline() throws IOException { public void infiniteLoopTimeline() throws IOException {
Timeline timeline = getLoopingTimeline(multiWindowTimeline, Integer.MAX_VALUE); Timeline timeline = getLoopingTimeline(multiWindowTimeline, Integer.MAX_VALUE);
TimelineAsserts.assertWindowTags(timeline, 111, 222, 333); TimelineAsserts.assertWindowTags(timeline, 111, 222, 333);
TimelineAsserts.assertPeriodCounts(timeline, 1, 1, 1); TimelineAsserts.assertPeriodCounts(timeline, 1, 1, 1);
...@@ -105,7 +105,7 @@ public class LoopingMediaSourceTest { ...@@ -105,7 +105,7 @@ public class LoopingMediaSourceTest {
} }
@Test @Test
public void testEmptyTimelineLoop() throws IOException { public void emptyTimelineLoop() throws IOException {
Timeline timeline = getLoopingTimeline(Timeline.EMPTY, 1); Timeline timeline = getLoopingTimeline(Timeline.EMPTY, 1);
TimelineAsserts.assertEmpty(timeline); TimelineAsserts.assertEmpty(timeline);
...@@ -117,17 +117,17 @@ public class LoopingMediaSourceTest { ...@@ -117,17 +117,17 @@ public class LoopingMediaSourceTest {
} }
@Test @Test
public void testSingleLoopPeriodCreation() throws Exception { public void singleLoopPeriodCreation() throws Exception {
testMediaPeriodCreation(multiWindowTimeline, /* loopCount= */ 1); testMediaPeriodCreation(multiWindowTimeline, /* loopCount= */ 1);
} }
@Test @Test
public void testMultiLoopPeriodCreation() throws Exception { public void multiLoopPeriodCreation() throws Exception {
testMediaPeriodCreation(multiWindowTimeline, /* loopCount= */ 3); testMediaPeriodCreation(multiWindowTimeline, /* loopCount= */ 3);
} }
@Test @Test
public void testInfiniteLoopPeriodCreation() throws Exception { public void infiniteLoopPeriodCreation() throws Exception {
testMediaPeriodCreation(multiWindowTimeline, /* loopCount= */ Integer.MAX_VALUE); testMediaPeriodCreation(multiWindowTimeline, /* loopCount= */ Integer.MAX_VALUE);
} }
......
...@@ -37,7 +37,7 @@ import org.robolectric.annotation.LooperMode; ...@@ -37,7 +37,7 @@ import org.robolectric.annotation.LooperMode;
public class MergingMediaSourceTest { public class MergingMediaSourceTest {
@Test @Test
public void testMergingDynamicTimelines() throws IOException { public void mergingDynamicTimelines() throws IOException {
FakeTimeline firstTimeline = FakeTimeline firstTimeline =
new FakeTimeline(new TimelineWindowDefinition(true, true, C.TIME_UNSET)); new FakeTimeline(new TimelineWindowDefinition(true, true, C.TIME_UNSET));
FakeTimeline secondTimeline = FakeTimeline secondTimeline =
...@@ -46,14 +46,14 @@ public class MergingMediaSourceTest { ...@@ -46,14 +46,14 @@ public class MergingMediaSourceTest {
} }
@Test @Test
public void testMergingStaticTimelines() throws IOException { public void mergingStaticTimelines() throws IOException {
FakeTimeline firstTimeline = new FakeTimeline(new TimelineWindowDefinition(true, false, 20)); FakeTimeline firstTimeline = new FakeTimeline(new TimelineWindowDefinition(true, false, 20));
FakeTimeline secondTimeline = new FakeTimeline(new TimelineWindowDefinition(true, false, 10)); FakeTimeline secondTimeline = new FakeTimeline(new TimelineWindowDefinition(true, false, 10));
testMergingMediaSourcePrepare(firstTimeline, secondTimeline); testMergingMediaSourcePrepare(firstTimeline, secondTimeline);
} }
@Test @Test
public void testMergingTimelinesWithDifferentPeriodCounts() throws IOException { public void mergingTimelinesWithDifferentPeriodCounts() throws IOException {
FakeTimeline firstTimeline = new FakeTimeline(new TimelineWindowDefinition(1, null)); FakeTimeline firstTimeline = new FakeTimeline(new TimelineWindowDefinition(1, null));
FakeTimeline secondTimeline = new FakeTimeline(new TimelineWindowDefinition(2, null)); FakeTimeline secondTimeline = new FakeTimeline(new TimelineWindowDefinition(2, null));
try { try {
...@@ -65,7 +65,7 @@ public class MergingMediaSourceTest { ...@@ -65,7 +65,7 @@ public class MergingMediaSourceTest {
} }
@Test @Test
public void testMergingMediaSourcePeriodCreation() throws Exception { public void mergingMediaSourcePeriodCreation() throws Exception {
FakeMediaSource[] mediaSources = new FakeMediaSource[2]; FakeMediaSource[] mediaSources = new FakeMediaSource[2];
for (int i = 0; i < mediaSources.length; i++) { for (int i = 0; i < mediaSources.length; i++) {
mediaSources[i] = new FakeMediaSource(new FakeTimeline(/* windowCount= */ 2)); mediaSources[i] = new FakeMediaSource(new FakeTimeline(/* windowCount= */ 2));
......
...@@ -157,7 +157,7 @@ public final class SampleQueueTest { ...@@ -157,7 +157,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testCapacityIncreases() { public void capacityIncreases() {
int numberOfSamplesToInput = 3 * SampleQueue.SAMPLE_CAPACITY_INCREMENT + 1; int numberOfSamplesToInput = 3 * SampleQueue.SAMPLE_CAPACITY_INCREMENT + 1;
sampleQueue.format(FORMAT_1); sampleQueue.format(FORMAT_1);
sampleQueue.sampleData( sampleQueue.sampleData(
...@@ -185,7 +185,7 @@ public final class SampleQueueTest { ...@@ -185,7 +185,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testResetReleasesAllocations() { public void resetReleasesAllocations() {
writeTestData(); writeTestData();
assertAllocationCount(10); assertAllocationCount(10);
sampleQueue.reset(); sampleQueue.reset();
...@@ -193,12 +193,12 @@ public final class SampleQueueTest { ...@@ -193,12 +193,12 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testReadWithoutWrite() { public void readWithoutWrite() {
assertNoSamplesToRead(null); assertNoSamplesToRead(null);
} }
@Test @Test
public void testEqualFormatsDeduplicated() { public void equalFormatsDeduplicated() {
sampleQueue.format(FORMAT_1); sampleQueue.format(FORMAT_1);
assertReadFormat(false, FORMAT_1); assertReadFormat(false, FORMAT_1);
// If the same format is written then it should not cause a format change on the read side. // If the same format is written then it should not cause a format change on the read side.
...@@ -210,7 +210,7 @@ public final class SampleQueueTest { ...@@ -210,7 +210,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testMultipleFormatsDeduplicated() { public void multipleFormatsDeduplicated() {
sampleQueue.format(FORMAT_1); sampleQueue.format(FORMAT_1);
sampleQueue.sampleData(new ParsableByteArray(DATA), ALLOCATION_SIZE); sampleQueue.sampleData(new ParsableByteArray(DATA), ALLOCATION_SIZE);
sampleQueue.sampleMetadata(0, C.BUFFER_FLAG_KEY_FRAME, ALLOCATION_SIZE, 0, null); sampleQueue.sampleMetadata(0, C.BUFFER_FLAG_KEY_FRAME, ALLOCATION_SIZE, 0, null);
...@@ -237,7 +237,7 @@ public final class SampleQueueTest { ...@@ -237,7 +237,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testReadSingleSamples() { public void readSingleSamples() {
sampleQueue.sampleData(new ParsableByteArray(DATA), ALLOCATION_SIZE); sampleQueue.sampleData(new ParsableByteArray(DATA), ALLOCATION_SIZE);
assertAllocationCount(1); assertAllocationCount(1);
...@@ -296,7 +296,7 @@ public final class SampleQueueTest { ...@@ -296,7 +296,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testReadMultiSamples() { public void readMultiSamples() {
writeTestData(); writeTestData();
assertThat(sampleQueue.getLargestQueuedTimestampUs()).isEqualTo(LAST_SAMPLE_TIMESTAMP); assertThat(sampleQueue.getLargestQueuedTimestampUs()).isEqualTo(LAST_SAMPLE_TIMESTAMP);
assertAllocationCount(10); assertAllocationCount(10);
...@@ -307,7 +307,7 @@ public final class SampleQueueTest { ...@@ -307,7 +307,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testReadMultiSamplesTwice() { public void readMultiSamplesTwice() {
writeTestData(); writeTestData();
writeTestData(); writeTestData();
assertAllocationCount(20); assertAllocationCount(20);
...@@ -319,7 +319,7 @@ public final class SampleQueueTest { ...@@ -319,7 +319,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testReadMultiWithSeek() { public void readMultiWithSeek() {
writeTestData(); writeTestData();
assertReadTestData(); assertReadTestData();
assertThat(sampleQueue.getFirstIndex()).isEqualTo(0); assertThat(sampleQueue.getFirstIndex()).isEqualTo(0);
...@@ -335,20 +335,20 @@ public final class SampleQueueTest { ...@@ -335,20 +335,20 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testEmptyQueueReturnsLoadingFinished() { public void emptyQueueReturnsLoadingFinished() {
sampleQueue.sampleData(new ParsableByteArray(DATA), DATA.length); sampleQueue.sampleData(new ParsableByteArray(DATA), DATA.length);
assertThat(sampleQueue.isReady(/* loadingFinished= */ false)).isFalse(); assertThat(sampleQueue.isReady(/* loadingFinished= */ false)).isFalse();
assertThat(sampleQueue.isReady(/* loadingFinished= */ true)).isTrue(); assertThat(sampleQueue.isReady(/* loadingFinished= */ true)).isTrue();
} }
@Test @Test
public void testIsReadyWithUpstreamFormatOnlyReturnsTrue() { public void isReadyWithUpstreamFormatOnlyReturnsTrue() {
sampleQueue.format(FORMAT_ENCRYPTED); sampleQueue.format(FORMAT_ENCRYPTED);
assertThat(sampleQueue.isReady(/* loadingFinished= */ false)).isTrue(); assertThat(sampleQueue.isReady(/* loadingFinished= */ false)).isTrue();
} }
@Test @Test
public void testIsReadyReturnsTrueForValidDrmSession() { public void isReadyReturnsTrueForValidDrmSession() {
writeTestDataWithEncryptedSections(); writeTestDataWithEncryptedSections();
assertReadFormat(/* formatRequired= */ false, FORMAT_ENCRYPTED); assertReadFormat(/* formatRequired= */ false, FORMAT_ENCRYPTED);
assertThat(sampleQueue.isReady(/* loadingFinished= */ false)).isFalse(); assertThat(sampleQueue.isReady(/* loadingFinished= */ false)).isFalse();
...@@ -357,7 +357,7 @@ public final class SampleQueueTest { ...@@ -357,7 +357,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testIsReadyReturnsTrueForClearSampleAndPlayClearSamplesWithoutKeysIsTrue() { public void isReadyReturnsTrueForClearSampleAndPlayClearSamplesWithoutKeysIsTrue() {
when(mockDrmSession.playClearSamplesWithoutKeys()).thenReturn(true); when(mockDrmSession.playClearSamplesWithoutKeys()).thenReturn(true);
// We recreate the queue to ensure the mock DRM session manager flags are taken into account. // We recreate the queue to ensure the mock DRM session manager flags are taken into account.
sampleQueue = new SampleQueue(allocator, mockDrmSessionManager); sampleQueue = new SampleQueue(allocator, mockDrmSessionManager);
...@@ -366,7 +366,7 @@ public final class SampleQueueTest { ...@@ -366,7 +366,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testReadEncryptedSectionsWaitsForKeys() { public void readEncryptedSectionsWaitsForKeys() {
when(mockDrmSession.getState()).thenReturn(DrmSession.STATE_OPENED); when(mockDrmSession.getState()).thenReturn(DrmSession.STATE_OPENED);
writeTestDataWithEncryptedSections(); writeTestDataWithEncryptedSections();
...@@ -377,7 +377,7 @@ public final class SampleQueueTest { ...@@ -377,7 +377,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testReadEncryptedSectionsPopulatesDrmSession() { public void readEncryptedSectionsPopulatesDrmSession() {
when(mockDrmSession.getState()).thenReturn(DrmSession.STATE_OPENED_WITH_KEYS); when(mockDrmSession.getState()).thenReturn(DrmSession.STATE_OPENED_WITH_KEYS);
writeTestDataWithEncryptedSections(); writeTestDataWithEncryptedSections();
...@@ -417,7 +417,7 @@ public final class SampleQueueTest { ...@@ -417,7 +417,7 @@ public final class SampleQueueTest {
@Test @Test
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void testAllowPlaceholderSessionPopulatesDrmSession() { public void allowPlaceholderSessionPopulatesDrmSession() {
when(mockDrmSession.getState()).thenReturn(DrmSession.STATE_OPENED_WITH_KEYS); when(mockDrmSession.getState()).thenReturn(DrmSession.STATE_OPENED_WITH_KEYS);
DrmSession<ExoMediaCrypto> mockPlaceholderDrmSession = DrmSession<ExoMediaCrypto> mockPlaceholderDrmSession =
(DrmSession<ExoMediaCrypto>) Mockito.mock(DrmSession.class); (DrmSession<ExoMediaCrypto>) Mockito.mock(DrmSession.class);
...@@ -464,7 +464,7 @@ public final class SampleQueueTest { ...@@ -464,7 +464,7 @@ public final class SampleQueueTest {
@Test @Test
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void testTrailingCryptoInfoInitializationVectorBytesZeroed() { public void trailingCryptoInfoInitializationVectorBytesZeroed() {
when(mockDrmSession.getState()).thenReturn(DrmSession.STATE_OPENED_WITH_KEYS); when(mockDrmSession.getState()).thenReturn(DrmSession.STATE_OPENED_WITH_KEYS);
DrmSession<ExoMediaCrypto> mockPlaceholderDrmSession = DrmSession<ExoMediaCrypto> mockPlaceholderDrmSession =
(DrmSession<ExoMediaCrypto>) Mockito.mock(DrmSession.class); (DrmSession<ExoMediaCrypto>) Mockito.mock(DrmSession.class);
...@@ -516,7 +516,7 @@ public final class SampleQueueTest { ...@@ -516,7 +516,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testReadWithErrorSessionReadsNothingAndThrows() throws IOException { public void readWithErrorSessionReadsNothingAndThrows() throws IOException {
when(mockDrmSession.getState()).thenReturn(DrmSession.STATE_OPENED); when(mockDrmSession.getState()).thenReturn(DrmSession.STATE_OPENED);
writeTestDataWithEncryptedSections(); writeTestDataWithEncryptedSections();
...@@ -537,7 +537,7 @@ public final class SampleQueueTest { ...@@ -537,7 +537,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testAllowPlayClearSamplesWithoutKeysReadsClearSamples() { public void allowPlayClearSamplesWithoutKeysReadsClearSamples() {
when(mockDrmSession.playClearSamplesWithoutKeys()).thenReturn(true); when(mockDrmSession.playClearSamplesWithoutKeys()).thenReturn(true);
// We recreate the queue to ensure the mock DRM session manager flags are taken into account. // We recreate the queue to ensure the mock DRM session manager flags are taken into account.
sampleQueue = new SampleQueue(allocator, mockDrmSessionManager); sampleQueue = new SampleQueue(allocator, mockDrmSessionManager);
...@@ -549,7 +549,7 @@ public final class SampleQueueTest { ...@@ -549,7 +549,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testSeekAfterDiscard() { public void seekAfterDiscard() {
writeTestData(); writeTestData();
assertReadTestData(); assertReadTestData();
sampleQueue.discardToRead(); sampleQueue.discardToRead();
...@@ -566,7 +566,7 @@ public final class SampleQueueTest { ...@@ -566,7 +566,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testAdvanceToEnd() { public void advanceToEnd() {
writeTestData(); writeTestData();
sampleQueue.advanceToEnd(); sampleQueue.advanceToEnd();
assertAllocationCount(10); assertAllocationCount(10);
...@@ -580,7 +580,7 @@ public final class SampleQueueTest { ...@@ -580,7 +580,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testAdvanceToEndRetainsUnassignedData() { public void advanceToEndRetainsUnassignedData() {
sampleQueue.format(FORMAT_1); sampleQueue.format(FORMAT_1);
sampleQueue.sampleData(new ParsableByteArray(DATA), ALLOCATION_SIZE); sampleQueue.sampleData(new ParsableByteArray(DATA), ALLOCATION_SIZE);
sampleQueue.advanceToEnd(); sampleQueue.advanceToEnd();
...@@ -604,7 +604,7 @@ public final class SampleQueueTest { ...@@ -604,7 +604,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testAdvanceToBeforeBuffer() { public void advanceToBeforeBuffer() {
writeTestData(); writeTestData();
int skipCount = sampleQueue.advanceTo(SAMPLE_TIMESTAMPS[0] - 1); int skipCount = sampleQueue.advanceTo(SAMPLE_TIMESTAMPS[0] - 1);
// Should have no effect (we're already at the first frame). // Should have no effect (we're already at the first frame).
...@@ -614,7 +614,7 @@ public final class SampleQueueTest { ...@@ -614,7 +614,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testAdvanceToStartOfBuffer() { public void advanceToStartOfBuffer() {
writeTestData(); writeTestData();
int skipCount = sampleQueue.advanceTo(SAMPLE_TIMESTAMPS[0]); int skipCount = sampleQueue.advanceTo(SAMPLE_TIMESTAMPS[0]);
// Should have no effect (we're already at the first frame). // Should have no effect (we're already at the first frame).
...@@ -624,7 +624,7 @@ public final class SampleQueueTest { ...@@ -624,7 +624,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testAdvanceToEndOfBuffer() { public void advanceToEndOfBuffer() {
writeTestData(); writeTestData();
int skipCount = sampleQueue.advanceTo(LAST_SAMPLE_TIMESTAMP); int skipCount = sampleQueue.advanceTo(LAST_SAMPLE_TIMESTAMP);
// Should advance to 2nd keyframe (the 4th frame). // Should advance to 2nd keyframe (the 4th frame).
...@@ -634,7 +634,7 @@ public final class SampleQueueTest { ...@@ -634,7 +634,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testAdvanceToAfterBuffer() { public void advanceToAfterBuffer() {
writeTestData(); writeTestData();
int skipCount = sampleQueue.advanceTo(LAST_SAMPLE_TIMESTAMP + 1); int skipCount = sampleQueue.advanceTo(LAST_SAMPLE_TIMESTAMP + 1);
// Should advance to 2nd keyframe (the 4th frame). // Should advance to 2nd keyframe (the 4th frame).
...@@ -644,7 +644,7 @@ public final class SampleQueueTest { ...@@ -644,7 +644,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testSeekToBeforeBuffer() { public void seekToBeforeBuffer() {
writeTestData(); writeTestData();
boolean success = sampleQueue.seekTo(SAMPLE_TIMESTAMPS[0] - 1, false); boolean success = sampleQueue.seekTo(SAMPLE_TIMESTAMPS[0] - 1, false);
assertThat(success).isFalse(); assertThat(success).isFalse();
...@@ -654,7 +654,7 @@ public final class SampleQueueTest { ...@@ -654,7 +654,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testSeekToStartOfBuffer() { public void seekToStartOfBuffer() {
writeTestData(); writeTestData();
boolean success = sampleQueue.seekTo(SAMPLE_TIMESTAMPS[0], false); boolean success = sampleQueue.seekTo(SAMPLE_TIMESTAMPS[0], false);
assertThat(success).isTrue(); assertThat(success).isTrue();
...@@ -664,7 +664,7 @@ public final class SampleQueueTest { ...@@ -664,7 +664,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testSeekToEndOfBuffer() { public void seekToEndOfBuffer() {
writeTestData(); writeTestData();
boolean success = sampleQueue.seekTo(LAST_SAMPLE_TIMESTAMP, false); boolean success = sampleQueue.seekTo(LAST_SAMPLE_TIMESTAMP, false);
assertThat(success).isTrue(); assertThat(success).isTrue();
...@@ -674,7 +674,7 @@ public final class SampleQueueTest { ...@@ -674,7 +674,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testSeekToAfterBuffer() { public void seekToAfterBuffer() {
writeTestData(); writeTestData();
boolean success = sampleQueue.seekTo(LAST_SAMPLE_TIMESTAMP + 1, false); boolean success = sampleQueue.seekTo(LAST_SAMPLE_TIMESTAMP + 1, false);
assertThat(success).isFalse(); assertThat(success).isFalse();
...@@ -684,7 +684,7 @@ public final class SampleQueueTest { ...@@ -684,7 +684,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testSeekToAfterBufferAllowed() { public void seekToAfterBufferAllowed() {
writeTestData(); writeTestData();
boolean success = sampleQueue.seekTo(LAST_SAMPLE_TIMESTAMP + 1, true); boolean success = sampleQueue.seekTo(LAST_SAMPLE_TIMESTAMP + 1, true);
assertThat(success).isTrue(); assertThat(success).isTrue();
...@@ -694,7 +694,7 @@ public final class SampleQueueTest { ...@@ -694,7 +694,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testSeekToEndAndBackToStart() { public void seekToEndAndBackToStart() {
writeTestData(); writeTestData();
boolean success = sampleQueue.seekTo(LAST_SAMPLE_TIMESTAMP, false); boolean success = sampleQueue.seekTo(LAST_SAMPLE_TIMESTAMP, false);
assertThat(success).isTrue(); assertThat(success).isTrue();
...@@ -710,7 +710,7 @@ public final class SampleQueueTest { ...@@ -710,7 +710,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testDiscardToEnd() { public void discardToEnd() {
writeTestData(); writeTestData();
// Should discard everything. // Should discard everything.
sampleQueue.discardToEnd(); sampleQueue.discardToEnd();
...@@ -725,7 +725,7 @@ public final class SampleQueueTest { ...@@ -725,7 +725,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testDiscardToStopAtReadPosition() { public void discardToStopAtReadPosition() {
writeTestData(); writeTestData();
// Shouldn't discard anything. // Shouldn't discard anything.
sampleQueue.discardTo(LAST_SAMPLE_TIMESTAMP, false, true); sampleQueue.discardTo(LAST_SAMPLE_TIMESTAMP, false, true);
...@@ -766,7 +766,7 @@ public final class SampleQueueTest { ...@@ -766,7 +766,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testDiscardToDontStopAtReadPosition() { public void discardToDontStopAtReadPosition() {
writeTestData(); writeTestData();
// Shouldn't discard anything. // Shouldn't discard anything.
sampleQueue.discardTo(SAMPLE_TIMESTAMPS[1] - 1, false, false); sampleQueue.discardTo(SAMPLE_TIMESTAMPS[1] - 1, false, false);
...@@ -783,7 +783,7 @@ public final class SampleQueueTest { ...@@ -783,7 +783,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testDiscardUpstream() { public void discardUpstream() {
writeTestData(); writeTestData();
sampleQueue.discardUpstreamSamples(8); sampleQueue.discardUpstreamSamples(8);
assertAllocationCount(10); assertAllocationCount(10);
...@@ -808,7 +808,7 @@ public final class SampleQueueTest { ...@@ -808,7 +808,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testDiscardUpstreamMulti() { public void discardUpstreamMulti() {
writeTestData(); writeTestData();
sampleQueue.discardUpstreamSamples(4); sampleQueue.discardUpstreamSamples(4);
assertAllocationCount(4); assertAllocationCount(4);
...@@ -819,7 +819,7 @@ public final class SampleQueueTest { ...@@ -819,7 +819,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testDiscardUpstreamBeforeRead() { public void discardUpstreamBeforeRead() {
writeTestData(); writeTestData();
sampleQueue.discardUpstreamSamples(4); sampleQueue.discardUpstreamSamples(4);
assertAllocationCount(4); assertAllocationCount(4);
...@@ -829,7 +829,7 @@ public final class SampleQueueTest { ...@@ -829,7 +829,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testDiscardUpstreamAfterRead() { public void discardUpstreamAfterRead() {
writeTestData(); writeTestData();
assertReadTestData(null, 0, 3); assertReadTestData(null, 0, 3);
sampleQueue.discardUpstreamSamples(8); sampleQueue.discardUpstreamSamples(8);
...@@ -851,7 +851,7 @@ public final class SampleQueueTest { ...@@ -851,7 +851,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testLargestQueuedTimestampWithDiscardUpstream() { public void largestQueuedTimestampWithDiscardUpstream() {
writeTestData(); writeTestData();
assertThat(sampleQueue.getLargestQueuedTimestampUs()).isEqualTo(LAST_SAMPLE_TIMESTAMP); assertThat(sampleQueue.getLargestQueuedTimestampUs()).isEqualTo(LAST_SAMPLE_TIMESTAMP);
sampleQueue.discardUpstreamSamples(SAMPLE_TIMESTAMPS.length - 1); sampleQueue.discardUpstreamSamples(SAMPLE_TIMESTAMPS.length - 1);
...@@ -864,7 +864,7 @@ public final class SampleQueueTest { ...@@ -864,7 +864,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testLargestQueuedTimestampWithDiscardUpstreamDecodeOrder() { public void largestQueuedTimestampWithDiscardUpstreamDecodeOrder() {
long[] decodeOrderTimestamps = new long[] {0, 3000, 2000, 1000, 4000, 7000, 6000, 5000}; long[] decodeOrderTimestamps = new long[] {0, 3000, 2000, 1000, 4000, 7000, 6000, 5000};
writeTestData( writeTestData(
DATA, SAMPLE_SIZES, SAMPLE_OFFSETS, decodeOrderTimestamps, SAMPLE_FORMATS, SAMPLE_FLAGS); DATA, SAMPLE_SIZES, SAMPLE_OFFSETS, decodeOrderTimestamps, SAMPLE_FORMATS, SAMPLE_FLAGS);
...@@ -880,9 +880,9 @@ public final class SampleQueueTest { ...@@ -880,9 +880,9 @@ public final class SampleQueueTest {
// Discarding everything from upstream without reading should unset the largest timestamp. // Discarding everything from upstream without reading should unset the largest timestamp.
assertThat(sampleQueue.getLargestQueuedTimestampUs()).isEqualTo(MIN_VALUE); assertThat(sampleQueue.getLargestQueuedTimestampUs()).isEqualTo(MIN_VALUE);
} }
@Test @Test
public void testLargestQueuedTimestampWithRead() { public void largestQueuedTimestampWithRead() {
writeTestData(); writeTestData();
assertThat(sampleQueue.getLargestQueuedTimestampUs()).isEqualTo(LAST_SAMPLE_TIMESTAMP); assertThat(sampleQueue.getLargestQueuedTimestampUs()).isEqualTo(LAST_SAMPLE_TIMESTAMP);
assertReadTestData(); assertReadTestData();
...@@ -891,7 +891,7 @@ public final class SampleQueueTest { ...@@ -891,7 +891,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testSetSampleOffsetBeforeData() { public void setSampleOffsetBeforeData() {
long sampleOffsetUs = 1000; long sampleOffsetUs = 1000;
sampleQueue.setSampleOffsetUs(sampleOffsetUs); sampleQueue.setSampleOffsetUs(sampleOffsetUs);
writeTestData(); writeTestData();
...@@ -901,7 +901,7 @@ public final class SampleQueueTest { ...@@ -901,7 +901,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testSetSampleOffsetBetweenSamples() { public void setSampleOffsetBetweenSamples() {
writeTestData(); writeTestData();
long sampleOffsetUs = 1000; long sampleOffsetUs = 1000;
sampleQueue.setSampleOffsetUs(sampleOffsetUs); sampleQueue.setSampleOffsetUs(sampleOffsetUs);
...@@ -926,7 +926,7 @@ public final class SampleQueueTest { ...@@ -926,7 +926,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testAdjustUpstreamFormat() { public void adjustUpstreamFormat() {
String label = "label"; String label = "label";
sampleQueue = sampleQueue =
new SampleQueue(allocator, mockDrmSessionManager) { new SampleQueue(allocator, mockDrmSessionManager) {
...@@ -942,7 +942,7 @@ public final class SampleQueueTest { ...@@ -942,7 +942,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testInvalidateUpstreamFormatAdjustment() { public void invalidateUpstreamFormatAdjustment() {
AtomicReference<String> label = new AtomicReference<>("label1"); AtomicReference<String> label = new AtomicReference<>("label1");
sampleQueue = sampleQueue =
new SampleQueue(allocator, mockDrmSessionManager) { new SampleQueue(allocator, mockDrmSessionManager) {
...@@ -981,7 +981,7 @@ public final class SampleQueueTest { ...@@ -981,7 +981,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testSplice() { public void splice() {
writeTestData(); writeTestData();
sampleQueue.splice(); sampleQueue.splice();
// Splice should succeed, replacing the last 4 samples with the sample being written. // Splice should succeed, replacing the last 4 samples with the sample being written.
...@@ -995,7 +995,7 @@ public final class SampleQueueTest { ...@@ -995,7 +995,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testSpliceAfterRead() { public void spliceAfterRead() {
writeTestData(); writeTestData();
assertReadTestData(null, 0, 4); assertReadTestData(null, 0, 4);
sampleQueue.splice(); sampleQueue.splice();
...@@ -1019,7 +1019,7 @@ public final class SampleQueueTest { ...@@ -1019,7 +1019,7 @@ public final class SampleQueueTest {
} }
@Test @Test
public void testSpliceWithSampleOffset() { public void spliceWithSampleOffset() {
long sampleOffsetUs = 30000; long sampleOffsetUs = 30000;
sampleQueue.setSampleOffsetUs(sampleOffsetUs); sampleQueue.setSampleOffsetUs(sampleOffsetUs);
writeTestData(); writeTestData();
......
...@@ -32,7 +32,7 @@ public final class ShuffleOrderTest { ...@@ -32,7 +32,7 @@ public final class ShuffleOrderTest {
public static final long RANDOM_SEED = 1234567890L; public static final long RANDOM_SEED = 1234567890L;
@Test @Test
public void testDefaultShuffleOrder() { public void defaultShuffleOrder() {
assertShuffleOrderCorrectness(new DefaultShuffleOrder(0, RANDOM_SEED), 0); assertShuffleOrderCorrectness(new DefaultShuffleOrder(0, RANDOM_SEED), 0);
assertShuffleOrderCorrectness(new DefaultShuffleOrder(1, RANDOM_SEED), 1); assertShuffleOrderCorrectness(new DefaultShuffleOrder(1, RANDOM_SEED), 1);
assertShuffleOrderCorrectness(new DefaultShuffleOrder(5, RANDOM_SEED), 5); assertShuffleOrderCorrectness(new DefaultShuffleOrder(5, RANDOM_SEED), 5);
...@@ -55,7 +55,7 @@ public final class ShuffleOrderTest { ...@@ -55,7 +55,7 @@ public final class ShuffleOrderTest {
} }
@Test @Test
public void testDefaultShuffleOrderSideloaded() { public void defaultShuffleOrderSideloaded() {
int[] shuffledIndices = new int[] {2, 1, 0, 4, 3}; int[] shuffledIndices = new int[] {2, 1, 0, 4, 3};
ShuffleOrder shuffleOrder = new DefaultShuffleOrder(shuffledIndices, RANDOM_SEED); ShuffleOrder shuffleOrder = new DefaultShuffleOrder(shuffledIndices, RANDOM_SEED);
assertThat(shuffleOrder.getFirstIndex()).isEqualTo(2); assertThat(shuffleOrder.getFirstIndex()).isEqualTo(2);
...@@ -72,7 +72,7 @@ public final class ShuffleOrderTest { ...@@ -72,7 +72,7 @@ public final class ShuffleOrderTest {
} }
@Test @Test
public void testUnshuffledShuffleOrder() { public void unshuffledShuffleOrder() {
assertShuffleOrderCorrectness(new UnshuffledShuffleOrder(0), 0); assertShuffleOrderCorrectness(new UnshuffledShuffleOrder(0), 0);
assertShuffleOrderCorrectness(new UnshuffledShuffleOrder(1), 1); assertShuffleOrderCorrectness(new UnshuffledShuffleOrder(1), 1);
assertShuffleOrderCorrectness(new UnshuffledShuffleOrder(5), 5); assertShuffleOrderCorrectness(new UnshuffledShuffleOrder(5), 5);
...@@ -95,7 +95,7 @@ public final class ShuffleOrderTest { ...@@ -95,7 +95,7 @@ public final class ShuffleOrderTest {
} }
@Test @Test
public void testUnshuffledShuffleOrderIsUnshuffled() { public void unshuffledShuffleOrderIsUnshuffled() {
ShuffleOrder shuffleOrder = new UnshuffledShuffleOrder(5); ShuffleOrder shuffleOrder = new UnshuffledShuffleOrder(5);
assertThat(shuffleOrder.getFirstIndex()).isEqualTo(0); assertThat(shuffleOrder.getFirstIndex()).isEqualTo(0);
assertThat(shuffleOrder.getLastIndex()).isEqualTo(4); assertThat(shuffleOrder.getLastIndex()).isEqualTo(4);
......
...@@ -40,7 +40,7 @@ public final class SinglePeriodTimelineTest { ...@@ -40,7 +40,7 @@ public final class SinglePeriodTimelineTest {
} }
@Test @Test
public void testGetPeriodPositionDynamicWindowUnknownDuration() { public void getPeriodPositionDynamicWindowUnknownDuration() {
SinglePeriodTimeline timeline = SinglePeriodTimeline timeline =
new SinglePeriodTimeline( new SinglePeriodTimeline(
C.TIME_UNSET, /* isSeekable= */ false, /* isDynamic= */ true, /* isLive= */ true); C.TIME_UNSET, /* isSeekable= */ false, /* isDynamic= */ true, /* isLive= */ true);
...@@ -54,7 +54,7 @@ public final class SinglePeriodTimelineTest { ...@@ -54,7 +54,7 @@ public final class SinglePeriodTimelineTest {
} }
@Test @Test
public void testGetPeriodPositionDynamicWindowKnownDuration() { public void getPeriodPositionDynamicWindowKnownDuration() {
long windowDurationUs = 1000; long windowDurationUs = 1000;
SinglePeriodTimeline timeline = SinglePeriodTimeline timeline =
new SinglePeriodTimeline( new SinglePeriodTimeline(
......
...@@ -29,7 +29,7 @@ import org.junit.runner.RunWith; ...@@ -29,7 +29,7 @@ import org.junit.runner.RunWith;
public final class TrackGroupArrayTest { public final class TrackGroupArrayTest {
@Test @Test
public void testParcelable() { public void parcelable() {
Format format1 = Format.createSampleFormat("1", MimeTypes.VIDEO_H264); Format format1 = Format.createSampleFormat("1", MimeTypes.VIDEO_H264);
Format format2 = Format.createSampleFormat("2", MimeTypes.AUDIO_AAC); Format format2 = Format.createSampleFormat("2", MimeTypes.AUDIO_AAC);
Format format3 = Format.createSampleFormat("3", MimeTypes.VIDEO_H264); Format format3 = Format.createSampleFormat("3", MimeTypes.VIDEO_H264);
......
...@@ -29,7 +29,7 @@ import org.junit.runner.RunWith; ...@@ -29,7 +29,7 @@ import org.junit.runner.RunWith;
public final class TrackGroupTest { public final class TrackGroupTest {
@Test @Test
public void testParcelable() { public void parcelable() {
Format format1 = Format.createSampleFormat("1", MimeTypes.VIDEO_H264); Format format1 = Format.createSampleFormat("1", MimeTypes.VIDEO_H264);
Format format2 = Format.createSampleFormat("2", MimeTypes.AUDIO_AAC); Format format2 = Format.createSampleFormat("2", MimeTypes.AUDIO_AAC);
......
...@@ -40,14 +40,14 @@ public final class AdPlaybackStateTest { ...@@ -40,14 +40,14 @@ public final class AdPlaybackStateTest {
} }
@Test @Test
public void testSetAdCount() { public void setAdCount() {
assertThat(state.adGroups[0].count).isEqualTo(C.LENGTH_UNSET); assertThat(state.adGroups[0].count).isEqualTo(C.LENGTH_UNSET);
state = state.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 1); state = state.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 1);
assertThat(state.adGroups[0].count).isEqualTo(1); assertThat(state.adGroups[0].count).isEqualTo(1);
} }
@Test @Test
public void testSetAdUriBeforeAdCount() { public void setAdUriBeforeAdCount() {
state = state.withAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 1, TEST_URI); state = state.withAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 1, TEST_URI);
state = state.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 2); state = state.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 2);
...@@ -58,7 +58,7 @@ public final class AdPlaybackStateTest { ...@@ -58,7 +58,7 @@ public final class AdPlaybackStateTest {
} }
@Test @Test
public void testSetAdErrorBeforeAdCount() { public void setAdErrorBeforeAdCount() {
state = state.withAdLoadError(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 0); state = state.withAdLoadError(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 0);
state = state.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 2); state = state.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 2);
...@@ -68,7 +68,7 @@ public final class AdPlaybackStateTest { ...@@ -68,7 +68,7 @@ public final class AdPlaybackStateTest {
} }
@Test @Test
public void testGetFirstAdIndexToPlayIsZero() { public void getFirstAdIndexToPlayIsZero() {
state = state.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 3); state = state.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 3);
state = state.withAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 0, TEST_URI); state = state.withAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 0, TEST_URI);
state = state.withAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 2, TEST_URI); state = state.withAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 2, TEST_URI);
...@@ -77,7 +77,7 @@ public final class AdPlaybackStateTest { ...@@ -77,7 +77,7 @@ public final class AdPlaybackStateTest {
} }
@Test @Test
public void testGetFirstAdIndexToPlaySkipsPlayedAd() { public void getFirstAdIndexToPlaySkipsPlayedAd() {
state = state.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 3); state = state.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 3);
state = state.withAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 0, TEST_URI); state = state.withAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 0, TEST_URI);
state = state.withAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 2, TEST_URI); state = state.withAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 2, TEST_URI);
...@@ -90,7 +90,7 @@ public final class AdPlaybackStateTest { ...@@ -90,7 +90,7 @@ public final class AdPlaybackStateTest {
} }
@Test @Test
public void testGetFirstAdIndexToPlaySkipsSkippedAd() { public void getFirstAdIndexToPlaySkipsSkippedAd() {
state = state.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 3); state = state.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 3);
state = state.withAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 0, TEST_URI); state = state.withAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 0, TEST_URI);
state = state.withAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 2, TEST_URI); state = state.withAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 2, TEST_URI);
...@@ -103,7 +103,7 @@ public final class AdPlaybackStateTest { ...@@ -103,7 +103,7 @@ public final class AdPlaybackStateTest {
} }
@Test @Test
public void testGetFirstAdIndexToPlaySkipsErrorAds() { public void getFirstAdIndexToPlaySkipsErrorAds() {
state = state.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 3); state = state.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 3);
state = state.withAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 0, TEST_URI); state = state.withAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 0, TEST_URI);
state = state.withAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 2, TEST_URI); state = state.withAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 2, TEST_URI);
...@@ -115,7 +115,7 @@ public final class AdPlaybackStateTest { ...@@ -115,7 +115,7 @@ public final class AdPlaybackStateTest {
} }
@Test @Test
public void testGetNextAdIndexToPlaySkipsErrorAds() { public void getNextAdIndexToPlaySkipsErrorAds() {
state = state.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 3); state = state.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 3);
state = state.withAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 1, TEST_URI); state = state.withAdUri(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 1, TEST_URI);
...@@ -125,7 +125,7 @@ public final class AdPlaybackStateTest { ...@@ -125,7 +125,7 @@ public final class AdPlaybackStateTest {
} }
@Test @Test
public void testSetAdStateTwiceThrows() { public void setAdStateTwiceThrows() {
state = state.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 1); state = state.withAdCount(/* adGroupIndex= */ 0, /* adCount= */ 1);
state = state.withPlayedAd(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 0); state = state.withPlayedAd(/* adGroupIndex= */ 0, /* adIndexInAdGroup= */ 0);
try { try {
...@@ -137,7 +137,7 @@ public final class AdPlaybackStateTest { ...@@ -137,7 +137,7 @@ public final class AdPlaybackStateTest {
} }
@Test @Test
public void testSkipAllWithoutAdCount() { public void skipAllWithoutAdCount() {
state = state.withSkippedAdGroup(0); state = state.withSkippedAdGroup(0);
state = state.withSkippedAdGroup(1); state = state.withSkippedAdGroup(1);
assertThat(state.adGroups[0].count).isEqualTo(0); assertThat(state.adGroups[0].count).isEqualTo(0);
......
...@@ -46,7 +46,7 @@ public final class SsaDecoderTest { ...@@ -46,7 +46,7 @@ public final class SsaDecoderTest {
private static final String POSITIONS_WITHOUT_PLAYRES = "ssa/positioning_without_playres"; private static final String POSITIONS_WITHOUT_PLAYRES = "ssa/positioning_without_playres";
@Test @Test
public void testDecodeEmpty() throws IOException { public void decodeEmpty() throws IOException {
SsaDecoder decoder = new SsaDecoder(); SsaDecoder decoder = new SsaDecoder();
byte[] bytes = TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), EMPTY); byte[] bytes = TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), EMPTY);
Subtitle subtitle = decoder.decode(bytes, bytes.length, false); Subtitle subtitle = decoder.decode(bytes, bytes.length, false);
...@@ -56,7 +56,7 @@ public final class SsaDecoderTest { ...@@ -56,7 +56,7 @@ public final class SsaDecoderTest {
} }
@Test @Test
public void testDecodeTypical() throws IOException { public void decodeTypical() throws IOException {
SsaDecoder decoder = new SsaDecoder(); SsaDecoder decoder = new SsaDecoder();
byte[] bytes = TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), TYPICAL); byte[] bytes = TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), TYPICAL);
Subtitle subtitle = decoder.decode(bytes, bytes.length, false); Subtitle subtitle = decoder.decode(bytes, bytes.length, false);
...@@ -81,7 +81,7 @@ public final class SsaDecoderTest { ...@@ -81,7 +81,7 @@ public final class SsaDecoderTest {
} }
@Test @Test
public void testDecodeTypicalWithInitializationData() throws IOException { public void decodeTypicalWithInitializationData() throws IOException {
byte[] headerBytes = byte[] headerBytes =
TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), TYPICAL_HEADER_ONLY); TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), TYPICAL_HEADER_ONLY);
byte[] formatBytes = byte[] formatBytes =
...@@ -101,7 +101,7 @@ public final class SsaDecoderTest { ...@@ -101,7 +101,7 @@ public final class SsaDecoderTest {
} }
@Test @Test
public void testDecodeOverlappingTimecodes() throws IOException { public void decodeOverlappingTimecodes() throws IOException {
SsaDecoder decoder = new SsaDecoder(); SsaDecoder decoder = new SsaDecoder();
byte[] bytes = byte[] bytes =
TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), OVERLAPPING_TIMECODES); TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), OVERLAPPING_TIMECODES);
...@@ -151,7 +151,7 @@ public final class SsaDecoderTest { ...@@ -151,7 +151,7 @@ public final class SsaDecoderTest {
} }
@Test @Test
public void testDecodePositions() throws IOException { public void decodePositions() throws IOException {
SsaDecoder decoder = new SsaDecoder(); SsaDecoder decoder = new SsaDecoder();
byte[] bytes = TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), POSITIONS); byte[] bytes = TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), POSITIONS);
Subtitle subtitle = decoder.decode(bytes, bytes.length, false); Subtitle subtitle = decoder.decode(bytes, bytes.length, false);
...@@ -204,7 +204,7 @@ public final class SsaDecoderTest { ...@@ -204,7 +204,7 @@ public final class SsaDecoderTest {
} }
@Test @Test
public void testDecodeInvalidPositions() throws IOException { public void decodeInvalidPositions() throws IOException {
SsaDecoder decoder = new SsaDecoder(); SsaDecoder decoder = new SsaDecoder();
byte[] bytes = byte[] bytes =
TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), INVALID_POSITIONS); TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), INVALID_POSITIONS);
...@@ -240,7 +240,7 @@ public final class SsaDecoderTest { ...@@ -240,7 +240,7 @@ public final class SsaDecoderTest {
} }
@Test @Test
public void testDecodePositionsWithMissingPlayResY() throws IOException { public void decodePositionsWithMissingPlayResY() throws IOException {
SsaDecoder decoder = new SsaDecoder(); SsaDecoder decoder = new SsaDecoder();
byte[] bytes = byte[] bytes =
TestUtil.getByteArray( TestUtil.getByteArray(
...@@ -256,7 +256,7 @@ public final class SsaDecoderTest { ...@@ -256,7 +256,7 @@ public final class SsaDecoderTest {
} }
@Test @Test
public void testDecodeInvalidTimecodes() throws IOException { public void decodeInvalidTimecodes() throws IOException {
// Parsing should succeed, parsing the third cue only. // Parsing should succeed, parsing the third cue only.
SsaDecoder decoder = new SsaDecoder(); SsaDecoder decoder = new SsaDecoder();
byte[] bytes = byte[] bytes =
......
...@@ -41,7 +41,7 @@ public final class SubripDecoderTest { ...@@ -41,7 +41,7 @@ public final class SubripDecoderTest {
private static final String TYPICAL_WITH_TAGS = "subrip/typical_with_tags"; private static final String TYPICAL_WITH_TAGS = "subrip/typical_with_tags";
@Test @Test
public void testDecodeEmpty() throws IOException { public void decodeEmpty() throws IOException {
SubripDecoder decoder = new SubripDecoder(); SubripDecoder decoder = new SubripDecoder();
byte[] bytes = TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), EMPTY_FILE); byte[] bytes = TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), EMPTY_FILE);
Subtitle subtitle = decoder.decode(bytes, bytes.length, false); Subtitle subtitle = decoder.decode(bytes, bytes.length, false);
...@@ -51,7 +51,7 @@ public final class SubripDecoderTest { ...@@ -51,7 +51,7 @@ public final class SubripDecoderTest {
} }
@Test @Test
public void testDecodeTypical() throws IOException { public void decodeTypical() throws IOException {
SubripDecoder decoder = new SubripDecoder(); SubripDecoder decoder = new SubripDecoder();
byte[] bytes = TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), TYPICAL_FILE); byte[] bytes = TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), TYPICAL_FILE);
Subtitle subtitle = decoder.decode(bytes, bytes.length, false); Subtitle subtitle = decoder.decode(bytes, bytes.length, false);
...@@ -63,7 +63,7 @@ public final class SubripDecoderTest { ...@@ -63,7 +63,7 @@ public final class SubripDecoderTest {
} }
@Test @Test
public void testDecodeTypicalWithByteOrderMark() throws IOException { public void decodeTypicalWithByteOrderMark() throws IOException {
SubripDecoder decoder = new SubripDecoder(); SubripDecoder decoder = new SubripDecoder();
byte[] bytes = byte[] bytes =
TestUtil.getByteArray( TestUtil.getByteArray(
...@@ -77,7 +77,7 @@ public final class SubripDecoderTest { ...@@ -77,7 +77,7 @@ public final class SubripDecoderTest {
} }
@Test @Test
public void testDecodeTypicalExtraBlankLine() throws IOException { public void decodeTypicalExtraBlankLine() throws IOException {
SubripDecoder decoder = new SubripDecoder(); SubripDecoder decoder = new SubripDecoder();
byte[] bytes = byte[] bytes =
TestUtil.getByteArray( TestUtil.getByteArray(
...@@ -91,7 +91,7 @@ public final class SubripDecoderTest { ...@@ -91,7 +91,7 @@ public final class SubripDecoderTest {
} }
@Test @Test
public void testDecodeTypicalMissingTimecode() throws IOException { public void decodeTypicalMissingTimecode() throws IOException {
// Parsing should succeed, parsing the first and third cues only. // Parsing should succeed, parsing the first and third cues only.
SubripDecoder decoder = new SubripDecoder(); SubripDecoder decoder = new SubripDecoder();
byte[] bytes = byte[] bytes =
...@@ -105,7 +105,7 @@ public final class SubripDecoderTest { ...@@ -105,7 +105,7 @@ public final class SubripDecoderTest {
} }
@Test @Test
public void testDecodeTypicalMissingSequence() throws IOException { public void decodeTypicalMissingSequence() throws IOException {
// Parsing should succeed, parsing the first and third cues only. // Parsing should succeed, parsing the first and third cues only.
SubripDecoder decoder = new SubripDecoder(); SubripDecoder decoder = new SubripDecoder();
byte[] bytes = byte[] bytes =
...@@ -119,7 +119,7 @@ public final class SubripDecoderTest { ...@@ -119,7 +119,7 @@ public final class SubripDecoderTest {
} }
@Test @Test
public void testDecodeTypicalNegativeTimestamps() throws IOException { public void decodeTypicalNegativeTimestamps() throws IOException {
// Parsing should succeed, parsing the third cue only. // Parsing should succeed, parsing the third cue only.
SubripDecoder decoder = new SubripDecoder(); SubripDecoder decoder = new SubripDecoder();
byte[] bytes = byte[] bytes =
...@@ -132,7 +132,7 @@ public final class SubripDecoderTest { ...@@ -132,7 +132,7 @@ public final class SubripDecoderTest {
} }
@Test @Test
public void testDecodeTypicalUnexpectedEnd() throws IOException { public void decodeTypicalUnexpectedEnd() throws IOException {
// Parsing should succeed, parsing the first and second cues only. // Parsing should succeed, parsing the first and second cues only.
SubripDecoder decoder = new SubripDecoder(); SubripDecoder decoder = new SubripDecoder();
byte[] bytes = byte[] bytes =
...@@ -145,7 +145,7 @@ public final class SubripDecoderTest { ...@@ -145,7 +145,7 @@ public final class SubripDecoderTest {
} }
@Test @Test
public void testDecodeCueWithTag() throws IOException { public void decodeCueWithTag() throws IOException {
SubripDecoder decoder = new SubripDecoder(); SubripDecoder decoder = new SubripDecoder();
byte[] bytes = byte[] bytes =
TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), TYPICAL_WITH_TAGS); TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), TYPICAL_WITH_TAGS);
......
...@@ -65,7 +65,7 @@ public final class TtmlDecoderTest { ...@@ -65,7 +65,7 @@ public final class TtmlDecoderTest {
private static final String RUBIES_FILE = "ttml/rubies.xml"; private static final String RUBIES_FILE = "ttml/rubies.xml";
@Test @Test
public void testInlineAttributes() throws IOException, SubtitleDecoderException { public void inlineAttributes() throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(INLINE_ATTRIBUTES_TTML_FILE); TtmlSubtitle subtitle = getSubtitle(INLINE_ATTRIBUTES_TTML_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(4); assertThat(subtitle.getEventTimeCount()).isEqualTo(4);
...@@ -84,7 +84,7 @@ public final class TtmlDecoderTest { ...@@ -84,7 +84,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testInheritInlineAttributes() throws IOException, SubtitleDecoderException { public void inheritInlineAttributes() throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(INLINE_ATTRIBUTES_TTML_FILE); TtmlSubtitle subtitle = getSubtitle(INLINE_ATTRIBUTES_TTML_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(4); assertThat(subtitle.getEventTimeCount()).isEqualTo(4);
...@@ -113,7 +113,7 @@ public final class TtmlDecoderTest { ...@@ -113,7 +113,7 @@ public final class TtmlDecoderTest {
* @throws IOException thrown if reading subtitle file fails. * @throws IOException thrown if reading subtitle file fails.
*/ */
@Test @Test
public void testLime() throws IOException, SubtitleDecoderException { public void lime() throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(INLINE_ATTRIBUTES_TTML_FILE); TtmlSubtitle subtitle = getSubtitle(INLINE_ATTRIBUTES_TTML_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(4); assertThat(subtitle.getEventTimeCount()).isEqualTo(4);
...@@ -128,7 +128,7 @@ public final class TtmlDecoderTest { ...@@ -128,7 +128,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testInheritGlobalStyle() throws IOException, SubtitleDecoderException { public void inheritGlobalStyle() throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(INHERIT_STYLE_TTML_FILE); TtmlSubtitle subtitle = getSubtitle(INHERIT_STYLE_TTML_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(2); assertThat(subtitle.getEventTimeCount()).isEqualTo(2);
...@@ -143,7 +143,7 @@ public final class TtmlDecoderTest { ...@@ -143,7 +143,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testInheritGlobalStyleOverriddenByInlineAttributes() public void inheritGlobalStyleOverriddenByInlineAttributes()
throws IOException, SubtitleDecoderException { throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(INHERIT_STYLE_OVERRIDE_TTML_FILE); TtmlSubtitle subtitle = getSubtitle(INHERIT_STYLE_OVERRIDE_TTML_FILE);
...@@ -177,7 +177,7 @@ public final class TtmlDecoderTest { ...@@ -177,7 +177,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testInheritGlobalAndParent() throws IOException, SubtitleDecoderException { public void inheritGlobalAndParent() throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(INHERIT_GLOBAL_AND_PARENT_TTML_FILE); TtmlSubtitle subtitle = getSubtitle(INHERIT_GLOBAL_AND_PARENT_TTML_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(4); assertThat(subtitle.getEventTimeCount()).isEqualTo(4);
...@@ -216,7 +216,7 @@ public final class TtmlDecoderTest { ...@@ -216,7 +216,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testInheritMultipleStyles() throws IOException, SubtitleDecoderException { public void inheritMultipleStyles() throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(INHERIT_MULTIPLE_STYLES_TTML_FILE); TtmlSubtitle subtitle = getSubtitle(INHERIT_MULTIPLE_STYLES_TTML_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(12); assertThat(subtitle.getEventTimeCount()).isEqualTo(12);
...@@ -231,7 +231,7 @@ public final class TtmlDecoderTest { ...@@ -231,7 +231,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testInheritMultipleStylesWithoutLocalAttributes() public void inheritMultipleStylesWithoutLocalAttributes()
throws IOException, SubtitleDecoderException { throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(INHERIT_MULTIPLE_STYLES_TTML_FILE); TtmlSubtitle subtitle = getSubtitle(INHERIT_MULTIPLE_STYLES_TTML_FILE);
...@@ -253,8 +253,7 @@ public final class TtmlDecoderTest { ...@@ -253,8 +253,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testMergeMultipleStylesWithParentStyle() public void mergeMultipleStylesWithParentStyle() throws IOException, SubtitleDecoderException {
throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(INHERIT_MULTIPLE_STYLES_TTML_FILE); TtmlSubtitle subtitle = getSubtitle(INHERIT_MULTIPLE_STYLES_TTML_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(12); assertThat(subtitle.getEventTimeCount()).isEqualTo(12);
...@@ -276,7 +275,7 @@ public final class TtmlDecoderTest { ...@@ -276,7 +275,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testMultipleRegions() throws IOException, SubtitleDecoderException { public void multipleRegions() throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(MULTIPLE_REGIONS_TTML_FILE); TtmlSubtitle subtitle = getSubtitle(MULTIPLE_REGIONS_TTML_FILE);
List<Cue> cues = subtitle.getCues(1_000_000); List<Cue> cues = subtitle.getCues(1_000_000);
...@@ -325,7 +324,7 @@ public final class TtmlDecoderTest { ...@@ -325,7 +324,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testEmptyStyleAttribute() throws IOException, SubtitleDecoderException { public void emptyStyleAttribute() throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(INHERIT_MULTIPLE_STYLES_TTML_FILE); TtmlSubtitle subtitle = getSubtitle(INHERIT_MULTIPLE_STYLES_TTML_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(12); assertThat(subtitle.getEventTimeCount()).isEqualTo(12);
...@@ -338,7 +337,7 @@ public final class TtmlDecoderTest { ...@@ -338,7 +337,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testNonexistingStyleId() throws IOException, SubtitleDecoderException { public void nonexistingStyleId() throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(INHERIT_MULTIPLE_STYLES_TTML_FILE); TtmlSubtitle subtitle = getSubtitle(INHERIT_MULTIPLE_STYLES_TTML_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(12); assertThat(subtitle.getEventTimeCount()).isEqualTo(12);
...@@ -351,7 +350,7 @@ public final class TtmlDecoderTest { ...@@ -351,7 +350,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testNonExistingAndExistingStyleIdWithRedundantSpaces() public void nonExistingAndExistingStyleIdWithRedundantSpaces()
throws IOException, SubtitleDecoderException { throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(INHERIT_MULTIPLE_STYLES_TTML_FILE); TtmlSubtitle subtitle = getSubtitle(INHERIT_MULTIPLE_STYLES_TTML_FILE);
...@@ -366,7 +365,7 @@ public final class TtmlDecoderTest { ...@@ -366,7 +365,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testMultipleChaining() throws IOException, SubtitleDecoderException { public void multipleChaining() throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(CHAIN_MULTIPLE_STYLES_TTML_FILE); TtmlSubtitle subtitle = getSubtitle(CHAIN_MULTIPLE_STYLES_TTML_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(2); assertThat(subtitle.getEventTimeCount()).isEqualTo(2);
...@@ -390,7 +389,7 @@ public final class TtmlDecoderTest { ...@@ -390,7 +389,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testNoUnderline() throws IOException, SubtitleDecoderException { public void noUnderline() throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(NO_UNDERLINE_LINETHROUGH_TTML_FILE); TtmlSubtitle subtitle = getSubtitle(NO_UNDERLINE_LINETHROUGH_TTML_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(4); assertThat(subtitle.getEventTimeCount()).isEqualTo(4);
...@@ -406,7 +405,7 @@ public final class TtmlDecoderTest { ...@@ -406,7 +405,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testNoLinethrough() throws IOException, SubtitleDecoderException { public void noLinethrough() throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(NO_UNDERLINE_LINETHROUGH_TTML_FILE); TtmlSubtitle subtitle = getSubtitle(NO_UNDERLINE_LINETHROUGH_TTML_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(4); assertThat(subtitle.getEventTimeCount()).isEqualTo(4);
...@@ -422,7 +421,7 @@ public final class TtmlDecoderTest { ...@@ -422,7 +421,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testFontSizeSpans() throws IOException, SubtitleDecoderException { public void fontSizeSpans() throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(FONT_SIZE_TTML_FILE); TtmlSubtitle subtitle = getSubtitle(FONT_SIZE_TTML_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(10); assertThat(subtitle.getEventTimeCount()).isEqualTo(10);
...@@ -449,7 +448,7 @@ public final class TtmlDecoderTest { ...@@ -449,7 +448,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testFontSizeWithMissingUnitIsIgnored() throws IOException, SubtitleDecoderException { public void fontSizeWithMissingUnitIsIgnored() throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(FONT_SIZE_MISSING_UNIT_TTML_FILE); TtmlSubtitle subtitle = getSubtitle(FONT_SIZE_MISSING_UNIT_TTML_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(2); assertThat(subtitle.getEventTimeCount()).isEqualTo(2);
...@@ -461,7 +460,7 @@ public final class TtmlDecoderTest { ...@@ -461,7 +460,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testFontSizeWithInvalidValueIsIgnored() throws IOException, SubtitleDecoderException { public void fontSizeWithInvalidValueIsIgnored() throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(FONT_SIZE_INVALID_TTML_FILE); TtmlSubtitle subtitle = getSubtitle(FONT_SIZE_INVALID_TTML_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(6); assertThat(subtitle.getEventTimeCount()).isEqualTo(6);
...@@ -483,7 +482,7 @@ public final class TtmlDecoderTest { ...@@ -483,7 +482,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testFontSizeWithEmptyValueIsIgnored() throws IOException, SubtitleDecoderException { public void fontSizeWithEmptyValueIsIgnored() throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(FONT_SIZE_EMPTY_TTML_FILE); TtmlSubtitle subtitle = getSubtitle(FONT_SIZE_EMPTY_TTML_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(2); assertThat(subtitle.getEventTimeCount()).isEqualTo(2);
...@@ -495,7 +494,7 @@ public final class TtmlDecoderTest { ...@@ -495,7 +494,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testFrameRate() throws IOException, SubtitleDecoderException { public void frameRate() throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(FRAME_RATE_TTML_FILE); TtmlSubtitle subtitle = getSubtitle(FRAME_RATE_TTML_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(4); assertThat(subtitle.getEventTimeCount()).isEqualTo(4);
...@@ -506,7 +505,7 @@ public final class TtmlDecoderTest { ...@@ -506,7 +505,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testBitmapPercentageRegion() throws IOException, SubtitleDecoderException { public void bitmapPercentageRegion() throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(BITMAP_REGION_FILE); TtmlSubtitle subtitle = getSubtitle(BITMAP_REGION_FILE);
Cue cue = getOnlyCueAtTimeUs(subtitle, 1_000_000); Cue cue = getOnlyCueAtTimeUs(subtitle, 1_000_000);
...@@ -535,7 +534,7 @@ public final class TtmlDecoderTest { ...@@ -535,7 +534,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testBitmapPixelRegion() throws IOException, SubtitleDecoderException { public void bitmapPixelRegion() throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(BITMAP_PIXEL_REGION_FILE); TtmlSubtitle subtitle = getSubtitle(BITMAP_PIXEL_REGION_FILE);
Cue cue = getOnlyCueAtTimeUs(subtitle, 1_000_000); Cue cue = getOnlyCueAtTimeUs(subtitle, 1_000_000);
...@@ -556,7 +555,7 @@ public final class TtmlDecoderTest { ...@@ -556,7 +555,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testBitmapUnsupportedRegion() throws IOException, SubtitleDecoderException { public void bitmapUnsupportedRegion() throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(BITMAP_UNSUPPORTED_REGION_FILE); TtmlSubtitle subtitle = getSubtitle(BITMAP_UNSUPPORTED_REGION_FILE);
Cue cue = getOnlyCueAtTimeUs(subtitle, 1_000_000); Cue cue = getOnlyCueAtTimeUs(subtitle, 1_000_000);
...@@ -577,7 +576,7 @@ public final class TtmlDecoderTest { ...@@ -577,7 +576,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testVerticalText() throws IOException, SubtitleDecoderException { public void verticalText() throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(VERTICAL_TEXT_FILE); TtmlSubtitle subtitle = getSubtitle(VERTICAL_TEXT_FILE);
Cue firstCue = getOnlyCueAtTimeUs(subtitle, 10_000_000); Cue firstCue = getOnlyCueAtTimeUs(subtitle, 10_000_000);
...@@ -591,7 +590,7 @@ public final class TtmlDecoderTest { ...@@ -591,7 +590,7 @@ public final class TtmlDecoderTest {
} }
@Test @Test
public void testTextCombine() throws IOException, SubtitleDecoderException { public void textCombine() throws IOException, SubtitleDecoderException {
TtmlSubtitle subtitle = getSubtitle(TEXT_COMBINE_FILE); TtmlSubtitle subtitle = getSubtitle(TEXT_COMBINE_FILE);
Spanned firstCue = getOnlyCueTextAtTimeUs(subtitle, 10_000_000); Spanned firstCue = getOnlyCueTextAtTimeUs(subtitle, 10_000_000);
......
...@@ -35,12 +35,12 @@ import org.junit.runner.RunWith; ...@@ -35,12 +35,12 @@ import org.junit.runner.RunWith;
public final class TtmlRenderUtilTest { public final class TtmlRenderUtilTest {
@Test @Test
public void testResolveStyleNoStyleAtAll() { public void resolveStyleNoStyleAtAll() {
assertThat(resolveStyle(null, null, null)).isNull(); assertThat(resolveStyle(null, null, null)).isNull();
} }
@Test @Test
public void testResolveStyleSingleReferentialStyle() { public void resolveStyleSingleReferentialStyle() {
Map<String, TtmlStyle> globalStyles = getGlobalStyles(); Map<String, TtmlStyle> globalStyles = getGlobalStyles();
String[] styleIds = {"s0"}; String[] styleIds = {"s0"};
...@@ -49,7 +49,7 @@ public final class TtmlRenderUtilTest { ...@@ -49,7 +49,7 @@ public final class TtmlRenderUtilTest {
} }
@Test @Test
public void testResolveStyleMultipleReferentialStyles() { public void resolveStyleMultipleReferentialStyles() {
Map<String, TtmlStyle> globalStyles = getGlobalStyles(); Map<String, TtmlStyle> globalStyles = getGlobalStyles();
String[] styleIds = {"s0", "s1"}; String[] styleIds = {"s0", "s1"};
...@@ -67,7 +67,7 @@ public final class TtmlRenderUtilTest { ...@@ -67,7 +67,7 @@ public final class TtmlRenderUtilTest {
} }
@Test @Test
public void testResolveMergeSingleReferentialStyleIntoInlineStyle() { public void resolveMergeSingleReferentialStyleIntoInlineStyle() {
Map<String, TtmlStyle> globalStyles = getGlobalStyles(); Map<String, TtmlStyle> globalStyles = getGlobalStyles();
String[] styleIds = {"s0"}; String[] styleIds = {"s0"};
TtmlStyle style = new TtmlStyle(); TtmlStyle style = new TtmlStyle();
...@@ -83,7 +83,7 @@ public final class TtmlRenderUtilTest { ...@@ -83,7 +83,7 @@ public final class TtmlRenderUtilTest {
} }
@Test @Test
public void testResolveMergeMultipleReferentialStylesIntoInlineStyle() { public void resolveMergeMultipleReferentialStylesIntoInlineStyle() {
Map<String, TtmlStyle> globalStyles = getGlobalStyles(); Map<String, TtmlStyle> globalStyles = getGlobalStyles();
String[] styleIds = {"s0", "s1"}; String[] styleIds = {"s0", "s1"};
TtmlStyle style = new TtmlStyle(); TtmlStyle style = new TtmlStyle();
...@@ -99,7 +99,7 @@ public final class TtmlRenderUtilTest { ...@@ -99,7 +99,7 @@ public final class TtmlRenderUtilTest {
} }
@Test @Test
public void testResolveStyleOnlyInlineStyle() { public void resolveStyleOnlyInlineStyle() {
TtmlStyle inlineStyle = new TtmlStyle(); TtmlStyle inlineStyle = new TtmlStyle();
assertThat(TtmlRenderUtil.resolveStyle(inlineStyle, null, null)).isSameInstanceAs(inlineStyle); assertThat(TtmlRenderUtil.resolveStyle(inlineStyle, null, null)).isSameInstanceAs(inlineStyle);
} }
......
...@@ -68,7 +68,7 @@ public final class TtmlStyleTest { ...@@ -68,7 +68,7 @@ public final class TtmlStyleTest {
.setVerticalType(VERTICAL_TYPE); .setVerticalType(VERTICAL_TYPE);
@Test @Test
public void testInheritStyle() { public void inheritStyle() {
TtmlStyle style = new TtmlStyle(); TtmlStyle style = new TtmlStyle();
style.inherit(populatedStyle); style.inherit(populatedStyle);
...@@ -95,7 +95,7 @@ public final class TtmlStyleTest { ...@@ -95,7 +95,7 @@ public final class TtmlStyleTest {
} }
@Test @Test
public void testChainStyle() { public void chainStyle() {
TtmlStyle style = new TtmlStyle(); TtmlStyle style = new TtmlStyle();
style.chain(populatedStyle); style.chain(populatedStyle);
...@@ -121,7 +121,7 @@ public final class TtmlStyleTest { ...@@ -121,7 +121,7 @@ public final class TtmlStyleTest {
} }
@Test @Test
public void testStyle() { public void style() {
TtmlStyle style = new TtmlStyle(); TtmlStyle style = new TtmlStyle();
assertThat(style.getStyle()).isEqualTo(UNSPECIFIED); assertThat(style.getStyle()).isEqualTo(UNSPECIFIED);
...@@ -136,7 +136,7 @@ public final class TtmlStyleTest { ...@@ -136,7 +136,7 @@ public final class TtmlStyleTest {
} }
@Test @Test
public void testLinethrough() { public void linethrough() {
TtmlStyle style = new TtmlStyle(); TtmlStyle style = new TtmlStyle();
assertThat(style.isLinethrough()).isFalse(); assertThat(style.isLinethrough()).isFalse();
...@@ -147,7 +147,7 @@ public final class TtmlStyleTest { ...@@ -147,7 +147,7 @@ public final class TtmlStyleTest {
} }
@Test @Test
public void testUnderline() { public void underline() {
TtmlStyle style = new TtmlStyle(); TtmlStyle style = new TtmlStyle();
assertThat(style.isUnderline()).isFalse(); assertThat(style.isUnderline()).isFalse();
...@@ -158,7 +158,7 @@ public final class TtmlStyleTest { ...@@ -158,7 +158,7 @@ public final class TtmlStyleTest {
} }
@Test @Test
public void testFontFamily() { public void fontFamily() {
TtmlStyle style = new TtmlStyle(); TtmlStyle style = new TtmlStyle();
assertThat(style.getFontFamily()).isNull(); assertThat(style.getFontFamily()).isNull();
...@@ -169,7 +169,7 @@ public final class TtmlStyleTest { ...@@ -169,7 +169,7 @@ public final class TtmlStyleTest {
} }
@Test @Test
public void testFontColor() { public void fontColor() {
TtmlStyle style = new TtmlStyle(); TtmlStyle style = new TtmlStyle();
assertThat(style.hasFontColor()).isFalse(); assertThat(style.hasFontColor()).isFalse();
...@@ -179,7 +179,7 @@ public final class TtmlStyleTest { ...@@ -179,7 +179,7 @@ public final class TtmlStyleTest {
} }
@Test @Test
public void testFontSize() { public void fontSize() {
TtmlStyle style = new TtmlStyle(); TtmlStyle style = new TtmlStyle();
assertThat(style.getFontSize()).isEqualTo(0); assertThat(style.getFontSize()).isEqualTo(0);
...@@ -188,7 +188,7 @@ public final class TtmlStyleTest { ...@@ -188,7 +188,7 @@ public final class TtmlStyleTest {
} }
@Test @Test
public void testFontSizeUnit() { public void fontSizeUnit() {
TtmlStyle style = new TtmlStyle(); TtmlStyle style = new TtmlStyle();
assertThat(style.getFontSizeUnit()).isEqualTo(UNSPECIFIED); assertThat(style.getFontSizeUnit()).isEqualTo(UNSPECIFIED);
...@@ -197,7 +197,7 @@ public final class TtmlStyleTest { ...@@ -197,7 +197,7 @@ public final class TtmlStyleTest {
} }
@Test @Test
public void testBackgroundColor() { public void backgroundColor() {
TtmlStyle style = new TtmlStyle(); TtmlStyle style = new TtmlStyle();
assertThat(style.hasBackgroundColor()).isFalse(); assertThat(style.hasBackgroundColor()).isFalse();
...@@ -207,7 +207,7 @@ public final class TtmlStyleTest { ...@@ -207,7 +207,7 @@ public final class TtmlStyleTest {
} }
@Test @Test
public void testId() { public void id() {
TtmlStyle style = new TtmlStyle(); TtmlStyle style = new TtmlStyle();
assertThat(style.getId()).isNull(); assertThat(style.getId()).isNull();
...@@ -236,7 +236,7 @@ public final class TtmlStyleTest { ...@@ -236,7 +236,7 @@ public final class TtmlStyleTest {
} }
@Test @Test
public void testTextAlign() { public void textAlign() {
TtmlStyle style = new TtmlStyle(); TtmlStyle style = new TtmlStyle();
assertThat(style.getTextAlign()).isNull(); assertThat(style.getTextAlign()).isNull();
...@@ -247,7 +247,7 @@ public final class TtmlStyleTest { ...@@ -247,7 +247,7 @@ public final class TtmlStyleTest {
} }
@Test @Test
public void testTextCombine() { public void textCombine() {
TtmlStyle style = new TtmlStyle(); TtmlStyle style = new TtmlStyle();
assertThat(style.getTextCombine()).isFalse(); assertThat(style.getTextCombine()).isFalse();
......
...@@ -54,7 +54,7 @@ public final class Tx3gDecoderTest { ...@@ -54,7 +54,7 @@ public final class Tx3gDecoderTest {
private static final String INITIALIZATION_ALL_DEFAULTS = "tx3g/initialization_all_defaults"; private static final String INITIALIZATION_ALL_DEFAULTS = "tx3g/initialization_all_defaults";
@Test @Test
public void testDecodeNoSubtitle() throws IOException, SubtitleDecoderException { public void decodeNoSubtitle() throws IOException, SubtitleDecoderException {
Tx3gDecoder decoder = new Tx3gDecoder(Collections.emptyList()); Tx3gDecoder decoder = new Tx3gDecoder(Collections.emptyList());
byte[] bytes = TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), NO_SUBTITLE); byte[] bytes = TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), NO_SUBTITLE);
Subtitle subtitle = decoder.decode(bytes, bytes.length, false); Subtitle subtitle = decoder.decode(bytes, bytes.length, false);
...@@ -62,7 +62,7 @@ public final class Tx3gDecoderTest { ...@@ -62,7 +62,7 @@ public final class Tx3gDecoderTest {
} }
@Test @Test
public void testDecodeJustText() throws IOException, SubtitleDecoderException { public void decodeJustText() throws IOException, SubtitleDecoderException {
Tx3gDecoder decoder = new Tx3gDecoder(Collections.emptyList()); Tx3gDecoder decoder = new Tx3gDecoder(Collections.emptyList());
byte[] bytes = byte[] bytes =
TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), SAMPLE_JUST_TEXT); TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), SAMPLE_JUST_TEXT);
...@@ -74,7 +74,7 @@ public final class Tx3gDecoderTest { ...@@ -74,7 +74,7 @@ public final class Tx3gDecoderTest {
} }
@Test @Test
public void testDecodeWithStyl() throws IOException, SubtitleDecoderException { public void decodeWithStyl() throws IOException, SubtitleDecoderException {
Tx3gDecoder decoder = new Tx3gDecoder(Collections.emptyList()); Tx3gDecoder decoder = new Tx3gDecoder(Collections.emptyList());
byte[] bytes = byte[] bytes =
TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), SAMPLE_WITH_STYL); TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), SAMPLE_WITH_STYL);
...@@ -91,7 +91,7 @@ public final class Tx3gDecoderTest { ...@@ -91,7 +91,7 @@ public final class Tx3gDecoderTest {
} }
@Test @Test
public void testDecodeWithStylAllDefaults() throws IOException, SubtitleDecoderException { public void decodeWithStylAllDefaults() throws IOException, SubtitleDecoderException {
Tx3gDecoder decoder = new Tx3gDecoder(Collections.emptyList()); Tx3gDecoder decoder = new Tx3gDecoder(Collections.emptyList());
byte[] bytes = byte[] bytes =
TestUtil.getByteArray( TestUtil.getByteArray(
...@@ -104,7 +104,7 @@ public final class Tx3gDecoderTest { ...@@ -104,7 +104,7 @@ public final class Tx3gDecoderTest {
} }
@Test @Test
public void testDecodeUtf16BeNoStyl() throws IOException, SubtitleDecoderException { public void decodeUtf16BeNoStyl() throws IOException, SubtitleDecoderException {
Tx3gDecoder decoder = new Tx3gDecoder(Collections.emptyList()); Tx3gDecoder decoder = new Tx3gDecoder(Collections.emptyList());
byte[] bytes = byte[] bytes =
TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), SAMPLE_UTF16_BE_NO_STYL); TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), SAMPLE_UTF16_BE_NO_STYL);
...@@ -116,7 +116,7 @@ public final class Tx3gDecoderTest { ...@@ -116,7 +116,7 @@ public final class Tx3gDecoderTest {
} }
@Test @Test
public void testDecodeUtf16LeNoStyl() throws IOException, SubtitleDecoderException { public void decodeUtf16LeNoStyl() throws IOException, SubtitleDecoderException {
Tx3gDecoder decoder = new Tx3gDecoder(Collections.emptyList()); Tx3gDecoder decoder = new Tx3gDecoder(Collections.emptyList());
byte[] bytes = byte[] bytes =
TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), SAMPLE_UTF16_LE_NO_STYL); TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), SAMPLE_UTF16_LE_NO_STYL);
...@@ -128,7 +128,7 @@ public final class Tx3gDecoderTest { ...@@ -128,7 +128,7 @@ public final class Tx3gDecoderTest {
} }
@Test @Test
public void testDecodeWithMultipleStyl() throws IOException, SubtitleDecoderException { public void decodeWithMultipleStyl() throws IOException, SubtitleDecoderException {
Tx3gDecoder decoder = new Tx3gDecoder(Collections.emptyList()); Tx3gDecoder decoder = new Tx3gDecoder(Collections.emptyList());
byte[] bytes = byte[] bytes =
TestUtil.getByteArray( TestUtil.getByteArray(
...@@ -148,7 +148,7 @@ public final class Tx3gDecoderTest { ...@@ -148,7 +148,7 @@ public final class Tx3gDecoderTest {
} }
@Test @Test
public void testDecodeWithOtherExtension() throws IOException, SubtitleDecoderException { public void decodeWithOtherExtension() throws IOException, SubtitleDecoderException {
Tx3gDecoder decoder = new Tx3gDecoder(Collections.emptyList()); Tx3gDecoder decoder = new Tx3gDecoder(Collections.emptyList());
byte[] bytes = byte[] bytes =
TestUtil.getByteArray( TestUtil.getByteArray(
...@@ -165,7 +165,7 @@ public final class Tx3gDecoderTest { ...@@ -165,7 +165,7 @@ public final class Tx3gDecoderTest {
} }
@Test @Test
public void testInitializationDecodeWithStyl() throws IOException, SubtitleDecoderException { public void initializationDecodeWithStyl() throws IOException, SubtitleDecoderException {
byte[] initBytes = byte[] initBytes =
TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), INITIALIZATION); TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), INITIALIZATION);
Tx3gDecoder decoder = new Tx3gDecoder(Collections.singletonList(initBytes)); Tx3gDecoder decoder = new Tx3gDecoder(Collections.singletonList(initBytes));
...@@ -188,7 +188,7 @@ public final class Tx3gDecoderTest { ...@@ -188,7 +188,7 @@ public final class Tx3gDecoderTest {
} }
@Test @Test
public void testInitializationDecodeWithTbox() throws IOException, SubtitleDecoderException { public void initializationDecodeWithTbox() throws IOException, SubtitleDecoderException {
byte[] initBytes = byte[] initBytes =
TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), INITIALIZATION); TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), INITIALIZATION);
Tx3gDecoder decoder = new Tx3gDecoder(Collections.singletonList(initBytes)); Tx3gDecoder decoder = new Tx3gDecoder(Collections.singletonList(initBytes));
...@@ -209,7 +209,7 @@ public final class Tx3gDecoderTest { ...@@ -209,7 +209,7 @@ public final class Tx3gDecoderTest {
} }
@Test @Test
public void testInitializationAllDefaultsDecodeWithStyl() public void initializationAllDefaultsDecodeWithStyl()
throws IOException, SubtitleDecoderException { throws IOException, SubtitleDecoderException {
byte[] initBytes = byte[] initBytes =
TestUtil.getByteArray( TestUtil.getByteArray(
......
...@@ -38,7 +38,7 @@ public final class CssParserTest { ...@@ -38,7 +38,7 @@ public final class CssParserTest {
} }
@Test @Test
public void testSkipWhitespacesAndComments() { public void skipWhitespacesAndComments() {
// Skip only whitespaces // Skip only whitespaces
String skipOnlyWhitespaces = " \t\r\n\f End of skip\n /* */"; String skipOnlyWhitespaces = " \t\r\n\f End of skip\n /* */";
assertSkipsToEndOfSkip("End of skip", skipOnlyWhitespaces); assertSkipsToEndOfSkip("End of skip", skipOnlyWhitespaces);
...@@ -61,7 +61,7 @@ public final class CssParserTest { ...@@ -61,7 +61,7 @@ public final class CssParserTest {
} }
@Test @Test
public void testGetInputLimit() { public void getInputLimit() {
// \r After 3 lines. // \r After 3 lines.
String threeLinesThen3Cr = "One Line\nThen other\rAnd finally\r\r\r"; String threeLinesThen3Cr = "One Line\nThen other\rAnd finally\r\r\r";
assertInputLimit("", threeLinesThen3Cr); assertInputLimit("", threeLinesThen3Cr);
...@@ -87,7 +87,7 @@ public final class CssParserTest { ...@@ -87,7 +87,7 @@ public final class CssParserTest {
} }
@Test @Test
public void testParseMethodSimpleInput() { public void parseMethodSimpleInput() {
WebvttCssStyle expectedStyle = new WebvttCssStyle(); WebvttCssStyle expectedStyle = new WebvttCssStyle();
String styleBlock1 = " ::cue { color : black; background-color: PapayaWhip }"; String styleBlock1 = " ::cue { color : black; background-color: PapayaWhip }";
expectedStyle.setFontColor(0xFF000000); expectedStyle.setFontColor(0xFF000000);
...@@ -106,7 +106,7 @@ public final class CssParserTest { ...@@ -106,7 +106,7 @@ public final class CssParserTest {
} }
@Test @Test
public void testParseMethodMultipleRulesInBlockInput() { public void parseMethodMultipleRulesInBlockInput() {
String styleBlock = String styleBlock =
"::cue {\n background-color\n:#00fFFe} \n::cue {\n background-color\n:#00000000}\n"; "::cue {\n background-color\n:#00fFFe} \n::cue {\n background-color\n:#00000000}\n";
WebvttCssStyle expectedStyle = new WebvttCssStyle(); WebvttCssStyle expectedStyle = new WebvttCssStyle();
...@@ -117,7 +117,7 @@ public final class CssParserTest { ...@@ -117,7 +117,7 @@ public final class CssParserTest {
} }
@Test @Test
public void testMultiplePropertiesInBlock() { public void multiplePropertiesInBlock() {
String styleBlock = "::cue(#id){text-decoration:underline; background-color:green;" String styleBlock = "::cue(#id){text-decoration:underline; background-color:green;"
+ "color:red; font-family:Courier; font-weight:bold}"; + "color:red; font-family:Courier; font-weight:bold}";
WebvttCssStyle expectedStyle = new WebvttCssStyle(); WebvttCssStyle expectedStyle = new WebvttCssStyle();
...@@ -132,7 +132,7 @@ public final class CssParserTest { ...@@ -132,7 +132,7 @@ public final class CssParserTest {
} }
@Test @Test
public void testRgbaColorExpression() { public void rgbaColorExpression() {
String styleBlock = "::cue(#rgb){background-color: rgba(\n10/* Ugly color */,11\t, 12\n,.1);" String styleBlock = "::cue(#rgb){background-color: rgba(\n10/* Ugly color */,11\t, 12\n,.1);"
+ "color:rgb(1,1,\n1)}"; + "color:rgb(1,1,\n1)}";
WebvttCssStyle expectedStyle = new WebvttCssStyle(); WebvttCssStyle expectedStyle = new WebvttCssStyle();
...@@ -144,7 +144,7 @@ public final class CssParserTest { ...@@ -144,7 +144,7 @@ public final class CssParserTest {
} }
@Test @Test
public void testGetNextToken() { public void getNextToken() {
String stringInput = " lorem:ipsum\n{dolor}#sit,amet;lorem:ipsum\r\t\f\ndolor(())\n"; String stringInput = " lorem:ipsum\n{dolor}#sit,amet;lorem:ipsum\r\t\f\ndolor(())\n";
ParsableByteArray input = new ParsableByteArray(Util.getUtf8Bytes(stringInput)); ParsableByteArray input = new ParsableByteArray(Util.getUtf8Bytes(stringInput));
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
...@@ -170,7 +170,7 @@ public final class CssParserTest { ...@@ -170,7 +170,7 @@ public final class CssParserTest {
} }
@Test @Test
public void testStyleScoreSystem() { public void styleScoreSystem() {
WebvttCssStyle style = new WebvttCssStyle(); WebvttCssStyle style = new WebvttCssStyle();
// Universal selector. // Universal selector.
assertThat(style.getSpecificityScore("", "", new String[0], "")).isEqualTo(1); assertThat(style.getSpecificityScore("", "", new String[0], "")).isEqualTo(1);
......
...@@ -88,7 +88,7 @@ public final class Mp4WebvttDecoderTest { ...@@ -88,7 +88,7 @@ public final class Mp4WebvttDecoderTest {
// Positive tests. // Positive tests.
@Test @Test
public void testSingleCueSample() throws SubtitleDecoderException { public void singleCueSample() throws SubtitleDecoderException {
Mp4WebvttDecoder decoder = new Mp4WebvttDecoder(); Mp4WebvttDecoder decoder = new Mp4WebvttDecoder();
Subtitle result = decoder.decode(SINGLE_CUE_SAMPLE, SINGLE_CUE_SAMPLE.length, false); Subtitle result = decoder.decode(SINGLE_CUE_SAMPLE, SINGLE_CUE_SAMPLE.length, false);
// Line feed must be trimmed by the decoder // Line feed must be trimmed by the decoder
...@@ -97,7 +97,7 @@ public final class Mp4WebvttDecoderTest { ...@@ -97,7 +97,7 @@ public final class Mp4WebvttDecoderTest {
} }
@Test @Test
public void testTwoCuesSample() throws SubtitleDecoderException { public void twoCuesSample() throws SubtitleDecoderException {
Mp4WebvttDecoder decoder = new Mp4WebvttDecoder(); Mp4WebvttDecoder decoder = new Mp4WebvttDecoder();
Subtitle result = decoder.decode(DOUBLE_CUE_SAMPLE, DOUBLE_CUE_SAMPLE.length, false); Subtitle result = decoder.decode(DOUBLE_CUE_SAMPLE, DOUBLE_CUE_SAMPLE.length, false);
Cue firstExpectedCue = WebvttCueParser.newCueForText("Hello World"); Cue firstExpectedCue = WebvttCueParser.newCueForText("Hello World");
...@@ -106,7 +106,7 @@ public final class Mp4WebvttDecoderTest { ...@@ -106,7 +106,7 @@ public final class Mp4WebvttDecoderTest {
} }
@Test @Test
public void testNoCueSample() throws SubtitleDecoderException { public void noCueSample() throws SubtitleDecoderException {
Mp4WebvttDecoder decoder = new Mp4WebvttDecoder(); Mp4WebvttDecoder decoder = new Mp4WebvttDecoder();
Subtitle result = decoder.decode(NO_CUE_SAMPLE, NO_CUE_SAMPLE.length, false); Subtitle result = decoder.decode(NO_CUE_SAMPLE, NO_CUE_SAMPLE.length, false);
assertThat(result.getEventTimeCount()).isEqualTo(1); assertThat(result.getEventTimeCount()).isEqualTo(1);
...@@ -117,7 +117,7 @@ public final class Mp4WebvttDecoderTest { ...@@ -117,7 +117,7 @@ public final class Mp4WebvttDecoderTest {
// Negative tests. // Negative tests.
@Test @Test
public void testSampleWithIncompleteHeader() { public void sampleWithIncompleteHeader() {
Mp4WebvttDecoder decoder = new Mp4WebvttDecoder(); Mp4WebvttDecoder decoder = new Mp4WebvttDecoder();
try { try {
decoder.decode(INCOMPLETE_HEADER_SAMPLE, INCOMPLETE_HEADER_SAMPLE.length, false); decoder.decode(INCOMPLETE_HEADER_SAMPLE, INCOMPLETE_HEADER_SAMPLE.length, false);
......
...@@ -31,7 +31,7 @@ import org.junit.runner.RunWith; ...@@ -31,7 +31,7 @@ import org.junit.runner.RunWith;
public final class WebvttCueParserTest { public final class WebvttCueParserTest {
@Test @Test
public void testParseStrictValidClassesAndTrailingTokens() throws Exception { public void parseStrictValidClassesAndTrailingTokens() throws Exception {
Spanned text = parseCueText("<v.first.loud Esme>" Spanned text = parseCueText("<v.first.loud Esme>"
+ "This <u.style1.style2 some stuff>is</u> text with <b.foo><i.bar>html</i></b> tags"); + "This <u.style1.style2 some stuff>is</u> text with <b.foo><i.bar>html</i></b> tags");
...@@ -42,7 +42,7 @@ public final class WebvttCueParserTest { ...@@ -42,7 +42,7 @@ public final class WebvttCueParserTest {
} }
@Test @Test
public void testParseStrictValidUnsupportedTagsStrippedOut() throws Exception { public void parseStrictValidUnsupportedTagsStrippedOut() throws Exception {
Spanned text = parseCueText("<v.first.loud Esme>This <unsupported>is</unsupported> text with " Spanned text = parseCueText("<v.first.loud Esme>This <unsupported>is</unsupported> text with "
+ "<notsupp><invalid>html</invalid></notsupp> tags"); + "<notsupp><invalid>html</invalid></notsupp> tags");
...@@ -51,7 +51,7 @@ public final class WebvttCueParserTest { ...@@ -51,7 +51,7 @@ public final class WebvttCueParserTest {
} }
@Test @Test
public void testParseRubyTag() throws Exception { public void parseRubyTag() throws Exception {
Spanned text = Spanned text =
parseCueText("Some <ruby>base text<rt>with ruby</rt></ruby> and undecorated text"); parseCueText("Some <ruby>base text<rt>with ruby</rt></ruby> and undecorated text");
...@@ -63,7 +63,7 @@ public final class WebvttCueParserTest { ...@@ -63,7 +63,7 @@ public final class WebvttCueParserTest {
} }
@Test @Test
public void testParseRubyTagWithNoTextTag() throws Exception { public void parseRubyTagWithNoTextTag() throws Exception {
Spanned text = parseCueText("Some <ruby>base text with no ruby text</ruby>"); Spanned text = parseCueText("Some <ruby>base text with no ruby text</ruby>");
assertThat(text.toString()).isEqualTo("Some base text with no ruby text"); assertThat(text.toString()).isEqualTo("Some base text with no ruby text");
...@@ -71,7 +71,7 @@ public final class WebvttCueParserTest { ...@@ -71,7 +71,7 @@ public final class WebvttCueParserTest {
} }
@Test @Test
public void testParseRubyTagWithEmptyTextTag() throws Exception { public void parseRubyTagWithEmptyTextTag() throws Exception {
Spanned text = parseCueText("Some <ruby>base text with<rt></rt></ruby> empty ruby text"); Spanned text = parseCueText("Some <ruby>base text with<rt></rt></ruby> empty ruby text");
assertThat(text.toString()).isEqualTo("Some base text with empty ruby text"); assertThat(text.toString()).isEqualTo("Some base text with empty ruby text");
...@@ -81,7 +81,7 @@ public final class WebvttCueParserTest { ...@@ -81,7 +81,7 @@ public final class WebvttCueParserTest {
} }
@Test @Test
public void testParseDefaultTextColor() throws Exception { public void parseDefaultTextColor() throws Exception {
Spanned text = parseCueText("In this sentence <c.red>this text</c> is red"); Spanned text = parseCueText("In this sentence <c.red>this text</c> is red");
assertThat(text.toString()).isEqualTo("In this sentence this text is red"); assertThat(text.toString()).isEqualTo("In this sentence this text is red");
...@@ -92,7 +92,7 @@ public final class WebvttCueParserTest { ...@@ -92,7 +92,7 @@ public final class WebvttCueParserTest {
} }
@Test @Test
public void testParseUnsupportedDefaultTextColor() throws Exception { public void parseUnsupportedDefaultTextColor() throws Exception {
Spanned text = parseCueText("In this sentence <c.papayawhip>this text</c> is not papaya"); Spanned text = parseCueText("In this sentence <c.papayawhip>this text</c> is not papaya");
assertThat(text.toString()).isEqualTo("In this sentence this text is not papaya"); assertThat(text.toString()).isEqualTo("In this sentence this text is not papaya");
...@@ -100,7 +100,7 @@ public final class WebvttCueParserTest { ...@@ -100,7 +100,7 @@ public final class WebvttCueParserTest {
} }
@Test @Test
public void testParseDefaultBackgroundColor() throws Exception { public void parseDefaultBackgroundColor() throws Exception {
Spanned text = parseCueText("In this sentence <c.bg_cyan>this text</c> has a cyan background"); Spanned text = parseCueText("In this sentence <c.bg_cyan>this text</c> has a cyan background");
assertThat(text.toString()).isEqualTo("In this sentence this text has a cyan background"); assertThat(text.toString()).isEqualTo("In this sentence this text has a cyan background");
...@@ -111,7 +111,7 @@ public final class WebvttCueParserTest { ...@@ -111,7 +111,7 @@ public final class WebvttCueParserTest {
} }
@Test @Test
public void testParseUnsupportedDefaultBackgroundColor() throws Exception { public void parseUnsupportedDefaultBackgroundColor() throws Exception {
Spanned text = Spanned text =
parseCueText( parseCueText(
"In this sentence <c.bg_papayawhip>this text</c> doesn't have a papaya background"); "In this sentence <c.bg_papayawhip>this text</c> doesn't have a papaya background");
...@@ -122,7 +122,7 @@ public final class WebvttCueParserTest { ...@@ -122,7 +122,7 @@ public final class WebvttCueParserTest {
} }
@Test @Test
public void testParseWellFormedUnclosedEndAtCueEnd() throws Exception { public void parseWellFormedUnclosedEndAtCueEnd() throws Exception {
Spanned text = parseCueText("An <u some trailing stuff>unclosed u tag with " Spanned text = parseCueText("An <u some trailing stuff>unclosed u tag with "
+ "<i>italic</i> inside"); + "<i>italic</i> inside");
...@@ -135,7 +135,7 @@ public final class WebvttCueParserTest { ...@@ -135,7 +135,7 @@ public final class WebvttCueParserTest {
} }
@Test @Test
public void testParseWellFormedUnclosedEndAtParent() throws Exception { public void parseWellFormedUnclosedEndAtParent() throws Exception {
Spanned text = parseCueText("An italic tag with unclosed <i><u>underline</i> inside"); Spanned text = parseCueText("An italic tag with unclosed <i><u>underline</i> inside");
assertThat(text.toString()).isEqualTo("An italic tag with unclosed underline inside"); assertThat(text.toString()).isEqualTo("An italic tag with unclosed underline inside");
...@@ -150,7 +150,7 @@ public final class WebvttCueParserTest { ...@@ -150,7 +150,7 @@ public final class WebvttCueParserTest {
} }
@Test @Test
public void testParseMalformedNestedElements() throws Exception { public void parseMalformedNestedElements() throws Exception {
Spanned text = parseCueText("<b><u>Overlapping u <i>and</u> i tags</i></b>"); Spanned text = parseCueText("<b><u>Overlapping u <i>and</u> i tags</i></b>");
String expectedText = "Overlapping u and i tags"; String expectedText = "Overlapping u and i tags";
...@@ -163,7 +163,7 @@ public final class WebvttCueParserTest { ...@@ -163,7 +163,7 @@ public final class WebvttCueParserTest {
} }
@Test @Test
public void testParseCloseNonExistingTag() throws Exception { public void parseCloseNonExistingTag() throws Exception {
Spanned text = parseCueText("foo<b>bar</i>baz</b>buzz"); Spanned text = parseCueText("foo<b>bar</i>baz</b>buzz");
assertThat(text.toString()).isEqualTo("foobarbazbuzz"); assertThat(text.toString()).isEqualTo("foobarbazbuzz");
...@@ -172,49 +172,49 @@ public final class WebvttCueParserTest { ...@@ -172,49 +172,49 @@ public final class WebvttCueParserTest {
} }
@Test @Test
public void testParseEmptyTagName() throws Exception { public void parseEmptyTagName() throws Exception {
Spanned text = parseCueText("An empty <>tag"); Spanned text = parseCueText("An empty <>tag");
assertThat(text.toString()).isEqualTo("An empty tag"); assertThat(text.toString()).isEqualTo("An empty tag");
} }
@Test @Test
public void testParseEntities() throws Exception { public void parseEntities() throws Exception {
Spanned text = parseCueText("&amp; &gt; &lt; &nbsp;"); Spanned text = parseCueText("&amp; &gt; &lt; &nbsp;");
assertThat(text.toString()).isEqualTo("& > < "); assertThat(text.toString()).isEqualTo("& > < ");
} }
@Test @Test
public void testParseEntitiesUnsupported() throws Exception { public void parseEntitiesUnsupported() throws Exception {
Spanned text = parseCueText("&noway; &sure;"); Spanned text = parseCueText("&noway; &sure;");
assertThat(text.toString()).isEqualTo(" "); assertThat(text.toString()).isEqualTo(" ");
} }
@Test @Test
public void testParseEntitiesNotTerminated() throws Exception { public void parseEntitiesNotTerminated() throws Exception {
Spanned text = parseCueText("&amp here comes text"); Spanned text = parseCueText("&amp here comes text");
assertThat(text.toString()).isEqualTo("& here comes text"); assertThat(text.toString()).isEqualTo("& here comes text");
} }
@Test @Test
public void testParseEntitiesNotTerminatedUnsupported() throws Exception { public void parseEntitiesNotTerminatedUnsupported() throws Exception {
Spanned text = parseCueText("&surenot here comes text"); Spanned text = parseCueText("&surenot here comes text");
assertThat(text.toString()).isEqualTo(" here comes text"); assertThat(text.toString()).isEqualTo(" here comes text");
} }
@Test @Test
public void testParseEntitiesNotTerminatedNoSpace() throws Exception { public void parseEntitiesNotTerminatedNoSpace() throws Exception {
Spanned text = parseCueText("&surenot"); Spanned text = parseCueText("&surenot");
assertThat(text.toString()).isEqualTo("&surenot"); assertThat(text.toString()).isEqualTo("&surenot");
} }
@Test @Test
public void testParseVoidTag() throws Exception { public void parseVoidTag() throws Exception {
Spanned text = parseCueText("here comes<br/> text<br/>"); Spanned text = parseCueText("here comes<br/> text<br/>");
assertThat(text.toString()).isEqualTo("here comes text"); assertThat(text.toString()).isEqualTo("here comes text");
} }
@Test @Test
public void testParseMultipleTagsOfSameKind() { public void parseMultipleTagsOfSameKind() {
Spanned text = parseCueText("blah <b>blah</b> blah <b>foo</b>"); Spanned text = parseCueText("blah <b>blah</b> blah <b>foo</b>");
assertThat(text.toString()).isEqualTo("blah blah blah foo"); assertThat(text.toString()).isEqualTo("blah blah blah foo");
...@@ -223,7 +223,7 @@ public final class WebvttCueParserTest { ...@@ -223,7 +223,7 @@ public final class WebvttCueParserTest {
} }
@Test @Test
public void testParseInvalidVoidSlash() { public void parseInvalidVoidSlash() {
Spanned text = parseCueText("blah <b/.st1.st2 trailing stuff> blah"); Spanned text = parseCueText("blah <b/.st1.st2 trailing stuff> blah");
assertThat(text.toString()).isEqualTo("blah blah"); assertThat(text.toString()).isEqualTo("blah blah");
...@@ -231,7 +231,7 @@ public final class WebvttCueParserTest { ...@@ -231,7 +231,7 @@ public final class WebvttCueParserTest {
} }
@Test @Test
public void testParseMonkey() throws Exception { public void parseMonkey() throws Exception {
Spanned text = parseCueText("< u>An unclosed u tag with <<<<< i>italic</u></u></u></u >" Spanned text = parseCueText("< u>An unclosed u tag with <<<<< i>italic</u></u></u></u >"
+ "</i><u><u> inside"); + "</i><u><u> inside");
assertThat(text.toString()).isEqualTo("An unclosed u tag with italic inside"); assertThat(text.toString()).isEqualTo("An unclosed u tag with italic inside");
...@@ -241,7 +241,7 @@ public final class WebvttCueParserTest { ...@@ -241,7 +241,7 @@ public final class WebvttCueParserTest {
} }
@Test @Test
public void testParseCornerCases() throws Exception { public void parseCornerCases() throws Exception {
Spanned text = parseCueText(">"); Spanned text = parseCueText(">");
assertThat(text.toString()).isEqualTo(">"); assertThat(text.toString()).isEqualTo(">");
......
...@@ -57,7 +57,7 @@ public class WebvttDecoderTest { ...@@ -57,7 +57,7 @@ public class WebvttDecoderTest {
@Rule public final Expect expect = Expect.create(); @Rule public final Expect expect = Expect.create();
@Test @Test
public void testDecodeEmpty() throws IOException { public void decodeEmpty() throws IOException {
WebvttDecoder decoder = new WebvttDecoder(); WebvttDecoder decoder = new WebvttDecoder();
byte[] bytes = TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), EMPTY_FILE); byte[] bytes = TestUtil.getByteArray(ApplicationProvider.getApplicationContext(), EMPTY_FILE);
try { try {
...@@ -69,7 +69,7 @@ public class WebvttDecoderTest { ...@@ -69,7 +69,7 @@ public class WebvttDecoderTest {
} }
@Test @Test
public void testDecodeTypical() throws Exception { public void decodeTypical() throws Exception {
WebvttSubtitle subtitle = getSubtitleForTestAsset(TYPICAL_FILE); WebvttSubtitle subtitle = getSubtitleForTestAsset(TYPICAL_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(4); assertThat(subtitle.getEventTimeCount()).isEqualTo(4);
...@@ -86,7 +86,7 @@ public class WebvttDecoderTest { ...@@ -86,7 +86,7 @@ public class WebvttDecoderTest {
} }
@Test @Test
public void testDecodeWithBom() throws Exception { public void decodeWithBom() throws Exception {
WebvttSubtitle subtitle = getSubtitleForTestAsset(WITH_BOM); WebvttSubtitle subtitle = getSubtitleForTestAsset(WITH_BOM);
assertThat(subtitle.getEventTimeCount()).isEqualTo(4); assertThat(subtitle.getEventTimeCount()).isEqualTo(4);
...@@ -103,7 +103,7 @@ public class WebvttDecoderTest { ...@@ -103,7 +103,7 @@ public class WebvttDecoderTest {
} }
@Test @Test
public void testDecodeTypicalWithBadTimestamps() throws Exception { public void decodeTypicalWithBadTimestamps() throws Exception {
WebvttSubtitle subtitle = getSubtitleForTestAsset(TYPICAL_WITH_BAD_TIMESTAMPS); WebvttSubtitle subtitle = getSubtitleForTestAsset(TYPICAL_WITH_BAD_TIMESTAMPS);
assertThat(subtitle.getEventTimeCount()).isEqualTo(4); assertThat(subtitle.getEventTimeCount()).isEqualTo(4);
...@@ -120,7 +120,7 @@ public class WebvttDecoderTest { ...@@ -120,7 +120,7 @@ public class WebvttDecoderTest {
} }
@Test @Test
public void testDecodeTypicalWithIds() throws Exception { public void decodeTypicalWithIds() throws Exception {
WebvttSubtitle subtitle = getSubtitleForTestAsset(TYPICAL_WITH_IDS_FILE); WebvttSubtitle subtitle = getSubtitleForTestAsset(TYPICAL_WITH_IDS_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(4); assertThat(subtitle.getEventTimeCount()).isEqualTo(4);
...@@ -137,7 +137,7 @@ public class WebvttDecoderTest { ...@@ -137,7 +137,7 @@ public class WebvttDecoderTest {
} }
@Test @Test
public void testDecodeTypicalWithComments() throws Exception { public void decodeTypicalWithComments() throws Exception {
WebvttSubtitle subtitle = getSubtitleForTestAsset(TYPICAL_WITH_COMMENTS_FILE); WebvttSubtitle subtitle = getSubtitleForTestAsset(TYPICAL_WITH_COMMENTS_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(4); assertThat(subtitle.getEventTimeCount()).isEqualTo(4);
...@@ -154,7 +154,7 @@ public class WebvttDecoderTest { ...@@ -154,7 +154,7 @@ public class WebvttDecoderTest {
} }
@Test @Test
public void testDecodeWithTags() throws Exception { public void decodeWithTags() throws Exception {
WebvttSubtitle subtitle = getSubtitleForTestAsset(WITH_TAGS_FILE); WebvttSubtitle subtitle = getSubtitleForTestAsset(WITH_TAGS_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(8); assertThat(subtitle.getEventTimeCount()).isEqualTo(8);
...@@ -181,7 +181,7 @@ public class WebvttDecoderTest { ...@@ -181,7 +181,7 @@ public class WebvttDecoderTest {
} }
@Test @Test
public void testDecodeWithPositioning() throws Exception { public void decodeWithPositioning() throws Exception {
WebvttSubtitle subtitle = getSubtitleForTestAsset(WITH_POSITIONING_FILE); WebvttSubtitle subtitle = getSubtitleForTestAsset(WITH_POSITIONING_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(12); assertThat(subtitle.getEventTimeCount()).isEqualTo(12);
...@@ -249,7 +249,7 @@ public class WebvttDecoderTest { ...@@ -249,7 +249,7 @@ public class WebvttDecoderTest {
} }
@Test @Test
public void testDecodeWithVertical() throws Exception { public void decodeWithVertical() throws Exception {
WebvttSubtitle subtitle = getSubtitleForTestAsset(WITH_VERTICAL_FILE); WebvttSubtitle subtitle = getSubtitleForTestAsset(WITH_VERTICAL_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(6); assertThat(subtitle.getEventTimeCount()).isEqualTo(6);
...@@ -274,7 +274,7 @@ public class WebvttDecoderTest { ...@@ -274,7 +274,7 @@ public class WebvttDecoderTest {
} }
@Test @Test
public void testDecodeWithBadCueHeader() throws Exception { public void decodeWithBadCueHeader() throws Exception {
WebvttSubtitle subtitle = getSubtitleForTestAsset(WITH_BAD_CUE_HEADER_FILE); WebvttSubtitle subtitle = getSubtitleForTestAsset(WITH_BAD_CUE_HEADER_FILE);
assertThat(subtitle.getEventTimeCount()).isEqualTo(4); assertThat(subtitle.getEventTimeCount()).isEqualTo(4);
...@@ -291,7 +291,7 @@ public class WebvttDecoderTest { ...@@ -291,7 +291,7 @@ public class WebvttDecoderTest {
} }
@Test @Test
public void testWebvttWithCssStyle() throws Exception { public void webvttWithCssStyle() throws Exception {
WebvttSubtitle subtitle = getSubtitleForTestAsset(WITH_CSS_STYLES); WebvttSubtitle subtitle = getSubtitleForTestAsset(WITH_CSS_STYLES);
Spanned firstCueText = getUniqueSpanTextAt(subtitle, 0); Spanned firstCueText = getUniqueSpanTextAt(subtitle, 0);
...@@ -323,7 +323,7 @@ public class WebvttDecoderTest { ...@@ -323,7 +323,7 @@ public class WebvttDecoderTest {
} }
@Test @Test
public void testWithComplexCssSelectors() throws Exception { public void withComplexCssSelectors() throws Exception {
WebvttSubtitle subtitle = getSubtitleForTestAsset(WITH_CSS_COMPLEX_SELECTORS); WebvttSubtitle subtitle = getSubtitleForTestAsset(WITH_CSS_COMPLEX_SELECTORS);
Spanned firstCueText = getUniqueSpanTextAt(subtitle, /* timeUs= */ 0); Spanned firstCueText = getUniqueSpanTextAt(subtitle, /* timeUs= */ 0);
assertThat(firstCueText).hasUnderlineSpanBetween(0, firstCueText.length()); assertThat(firstCueText).hasUnderlineSpanBetween(0, firstCueText.length());
...@@ -362,7 +362,7 @@ public class WebvttDecoderTest { ...@@ -362,7 +362,7 @@ public class WebvttDecoderTest {
} }
@Test @Test
public void testWebvttWithCssTextCombineUpright() throws Exception { public void webvttWithCssTextCombineUpright() throws Exception {
WebvttSubtitle subtitle = getSubtitleForTestAsset(WITH_CSS_TEXT_COMBINE_UPRIGHT); WebvttSubtitle subtitle = getSubtitleForTestAsset(WITH_CSS_TEXT_COMBINE_UPRIGHT);
Spanned firstCueText = getUniqueSpanTextAt(subtitle, 500_000); Spanned firstCueText = getUniqueSpanTextAt(subtitle, 500_000);
......
...@@ -75,7 +75,7 @@ public class WebvttSubtitleTest { ...@@ -75,7 +75,7 @@ public class WebvttSubtitleTest {
/* endTimeUs= */ 3_000_000))); /* endTimeUs= */ 3_000_000)));
@Test @Test
public void testEventCount() { public void eventCount() {
assertThat(emptySubtitle.getEventTimeCount()).isEqualTo(0); assertThat(emptySubtitle.getEventTimeCount()).isEqualTo(0);
assertThat(simpleSubtitle.getEventTimeCount()).isEqualTo(4); assertThat(simpleSubtitle.getEventTimeCount()).isEqualTo(4);
assertThat(overlappingSubtitle.getEventTimeCount()).isEqualTo(4); assertThat(overlappingSubtitle.getEventTimeCount()).isEqualTo(4);
...@@ -83,17 +83,17 @@ public class WebvttSubtitleTest { ...@@ -83,17 +83,17 @@ public class WebvttSubtitleTest {
} }
@Test @Test
public void testSimpleSubtitleEventTimes() { public void simpleSubtitleEventTimes() {
testSubtitleEventTimesHelper(simpleSubtitle); testSubtitleEventTimesHelper(simpleSubtitle);
} }
@Test @Test
public void testSimpleSubtitleEventIndices() { public void simpleSubtitleEventIndices() {
testSubtitleEventIndicesHelper(simpleSubtitle); testSubtitleEventIndicesHelper(simpleSubtitle);
} }
@Test @Test
public void testSimpleSubtitleText() { public void simpleSubtitleText() {
// Test before first subtitle // Test before first subtitle
assertSingleCueEmpty(simpleSubtitle.getCues(0)); assertSingleCueEmpty(simpleSubtitle.getCues(0));
assertSingleCueEmpty(simpleSubtitle.getCues(500_000)); assertSingleCueEmpty(simpleSubtitle.getCues(500_000));
...@@ -121,17 +121,17 @@ public class WebvttSubtitleTest { ...@@ -121,17 +121,17 @@ public class WebvttSubtitleTest {
} }
@Test @Test
public void testOverlappingSubtitleEventTimes() { public void overlappingSubtitleEventTimes() {
testSubtitleEventTimesHelper(overlappingSubtitle); testSubtitleEventTimesHelper(overlappingSubtitle);
} }
@Test @Test
public void testOverlappingSubtitleEventIndices() { public void overlappingSubtitleEventIndices() {
testSubtitleEventIndicesHelper(overlappingSubtitle); testSubtitleEventIndicesHelper(overlappingSubtitle);
} }
@Test @Test
public void testOverlappingSubtitleText() { public void overlappingSubtitleText() {
// Test before first subtitle // Test before first subtitle
assertSingleCueEmpty(overlappingSubtitle.getCues(0)); assertSingleCueEmpty(overlappingSubtitle.getCues(0));
assertSingleCueEmpty(overlappingSubtitle.getCues(500_000)); assertSingleCueEmpty(overlappingSubtitle.getCues(500_000));
...@@ -162,17 +162,17 @@ public class WebvttSubtitleTest { ...@@ -162,17 +162,17 @@ public class WebvttSubtitleTest {
} }
@Test @Test
public void testNestedSubtitleEventTimes() { public void nestedSubtitleEventTimes() {
testSubtitleEventTimesHelper(nestedSubtitle); testSubtitleEventTimesHelper(nestedSubtitle);
} }
@Test @Test
public void testNestedSubtitleEventIndices() { public void nestedSubtitleEventIndices() {
testSubtitleEventIndicesHelper(nestedSubtitle); testSubtitleEventIndicesHelper(nestedSubtitle);
} }
@Test @Test
public void testNestedSubtitleText() { public void nestedSubtitleText() {
// Test before first subtitle // Test before first subtitle
assertSingleCueEmpty(nestedSubtitle.getCues(0)); assertSingleCueEmpty(nestedSubtitle.getCues(0));
assertSingleCueEmpty(nestedSubtitle.getCues(500_000)); assertSingleCueEmpty(nestedSubtitle.getCues(500_000));
......
...@@ -63,7 +63,7 @@ public final class AdaptiveTrackSelectionTest { ...@@ -63,7 +63,7 @@ public final class AdaptiveTrackSelectionTest {
@Test @Test
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void testFactoryUsesInitiallyProvidedBandwidthMeter() { public void factoryUsesInitiallyProvidedBandwidthMeter() {
BandwidthMeter initialBandwidthMeter = mock(BandwidthMeter.class); BandwidthMeter initialBandwidthMeter = mock(BandwidthMeter.class);
BandwidthMeter injectedBandwidthMeter = mock(BandwidthMeter.class); BandwidthMeter injectedBandwidthMeter = mock(BandwidthMeter.class);
Format format1 = videoFormat(/* bitrate= */ 500, /* width= */ 320, /* height= */ 240); Format format1 = videoFormat(/* bitrate= */ 500, /* width= */ 320, /* height= */ 240);
...@@ -87,7 +87,7 @@ public final class AdaptiveTrackSelectionTest { ...@@ -87,7 +87,7 @@ public final class AdaptiveTrackSelectionTest {
} }
@Test @Test
public void testSelectInitialIndexUseMaxInitialBitrateIfNoBandwidthEstimate() { public void selectInitialIndexUseMaxInitialBitrateIfNoBandwidthEstimate() {
Format format1 = videoFormat(/* bitrate= */ 500, /* width= */ 320, /* height= */ 240); Format format1 = videoFormat(/* bitrate= */ 500, /* width= */ 320, /* height= */ 240);
Format format2 = videoFormat(/* bitrate= */ 1000, /* width= */ 640, /* height= */ 480); Format format2 = videoFormat(/* bitrate= */ 1000, /* width= */ 640, /* height= */ 480);
Format format3 = videoFormat(/* bitrate= */ 2000, /* width= */ 960, /* height= */ 720); Format format3 = videoFormat(/* bitrate= */ 2000, /* width= */ 960, /* height= */ 720);
...@@ -101,7 +101,7 @@ public final class AdaptiveTrackSelectionTest { ...@@ -101,7 +101,7 @@ public final class AdaptiveTrackSelectionTest {
} }
@Test @Test
public void testSelectInitialIndexUseBandwidthEstimateIfAvailable() { public void selectInitialIndexUseBandwidthEstimateIfAvailable() {
Format format1 = videoFormat(/* bitrate= */ 500, /* width= */ 320, /* height= */ 240); Format format1 = videoFormat(/* bitrate= */ 500, /* width= */ 320, /* height= */ 240);
Format format2 = videoFormat(/* bitrate= */ 1000, /* width= */ 640, /* height= */ 480); Format format2 = videoFormat(/* bitrate= */ 1000, /* width= */ 640, /* height= */ 480);
Format format3 = videoFormat(/* bitrate= */ 2000, /* width= */ 960, /* height= */ 720); Format format3 = videoFormat(/* bitrate= */ 2000, /* width= */ 960, /* height= */ 720);
...@@ -115,7 +115,7 @@ public final class AdaptiveTrackSelectionTest { ...@@ -115,7 +115,7 @@ public final class AdaptiveTrackSelectionTest {
} }
@Test @Test
public void testUpdateSelectedTrackDoNotSwitchUpIfNotBufferedEnough() { public void updateSelectedTrackDoNotSwitchUpIfNotBufferedEnough() {
Format format1 = videoFormat(/* bitrate= */ 500, /* width= */ 320, /* height= */ 240); Format format1 = videoFormat(/* bitrate= */ 500, /* width= */ 320, /* height= */ 240);
Format format2 = videoFormat(/* bitrate= */ 1000, /* width= */ 640, /* height= */ 480); Format format2 = videoFormat(/* bitrate= */ 1000, /* width= */ 640, /* height= */ 480);
Format format3 = videoFormat(/* bitrate= */ 2000, /* width= */ 960, /* height= */ 720); Format format3 = videoFormat(/* bitrate= */ 2000, /* width= */ 960, /* height= */ 720);
...@@ -143,7 +143,7 @@ public final class AdaptiveTrackSelectionTest { ...@@ -143,7 +143,7 @@ public final class AdaptiveTrackSelectionTest {
} }
@Test @Test
public void testUpdateSelectedTrackSwitchUpIfBufferedEnough() { public void updateSelectedTrackSwitchUpIfBufferedEnough() {
Format format1 = videoFormat(/* bitrate= */ 500, /* width= */ 320, /* height= */ 240); Format format1 = videoFormat(/* bitrate= */ 500, /* width= */ 320, /* height= */ 240);
Format format2 = videoFormat(/* bitrate= */ 1000, /* width= */ 640, /* height= */ 480); Format format2 = videoFormat(/* bitrate= */ 1000, /* width= */ 640, /* height= */ 480);
Format format3 = videoFormat(/* bitrate= */ 2000, /* width= */ 960, /* height= */ 720); Format format3 = videoFormat(/* bitrate= */ 2000, /* width= */ 960, /* height= */ 720);
...@@ -171,7 +171,7 @@ public final class AdaptiveTrackSelectionTest { ...@@ -171,7 +171,7 @@ public final class AdaptiveTrackSelectionTest {
} }
@Test @Test
public void testUpdateSelectedTrackDoNotSwitchDownIfBufferedEnough() { public void updateSelectedTrackDoNotSwitchDownIfBufferedEnough() {
Format format1 = videoFormat(/* bitrate= */ 500, /* width= */ 320, /* height= */ 240); Format format1 = videoFormat(/* bitrate= */ 500, /* width= */ 320, /* height= */ 240);
Format format2 = videoFormat(/* bitrate= */ 1000, /* width= */ 640, /* height= */ 480); Format format2 = videoFormat(/* bitrate= */ 1000, /* width= */ 640, /* height= */ 480);
Format format3 = videoFormat(/* bitrate= */ 2000, /* width= */ 960, /* height= */ 720); Format format3 = videoFormat(/* bitrate= */ 2000, /* width= */ 960, /* height= */ 720);
...@@ -199,7 +199,7 @@ public final class AdaptiveTrackSelectionTest { ...@@ -199,7 +199,7 @@ public final class AdaptiveTrackSelectionTest {
} }
@Test @Test
public void testUpdateSelectedTrackSwitchDownIfNotBufferedEnough() { public void updateSelectedTrackSwitchDownIfNotBufferedEnough() {
Format format1 = videoFormat(/* bitrate= */ 500, /* width= */ 320, /* height= */ 240); Format format1 = videoFormat(/* bitrate= */ 500, /* width= */ 320, /* height= */ 240);
Format format2 = videoFormat(/* bitrate= */ 1000, /* width= */ 640, /* height= */ 480); Format format2 = videoFormat(/* bitrate= */ 1000, /* width= */ 640, /* height= */ 480);
Format format3 = videoFormat(/* bitrate= */ 2000, /* width= */ 960, /* height= */ 720); Format format3 = videoFormat(/* bitrate= */ 2000, /* width= */ 960, /* height= */ 720);
...@@ -227,7 +227,7 @@ public final class AdaptiveTrackSelectionTest { ...@@ -227,7 +227,7 @@ public final class AdaptiveTrackSelectionTest {
} }
@Test @Test
public void testEvaluateQueueSizeReturnQueueSizeIfBandwidthIsNotImproved() { public void evaluateQueueSizeReturnQueueSizeIfBandwidthIsNotImproved() {
Format format1 = videoFormat(/* bitrate= */ 500, /* width= */ 320, /* height= */ 240); Format format1 = videoFormat(/* bitrate= */ 500, /* width= */ 320, /* height= */ 240);
Format format2 = videoFormat(/* bitrate= */ 1000, /* width= */ 640, /* height= */ 480); Format format2 = videoFormat(/* bitrate= */ 1000, /* width= */ 640, /* height= */ 480);
Format format3 = videoFormat(/* bitrate= */ 2000, /* width= */ 960, /* height= */ 720); Format format3 = videoFormat(/* bitrate= */ 2000, /* width= */ 960, /* height= */ 720);
...@@ -252,7 +252,7 @@ public final class AdaptiveTrackSelectionTest { ...@@ -252,7 +252,7 @@ public final class AdaptiveTrackSelectionTest {
} }
@Test @Test
public void testEvaluateQueueSizeDoNotReevaluateUntilAfterMinTimeBetweenBufferReevaluation() { public void evaluateQueueSizeDoNotReevaluateUntilAfterMinTimeBetweenBufferReevaluation() {
Format format1 = videoFormat(/* bitrate= */ 500, /* width= */ 320, /* height= */ 240); Format format1 = videoFormat(/* bitrate= */ 500, /* width= */ 320, /* height= */ 240);
Format format2 = videoFormat(/* bitrate= */ 1000, /* width= */ 640, /* height= */ 480); Format format2 = videoFormat(/* bitrate= */ 1000, /* width= */ 640, /* height= */ 480);
Format format3 = videoFormat(/* bitrate= */ 2000, /* width= */ 960, /* height= */ 720); Format format3 = videoFormat(/* bitrate= */ 2000, /* width= */ 960, /* height= */ 720);
...@@ -289,7 +289,7 @@ public final class AdaptiveTrackSelectionTest { ...@@ -289,7 +289,7 @@ public final class AdaptiveTrackSelectionTest {
} }
@Test @Test
public void testEvaluateQueueSizeRetainMoreThanMinimumDurationAfterDiscard() { public void evaluateQueueSizeRetainMoreThanMinimumDurationAfterDiscard() {
Format format1 = videoFormat(/* bitrate= */ 500, /* width= */ 320, /* height= */ 240); Format format1 = videoFormat(/* bitrate= */ 500, /* width= */ 320, /* height= */ 240);
Format format2 = videoFormat(/* bitrate= */ 1000, /* width= */ 640, /* height= */ 480); Format format2 = videoFormat(/* bitrate= */ 1000, /* width= */ 640, /* height= */ 480);
Format format3 = videoFormat(/* bitrate= */ 2000, /* width= */ 960, /* height= */ 720); Format format3 = videoFormat(/* bitrate= */ 2000, /* width= */ 960, /* height= */ 720);
......
...@@ -119,7 +119,7 @@ public final class DefaultTrackSelectorTest { ...@@ -119,7 +119,7 @@ public final class DefaultTrackSelectorTest {
/** Tests {@link Parameters} {@link android.os.Parcelable} implementation. */ /** Tests {@link Parameters} {@link android.os.Parcelable} implementation. */
@Test @Test
public void testParametersParcelable() { public void parametersParcelable() {
SparseArray<Map<TrackGroupArray, SelectionOverride>> selectionOverrides = new SparseArray<>(); SparseArray<Map<TrackGroupArray, SelectionOverride>> selectionOverrides = new SparseArray<>();
Map<TrackGroupArray, SelectionOverride> videoOverrides = new HashMap<>(); Map<TrackGroupArray, SelectionOverride> videoOverrides = new HashMap<>();
videoOverrides.put(new TrackGroupArray(VIDEO_TRACK_GROUP), new SelectionOverride(0, 1)); videoOverrides.put(new TrackGroupArray(VIDEO_TRACK_GROUP), new SelectionOverride(0, 1));
...@@ -175,7 +175,7 @@ public final class DefaultTrackSelectorTest { ...@@ -175,7 +175,7 @@ public final class DefaultTrackSelectorTest {
/** Tests {@link SelectionOverride}'s {@link android.os.Parcelable} implementation. */ /** Tests {@link SelectionOverride}'s {@link android.os.Parcelable} implementation. */
@Test @Test
public void testSelectionOverrideParcelable() { public void selectionOverrideParcelable() {
int[] tracks = new int[] {2, 3}; int[] tracks = new int[] {2, 3};
SelectionOverride selectionOverrideToParcel = SelectionOverride selectionOverrideToParcel =
new SelectionOverride(/* groupIndex= */ 1, tracks); new SelectionOverride(/* groupIndex= */ 1, tracks);
...@@ -193,7 +193,7 @@ public final class DefaultTrackSelectorTest { ...@@ -193,7 +193,7 @@ public final class DefaultTrackSelectorTest {
/** Tests that a null override clears a track selection. */ /** Tests that a null override clears a track selection. */
@Test @Test
public void testSelectTracksWithNullOverride() throws ExoPlaybackException { public void selectTracksWithNullOverride() throws ExoPlaybackException {
trackSelector.setParameters( trackSelector.setParameters(
trackSelector trackSelector
.buildUponParameters() .buildUponParameters()
...@@ -207,7 +207,7 @@ public final class DefaultTrackSelectorTest { ...@@ -207,7 +207,7 @@ public final class DefaultTrackSelectorTest {
/** Tests that a null override can be cleared. */ /** Tests that a null override can be cleared. */
@Test @Test
public void testSelectTracksWithClearedNullOverride() throws ExoPlaybackException { public void selectTracksWithClearedNullOverride() throws ExoPlaybackException {
trackSelector.setParameters( trackSelector.setParameters(
trackSelector trackSelector
.buildUponParameters() .buildUponParameters()
...@@ -222,7 +222,7 @@ public final class DefaultTrackSelectorTest { ...@@ -222,7 +222,7 @@ public final class DefaultTrackSelectorTest {
/** Tests that an override is not applied for a different set of available track groups. */ /** Tests that an override is not applied for a different set of available track groups. */
@Test @Test
public void testSelectTracksWithNullOverrideForDifferentTracks() throws ExoPlaybackException { public void selectTracksWithNullOverrideForDifferentTracks() throws ExoPlaybackException {
trackSelector.setParameters( trackSelector.setParameters(
trackSelector trackSelector
.buildUponParameters() .buildUponParameters()
...@@ -240,7 +240,7 @@ public final class DefaultTrackSelectorTest { ...@@ -240,7 +240,7 @@ public final class DefaultTrackSelectorTest {
/** Tests disabling a renderer. */ /** Tests disabling a renderer. */
@Test @Test
public void testSelectTracksWithDisabledRenderer() throws ExoPlaybackException { public void selectTracksWithDisabledRenderer() throws ExoPlaybackException {
trackSelector.setParameters(defaultParameters.buildUpon().setRendererDisabled(1, true)); trackSelector.setParameters(defaultParameters.buildUpon().setRendererDisabled(1, true));
TrackSelectorResult result = TrackSelectorResult result =
trackSelector.selectTracks(RENDERER_CAPABILITIES, TRACK_GROUPS, periodId, TIMELINE); trackSelector.selectTracks(RENDERER_CAPABILITIES, TRACK_GROUPS, periodId, TIMELINE);
...@@ -251,7 +251,7 @@ public final class DefaultTrackSelectorTest { ...@@ -251,7 +251,7 @@ public final class DefaultTrackSelectorTest {
/** Tests that a disabled renderer can be enabled again. */ /** Tests that a disabled renderer can be enabled again. */
@Test @Test
public void testSelectTracksWithClearedDisabledRenderer() throws ExoPlaybackException { public void selectTracksWithClearedDisabledRenderer() throws ExoPlaybackException {
trackSelector.setParameters( trackSelector.setParameters(
trackSelector trackSelector
.buildUponParameters() .buildUponParameters()
...@@ -266,7 +266,7 @@ public final class DefaultTrackSelectorTest { ...@@ -266,7 +266,7 @@ public final class DefaultTrackSelectorTest {
/** Tests a no-sample renderer is enabled without a track selection by default. */ /** Tests a no-sample renderer is enabled without a track selection by default. */
@Test @Test
public void testSelectTracksWithNoSampleRenderer() throws ExoPlaybackException { public void selectTracksWithNoSampleRenderer() throws ExoPlaybackException {
TrackSelectorResult result = TrackSelectorResult result =
trackSelector.selectTracks( trackSelector.selectTracks(
RENDERER_CAPABILITIES_WITH_NO_SAMPLE_RENDERER, TRACK_GROUPS, periodId, TIMELINE); RENDERER_CAPABILITIES_WITH_NO_SAMPLE_RENDERER, TRACK_GROUPS, periodId, TIMELINE);
...@@ -277,7 +277,7 @@ public final class DefaultTrackSelectorTest { ...@@ -277,7 +277,7 @@ public final class DefaultTrackSelectorTest {
/** Tests disabling a no-sample renderer. */ /** Tests disabling a no-sample renderer. */
@Test @Test
public void testSelectTracksWithDisabledNoSampleRenderer() throws ExoPlaybackException { public void selectTracksWithDisabledNoSampleRenderer() throws ExoPlaybackException {
trackSelector.setParameters(defaultParameters.buildUpon().setRendererDisabled(1, true)); trackSelector.setParameters(defaultParameters.buildUpon().setRendererDisabled(1, true));
TrackSelectorResult result = TrackSelectorResult result =
trackSelector.selectTracks( trackSelector.selectTracks(
...@@ -293,7 +293,7 @@ public final class DefaultTrackSelectorTest { ...@@ -293,7 +293,7 @@ public final class DefaultTrackSelectorTest {
* {@link Parameters}. * {@link Parameters}.
*/ */
@Test @Test
public void testSetParameterWithDefaultParametersDoesNotNotifyInvalidationListener() { public void setParameterWithDefaultParametersDoesNotNotifyInvalidationListener() {
trackSelector.setParameters(defaultParameters); trackSelector.setParameters(defaultParameters);
verify(invalidationListener, never()).onTrackSelectionsInvalidated(); verify(invalidationListener, never()).onTrackSelectionsInvalidated();
} }
...@@ -303,7 +303,7 @@ public final class DefaultTrackSelectorTest { ...@@ -303,7 +303,7 @@ public final class DefaultTrackSelectorTest {
* when it's set with non-default values of {@link Parameters}. * when it's set with non-default values of {@link Parameters}.
*/ */
@Test @Test
public void testSetParameterWithNonDefaultParameterNotifyInvalidationListener() { public void setParameterWithNonDefaultParameterNotifyInvalidationListener() {
ParametersBuilder builder = defaultParameters.buildUpon().setPreferredAudioLanguage("eng"); ParametersBuilder builder = defaultParameters.buildUpon().setPreferredAudioLanguage("eng");
trackSelector.setParameters(builder); trackSelector.setParameters(builder);
verify(invalidationListener).onTrackSelectionsInvalidated(); verify(invalidationListener).onTrackSelectionsInvalidated();
...@@ -315,7 +315,7 @@ public final class DefaultTrackSelectorTest { ...@@ -315,7 +315,7 @@ public final class DefaultTrackSelectorTest {
* of {@link Parameters}. * of {@link Parameters}.
*/ */
@Test @Test
public void testSetParameterWithSameParametersDoesNotNotifyInvalidationListenerAgain() { public void setParameterWithSameParametersDoesNotNotifyInvalidationListenerAgain() {
ParametersBuilder builder = defaultParameters.buildUpon().setPreferredAudioLanguage("eng"); ParametersBuilder builder = defaultParameters.buildUpon().setPreferredAudioLanguage("eng");
trackSelector.setParameters(builder); trackSelector.setParameters(builder);
trackSelector.setParameters(builder); trackSelector.setParameters(builder);
...@@ -323,11 +323,11 @@ public final class DefaultTrackSelectorTest { ...@@ -323,11 +323,11 @@ public final class DefaultTrackSelectorTest {
} }
/** /**
* Tests that track selector will select audio track with {@link C#SELECTION_FLAG_DEFAULT} * Tests that track selector will select audio track with {@link C#SELECTION_FLAG_DEFAULT} given
* given default values of {@link Parameters}. * default values of {@link Parameters}.
*/ */
@Test @Test
public void testSelectTracksSelectTrackWithSelectionFlag() throws Exception { public void selectTracksSelectTrackWithSelectionFlag() throws Exception {
Format audioFormat = Format audioFormat =
buildAudioFormatWithLanguageAndFlags( buildAudioFormatWithLanguageAndFlags(
"audio", /* language= */ null, /* selectionFlags= */ 0); "audio", /* language= */ null, /* selectionFlags= */ 0);
...@@ -347,7 +347,7 @@ public final class DefaultTrackSelectorTest { ...@@ -347,7 +347,7 @@ public final class DefaultTrackSelectorTest {
/** Tests that adaptive audio track selections respect the maximum audio bitrate. */ /** Tests that adaptive audio track selections respect the maximum audio bitrate. */
@Test @Test
public void testSelectAdaptiveAudioTrackGroupWithMaxBitrate() throws ExoPlaybackException { public void selectAdaptiveAudioTrackGroupWithMaxBitrate() throws ExoPlaybackException {
Format format128k = Format format128k =
Format.createAudioSampleFormat( Format.createAudioSampleFormat(
/* id= */ "128", /* id= */ "128",
...@@ -421,8 +421,7 @@ public final class DefaultTrackSelectorTest { ...@@ -421,8 +421,7 @@ public final class DefaultTrackSelectorTest {
* given by {@link Parameters}. * given by {@link Parameters}.
*/ */
@Test @Test
public void testSelectTracksSelectPreferredAudioLanguage() public void selectTracksSelectPreferredAudioLanguage() throws Exception {
throws Exception {
Format frAudioFormat = Format frAudioFormat =
Format.createAudioSampleFormat("audio", MimeTypes.AUDIO_AAC, null, Format.NO_VALUE, Format.createAudioSampleFormat("audio", MimeTypes.AUDIO_AAC, null, Format.NO_VALUE,
Format.NO_VALUE, 2, 44100, null, null, 0, "fra"); Format.NO_VALUE, 2, 44100, null, null, 0, "fra");
...@@ -446,8 +445,7 @@ public final class DefaultTrackSelectorTest { ...@@ -446,8 +445,7 @@ public final class DefaultTrackSelectorTest {
* language given by {@link Parameters} over track with {@link C#SELECTION_FLAG_DEFAULT}. * language given by {@link Parameters} over track with {@link C#SELECTION_FLAG_DEFAULT}.
*/ */
@Test @Test
public void testSelectTracksSelectPreferredAudioLanguageOverSelectionFlag() public void selectTracksSelectPreferredAudioLanguageOverSelectionFlag() throws Exception {
throws Exception {
Format frAudioFormat = Format frAudioFormat =
Format.createAudioSampleFormat("audio", MimeTypes.AUDIO_AAC, null, Format.NO_VALUE, Format.createAudioSampleFormat("audio", MimeTypes.AUDIO_AAC, null, Format.NO_VALUE,
Format.NO_VALUE, 2, 44100, null, null, C.SELECTION_FLAG_DEFAULT, "fra"); Format.NO_VALUE, 2, 44100, null, null, C.SELECTION_FLAG_DEFAULT, "fra");
...@@ -467,11 +465,11 @@ public final class DefaultTrackSelectorTest { ...@@ -467,11 +465,11 @@ public final class DefaultTrackSelectorTest {
} }
/** /**
* Tests that track selector will prefer tracks that are within renderer's capabilities over * Tests that track selector will prefer tracks that are within renderer's capabilities over track
* track that exceed renderer's capabilities. * that exceed renderer's capabilities.
*/ */
@Test @Test
public void testSelectTracksPreferTrackWithinCapabilities() throws Exception { public void selectTracksPreferTrackWithinCapabilities() throws Exception {
Format supportedFormat = buildAudioFormat("supportedFormat"); Format supportedFormat = buildAudioFormat("supportedFormat");
Format exceededFormat = buildAudioFormat("exceededFormat"); Format exceededFormat = buildAudioFormat("exceededFormat");
TrackGroupArray trackGroups = wrapFormats(exceededFormat, supportedFormat); TrackGroupArray trackGroups = wrapFormats(exceededFormat, supportedFormat);
...@@ -496,7 +494,7 @@ public final class DefaultTrackSelectorTest { ...@@ -496,7 +494,7 @@ public final class DefaultTrackSelectorTest {
* there are no other choice, given the default {@link Parameters}. * there are no other choice, given the default {@link Parameters}.
*/ */
@Test @Test
public void testSelectTracksWithNoTrackWithinCapabilitiesSelectExceededCapabilityTrack() public void selectTracksWithNoTrackWithinCapabilitiesSelectExceededCapabilityTrack()
throws Exception { throws Exception {
Format audioFormat = Format audioFormat =
Format.createAudioSampleFormat("audio", MimeTypes.AUDIO_AAC, null, Format.NO_VALUE, Format.createAudioSampleFormat("audio", MimeTypes.AUDIO_AAC, null, Format.NO_VALUE,
...@@ -513,12 +511,12 @@ public final class DefaultTrackSelectorTest { ...@@ -513,12 +511,12 @@ public final class DefaultTrackSelectorTest {
} }
/** /**
* Tests that track selector will return a null track selection for a renderer when * Tests that track selector will return a null track selection for a renderer when all tracks
* all tracks exceed that renderer's capabilities when {@link Parameters} does not allow * exceed that renderer's capabilities when {@link Parameters} does not allow
* exceeding-capabilities tracks. * exceeding-capabilities tracks.
*/ */
@Test @Test
public void testSelectTracksWithNoTrackWithinCapabilitiesAndSetByParamsReturnNoSelection() public void selectTracksWithNoTrackWithinCapabilitiesAndSetByParamsReturnNoSelection()
throws Exception { throws Exception {
Format audioFormat = Format audioFormat =
Format.createAudioSampleFormat("audio", MimeTypes.AUDIO_AAC, null, Format.NO_VALUE, Format.createAudioSampleFormat("audio", MimeTypes.AUDIO_AAC, null, Format.NO_VALUE,
...@@ -541,8 +539,7 @@ public final class DefaultTrackSelectorTest { ...@@ -541,8 +539,7 @@ public final class DefaultTrackSelectorTest {
* tracks that have {@link C#SELECTION_FLAG_DEFAULT} but exceed renderer's capabilities. * tracks that have {@link C#SELECTION_FLAG_DEFAULT} but exceed renderer's capabilities.
*/ */
@Test @Test
public void testSelectTracksPreferTrackWithinCapabilitiesOverSelectionFlag() public void selectTracksPreferTrackWithinCapabilitiesOverSelectionFlag() throws Exception {
throws Exception {
Format exceededWithSelectionFlagFormat = Format exceededWithSelectionFlagFormat =
Format.createAudioSampleFormat( Format.createAudioSampleFormat(
"exceededFormat", "exceededFormat",
...@@ -577,13 +574,12 @@ public final class DefaultTrackSelectorTest { ...@@ -577,13 +574,12 @@ public final class DefaultTrackSelectorTest {
} }
/** /**
* Tests that track selector will prefer tracks that are within renderer's capabilities over * Tests that track selector will prefer tracks that are within renderer's capabilities over track
* track that have language matching preferred audio given by {@link Parameters} but exceed * that have language matching preferred audio given by {@link Parameters} but exceed renderer's
* renderer's capabilities. * capabilities.
*/ */
@Test @Test
public void testSelectTracksPreferTrackWithinCapabilitiesOverPreferredLanguage() public void selectTracksPreferTrackWithinCapabilitiesOverPreferredLanguage() throws Exception {
throws Exception {
Format exceededEnFormat = Format exceededEnFormat =
Format.createAudioSampleFormat( Format.createAudioSampleFormat(
"exceededFormat", "exceededFormat",
...@@ -619,12 +615,12 @@ public final class DefaultTrackSelectorTest { ...@@ -619,12 +615,12 @@ public final class DefaultTrackSelectorTest {
} }
/** /**
* Tests that track selector will prefer tracks that are within renderer's capabilities over * Tests that track selector will prefer tracks that are within renderer's capabilities over track
* track that have both language matching preferred audio given by {@link Parameters} and * that have both language matching preferred audio given by {@link Parameters} and {@link
* {@link C#SELECTION_FLAG_DEFAULT}, but exceed renderer's capabilities. * C#SELECTION_FLAG_DEFAULT}, but exceed renderer's capabilities.
*/ */
@Test @Test
public void testSelectTracksPreferTrackWithinCapabilitiesOverSelectionFlagAndPreferredLanguage() public void selectTracksPreferTrackWithinCapabilitiesOverSelectionFlagAndPreferredLanguage()
throws Exception { throws Exception {
Format exceededDefaultSelectionEnFormat = Format exceededDefaultSelectionEnFormat =
Format.createAudioSampleFormat( Format.createAudioSampleFormat(
...@@ -665,8 +661,7 @@ public final class DefaultTrackSelectorTest { ...@@ -665,8 +661,7 @@ public final class DefaultTrackSelectorTest {
* are the same, and tracks are within renderer's capabilities. * are the same, and tracks are within renderer's capabilities.
*/ */
@Test @Test
public void testSelectTracksWithinCapabilitiesSelectHigherNumChannel() public void selectTracksWithinCapabilitiesSelectHigherNumChannel() throws Exception {
throws Exception {
Format higherChannelFormat = Format higherChannelFormat =
Format.createAudioSampleFormat( Format.createAudioSampleFormat(
"audioFormat", "audioFormat",
...@@ -699,8 +694,7 @@ public final class DefaultTrackSelectorTest { ...@@ -699,8 +694,7 @@ public final class DefaultTrackSelectorTest {
* are the same, and tracks are within renderer's capabilities. * are the same, and tracks are within renderer's capabilities.
*/ */
@Test @Test
public void testSelectTracksWithinCapabilitiesSelectHigherSampleRate() public void selectTracksWithinCapabilitiesSelectHigherSampleRate() throws Exception {
throws Exception {
Format higherSampleRateFormat = Format higherSampleRateFormat =
Format.createAudioSampleFormat("audioFormat", MimeTypes.AUDIO_AAC, null, Format.NO_VALUE, Format.createAudioSampleFormat("audioFormat", MimeTypes.AUDIO_AAC, null, Format.NO_VALUE,
Format.NO_VALUE, 2, 44100, null, null, 0, null); Format.NO_VALUE, 2, 44100, null, null, 0, null);
...@@ -813,7 +807,7 @@ public final class DefaultTrackSelectorTest { ...@@ -813,7 +807,7 @@ public final class DefaultTrackSelectorTest {
* capabilities. * capabilities.
*/ */
@Test @Test
public void testSelectTracksPreferHigherNumChannelBeforeSampleRate() throws Exception { public void selectTracksPreferHigherNumChannelBeforeSampleRate() throws Exception {
Format higherChannelLowerSampleRateFormat = Format higherChannelLowerSampleRateFormat =
Format.createAudioSampleFormat( Format.createAudioSampleFormat(
"audioFormat", "audioFormat",
...@@ -844,12 +838,10 @@ public final class DefaultTrackSelectorTest { ...@@ -844,12 +838,10 @@ public final class DefaultTrackSelectorTest {
/** /**
* Tests that track selector will prefer audio tracks with higher sample rate over tracks with * Tests that track selector will prefer audio tracks with higher sample rate over tracks with
* higher bitrate when other factors are the same, and tracks are within renderer's * higher bitrate when other factors are the same, and tracks are within renderer's capabilities.
* capabilities.
*/ */
@Test @Test
public void testSelectTracksPreferHigherSampleRateBeforeBitrate() public void selectTracksPreferHigherSampleRateBeforeBitrate() throws Exception {
throws Exception {
Format higherSampleRateLowerBitrateFormat = Format higherSampleRateLowerBitrateFormat =
Format.createAudioSampleFormat("audioFormat", MimeTypes.AUDIO_AAC, null, 15000, Format.createAudioSampleFormat("audioFormat", MimeTypes.AUDIO_AAC, null, 15000,
Format.NO_VALUE, 2, 44100, null, null, 0, null); Format.NO_VALUE, 2, 44100, null, null, 0, null);
...@@ -873,8 +865,7 @@ public final class DefaultTrackSelectorTest { ...@@ -873,8 +865,7 @@ public final class DefaultTrackSelectorTest {
* are the same, and tracks exceed renderer's capabilities. * are the same, and tracks exceed renderer's capabilities.
*/ */
@Test @Test
public void testSelectTracksExceedingCapabilitiesSelectLowerNumChannel() public void selectTracksExceedingCapabilitiesSelectLowerNumChannel() throws Exception {
throws Exception {
Format higherChannelFormat = Format higherChannelFormat =
Format.createAudioSampleFormat( Format.createAudioSampleFormat(
"audioFormat", "audioFormat",
...@@ -907,8 +898,7 @@ public final class DefaultTrackSelectorTest { ...@@ -907,8 +898,7 @@ public final class DefaultTrackSelectorTest {
* are the same, and tracks exceed renderer's capabilities. * are the same, and tracks exceed renderer's capabilities.
*/ */
@Test @Test
public void testSelectTracksExceedingCapabilitiesSelectLowerSampleRate() public void selectTracksExceedingCapabilitiesSelectLowerSampleRate() throws Exception {
throws Exception {
Format lowerSampleRateFormat = Format lowerSampleRateFormat =
Format.createAudioSampleFormat("audioFormat", MimeTypes.AUDIO_AAC, null, Format.NO_VALUE, Format.createAudioSampleFormat("audioFormat", MimeTypes.AUDIO_AAC, null, Format.NO_VALUE,
Format.NO_VALUE, 2, 22050, null, null, 0, null); Format.NO_VALUE, 2, 22050, null, null, 0, null);
...@@ -927,12 +917,11 @@ public final class DefaultTrackSelectorTest { ...@@ -927,12 +917,11 @@ public final class DefaultTrackSelectorTest {
} }
/** /**
* Tests that track selector will select audio tracks with lower bit-rate when other factors * Tests that track selector will select audio tracks with lower bit-rate when other factors are
* are the same, and tracks exceed renderer's capabilities. * the same, and tracks exceed renderer's capabilities.
*/ */
@Test @Test
public void testSelectTracksExceedingCapabilitiesSelectLowerBitrate() public void selectTracksExceedingCapabilitiesSelectLowerBitrate() throws Exception {
throws Exception {
Format lowerBitrateFormat = Format lowerBitrateFormat =
Format.createAudioSampleFormat("audioFormat", MimeTypes.AUDIO_AAC, null, 15000, Format.createAudioSampleFormat("audioFormat", MimeTypes.AUDIO_AAC, null, 15000,
Format.NO_VALUE, 2, 44100, null, null, 0, null); Format.NO_VALUE, 2, 44100, null, null, 0, null);
...@@ -956,7 +945,7 @@ public final class DefaultTrackSelectorTest { ...@@ -956,7 +945,7 @@ public final class DefaultTrackSelectorTest {
* capabilities. * capabilities.
*/ */
@Test @Test
public void testSelectTracksExceedingCapabilitiesPreferLowerNumChannelBeforeSampleRate() public void selectTracksExceedingCapabilitiesPreferLowerNumChannelBeforeSampleRate()
throws Exception { throws Exception {
Format lowerChannelHigherSampleRateFormat = Format lowerChannelHigherSampleRateFormat =
Format.createAudioSampleFormat("audioFormat", MimeTypes.AUDIO_AAC, null, Format.NO_VALUE, Format.createAudioSampleFormat("audioFormat", MimeTypes.AUDIO_AAC, null, Format.NO_VALUE,
...@@ -978,11 +967,10 @@ public final class DefaultTrackSelectorTest { ...@@ -978,11 +967,10 @@ public final class DefaultTrackSelectorTest {
/** /**
* Tests that track selector will prefer audio tracks with lower sample rate over tracks with * Tests that track selector will prefer audio tracks with lower sample rate over tracks with
* lower bitrate when other factors are the same, and tracks are within renderer's * lower bitrate when other factors are the same, and tracks are within renderer's capabilities.
* capabilities.
*/ */
@Test @Test
public void testSelectTracksExceedingCapabilitiesPreferLowerSampleRateBeforeBitrate() public void selectTracksExceedingCapabilitiesPreferLowerSampleRateBeforeBitrate()
throws Exception { throws Exception {
Format higherSampleRateLowerBitrateFormat = Format higherSampleRateLowerBitrateFormat =
Format.createAudioSampleFormat("audioFormat", MimeTypes.AUDIO_AAC, null, 15000, Format.createAudioSampleFormat("audioFormat", MimeTypes.AUDIO_AAC, null, 15000,
...@@ -1004,7 +992,7 @@ public final class DefaultTrackSelectorTest { ...@@ -1004,7 +992,7 @@ public final class DefaultTrackSelectorTest {
/** Tests text track selection flags. */ /** Tests text track selection flags. */
@Test @Test
public void testTextTrackSelectionFlags() throws ExoPlaybackException { public void textTrackSelectionFlags() throws ExoPlaybackException {
Format forcedOnly = buildTextFormat("forcedOnly", "eng", C.SELECTION_FLAG_FORCED); Format forcedOnly = buildTextFormat("forcedOnly", "eng", C.SELECTION_FLAG_FORCED);
Format forcedDefault = Format forcedDefault =
buildTextFormat("forcedDefault", "eng", C.SELECTION_FLAG_FORCED | C.SELECTION_FLAG_DEFAULT); buildTextFormat("forcedDefault", "eng", C.SELECTION_FLAG_FORCED | C.SELECTION_FLAG_DEFAULT);
...@@ -1069,7 +1057,7 @@ public final class DefaultTrackSelectorTest { ...@@ -1069,7 +1057,7 @@ public final class DefaultTrackSelectorTest {
* audio language when no text language preferences match. * audio language when no text language preferences match.
*/ */
@Test @Test
public void testSelectingForcedTextTrackMatchesAudioLanguage() throws ExoPlaybackException { public void selectingForcedTextTrackMatchesAudioLanguage() throws ExoPlaybackException {
Format forcedEnglish = Format forcedEnglish =
buildTextFormat(/* id= */ "forcedEnglish", /* language= */ "eng", C.SELECTION_FLAG_FORCED); buildTextFormat(/* id= */ "forcedEnglish", /* language= */ "eng", C.SELECTION_FLAG_FORCED);
Format forcedGerman = Format forcedGerman =
...@@ -1122,11 +1110,11 @@ public final class DefaultTrackSelectorTest { ...@@ -1122,11 +1110,11 @@ public final class DefaultTrackSelectorTest {
/** /**
* Tests that the default track selector will select a text track with undetermined language if no * Tests that the default track selector will select a text track with undetermined language if no
* text track with the preferred language is available but * text track with the preferred language is available but {@link
* {@link Parameters#selectUndeterminedTextLanguage} is true. * Parameters#selectUndeterminedTextLanguage} is true.
*/ */
@Test @Test
public void testSelectUndeterminedTextLanguageAsFallback() throws ExoPlaybackException{ public void selectUndeterminedTextLanguageAsFallback() throws ExoPlaybackException {
Format spanish = buildTextFormat("spanish", "spa"); Format spanish = buildTextFormat("spanish", "spa");
Format german = buildTextFormat("german", "de"); Format german = buildTextFormat("german", "de");
Format undeterminedUnd = buildTextFormat("undeterminedUnd", "und"); Format undeterminedUnd = buildTextFormat("undeterminedUnd", "und");
...@@ -1170,7 +1158,7 @@ public final class DefaultTrackSelectorTest { ...@@ -1170,7 +1158,7 @@ public final class DefaultTrackSelectorTest {
/** Tests audio track selection when there are multiple audio renderers. */ /** Tests audio track selection when there are multiple audio renderers. */
@Test @Test
public void testSelectPreferredTextTrackMultipleRenderers() throws Exception { public void selectPreferredTextTrackMultipleRenderers() throws Exception {
Format english = buildTextFormat("en", "en"); Format english = buildTextFormat("en", "en");
Format german = buildTextFormat("de", "de"); Format german = buildTextFormat("de", "de");
...@@ -1216,7 +1204,7 @@ public final class DefaultTrackSelectorTest { ...@@ -1216,7 +1204,7 @@ public final class DefaultTrackSelectorTest {
* Parameters#forceLowestBitrate} is set. * Parameters#forceLowestBitrate} is set.
*/ */
@Test @Test
public void testSelectTracksWithinCapabilitiesAndForceLowestBitrateSelectLowerBitrate() public void selectTracksWithinCapabilitiesAndForceLowestBitrateSelectLowerBitrate()
throws Exception { throws Exception {
Format unsupportedLowBitrateFormat = buildAudioFormatWithBitrate("unsupportedLowBitrate", 5000); Format unsupportedLowBitrateFormat = buildAudioFormatWithBitrate("unsupportedLowBitrate", 5000);
Format lowerBitrateFormat = buildAudioFormatWithBitrate("lowBitrate", 15000); Format lowerBitrateFormat = buildAudioFormatWithBitrate("lowBitrate", 15000);
...@@ -1246,7 +1234,7 @@ public final class DefaultTrackSelectorTest { ...@@ -1246,7 +1234,7 @@ public final class DefaultTrackSelectorTest {
* Parameters#forceHighestSupportedBitrate} is set. * Parameters#forceHighestSupportedBitrate} is set.
*/ */
@Test @Test
public void testSelectTracksWithinCapabilitiesAndForceHighestBitrateSelectHigherBitrate() public void selectTracksWithinCapabilitiesAndForceHighestBitrateSelectHigherBitrate()
throws Exception { throws Exception {
Format lowerBitrateFormat = buildAudioFormatWithBitrate("lowerBitrateFormat", 5000); Format lowerBitrateFormat = buildAudioFormatWithBitrate("lowerBitrateFormat", 5000);
Format higherBitrateFormat = buildAudioFormatWithBitrate("higherBitrateFormat", 15000); Format higherBitrateFormat = buildAudioFormatWithBitrate("higherBitrateFormat", 15000);
...@@ -1273,7 +1261,7 @@ public final class DefaultTrackSelectorTest { ...@@ -1273,7 +1261,7 @@ public final class DefaultTrackSelectorTest {
} }
@Test @Test
public void testSelectTracksWithMultipleAudioTracks() throws Exception { public void selectTracksWithMultipleAudioTracks() throws Exception {
TrackGroupArray trackGroups = singleTrackGroup(buildAudioFormat("0"), buildAudioFormat("1")); TrackGroupArray trackGroups = singleTrackGroup(buildAudioFormat("0"), buildAudioFormat("1"));
TrackSelectorResult result = TrackSelectorResult result =
trackSelector.selectTracks( trackSelector.selectTracks(
...@@ -1315,7 +1303,7 @@ public final class DefaultTrackSelectorTest { ...@@ -1315,7 +1303,7 @@ public final class DefaultTrackSelectorTest {
} }
@Test @Test
public void testSelectTracksWithMultipleAudioTracksWithMixedSampleRates() throws Exception { public void selectTracksWithMultipleAudioTracksWithMixedSampleRates() throws Exception {
Format highSampleRateAudioFormat = Format highSampleRateAudioFormat =
buildAudioFormatWithSampleRate("44100", /* sampleRate= */ 44100); buildAudioFormatWithSampleRate("44100", /* sampleRate= */ 44100);
Format lowSampleRateAudioFormat = Format lowSampleRateAudioFormat =
...@@ -1350,7 +1338,7 @@ public final class DefaultTrackSelectorTest { ...@@ -1350,7 +1338,7 @@ public final class DefaultTrackSelectorTest {
} }
@Test @Test
public void testSelectTracksWithMultipleAudioTracksWithMixedMimeTypes() throws Exception { public void selectTracksWithMultipleAudioTracksWithMixedMimeTypes() throws Exception {
Format aacAudioFormat = buildAudioFormatWithMimeType("aac", MimeTypes.AUDIO_AAC); Format aacAudioFormat = buildAudioFormatWithMimeType("aac", MimeTypes.AUDIO_AAC);
Format opusAudioFormat = buildAudioFormatWithMimeType("opus", MimeTypes.AUDIO_OPUS); Format opusAudioFormat = buildAudioFormatWithMimeType("opus", MimeTypes.AUDIO_OPUS);
...@@ -1382,7 +1370,7 @@ public final class DefaultTrackSelectorTest { ...@@ -1382,7 +1370,7 @@ public final class DefaultTrackSelectorTest {
} }
@Test @Test
public void testSelectTracksWithMultipleAudioTracksWithMixedChannelCounts() throws Exception { public void selectTracksWithMultipleAudioTracksWithMixedChannelCounts() throws Exception {
Format stereoAudioFormat = Format stereoAudioFormat =
buildAudioFormatWithChannelCount("2-channels", /* channelCount= */ 2); buildAudioFormatWithChannelCount("2-channels", /* channelCount= */ 2);
Format surroundAudioFormat = Format surroundAudioFormat =
...@@ -1446,7 +1434,7 @@ public final class DefaultTrackSelectorTest { ...@@ -1446,7 +1434,7 @@ public final class DefaultTrackSelectorTest {
} }
@Test @Test
public void testSelectTracksWithMultipleAudioTracksOverrideReturnsAdaptiveTrackSelection() public void selectTracksWithMultipleAudioTracksOverrideReturnsAdaptiveTrackSelection()
throws Exception { throws Exception {
TrackGroupArray trackGroups = TrackGroupArray trackGroups =
singleTrackGroup(buildAudioFormat("0"), buildAudioFormat("1"), buildAudioFormat("2")); singleTrackGroup(buildAudioFormat("0"), buildAudioFormat("1"), buildAudioFormat("2"));
...@@ -1467,7 +1455,7 @@ public final class DefaultTrackSelectorTest { ...@@ -1467,7 +1455,7 @@ public final class DefaultTrackSelectorTest {
/** Tests audio track selection when there are multiple audio renderers. */ /** Tests audio track selection when there are multiple audio renderers. */
@Test @Test
public void testSelectPreferredAudioTrackMultipleRenderers() throws Exception { public void selectPreferredAudioTrackMultipleRenderers() throws Exception {
Format english = buildAudioFormatWithLanguage("en", "en"); Format english = buildAudioFormatWithLanguage("en", "en");
Format german = buildAudioFormatWithLanguage("de", "de"); Format german = buildAudioFormatWithLanguage("de", "de");
...@@ -1509,7 +1497,7 @@ public final class DefaultTrackSelectorTest { ...@@ -1509,7 +1497,7 @@ public final class DefaultTrackSelectorTest {
} }
@Test @Test
public void testSelectTracksWithMultipleVideoTracks() throws Exception { public void selectTracksWithMultipleVideoTracks() throws Exception {
TrackGroupArray trackGroups = singleTrackGroup(buildVideoFormat("0"), buildVideoFormat("1")); TrackGroupArray trackGroups = singleTrackGroup(buildVideoFormat("0"), buildVideoFormat("1"));
TrackSelectorResult result = TrackSelectorResult result =
trackSelector.selectTracks( trackSelector.selectTracks(
...@@ -1520,8 +1508,7 @@ public final class DefaultTrackSelectorTest { ...@@ -1520,8 +1508,7 @@ public final class DefaultTrackSelectorTest {
} }
@Test @Test
public void testSelectTracksWithMultipleVideoTracksWithNonSeamlessAdaptiveness() public void selectTracksWithMultipleVideoTracksWithNonSeamlessAdaptiveness() throws Exception {
throws Exception {
FakeRendererCapabilities nonSeamlessVideoCapabilities = FakeRendererCapabilities nonSeamlessVideoCapabilities =
new FakeRendererCapabilities(C.TRACK_TYPE_VIDEO, FORMAT_HANDLED | ADAPTIVE_NOT_SEAMLESS); new FakeRendererCapabilities(C.TRACK_TYPE_VIDEO, FORMAT_HANDLED | ADAPTIVE_NOT_SEAMLESS);
...@@ -1552,7 +1539,7 @@ public final class DefaultTrackSelectorTest { ...@@ -1552,7 +1539,7 @@ public final class DefaultTrackSelectorTest {
} }
@Test @Test
public void testSelectTracksWithMultipleVideoTracksWithMixedMimeTypes() throws Exception { public void selectTracksWithMultipleVideoTracksWithMixedMimeTypes() throws Exception {
Format h264VideoFormat = buildVideoFormatWithMimeType("h264", MimeTypes.VIDEO_H264); Format h264VideoFormat = buildVideoFormatWithMimeType("h264", MimeTypes.VIDEO_H264);
Format h265VideoFormat = buildVideoFormatWithMimeType("h265", MimeTypes.VIDEO_H265); Format h265VideoFormat = buildVideoFormatWithMimeType("h265", MimeTypes.VIDEO_H265);
...@@ -1584,7 +1571,7 @@ public final class DefaultTrackSelectorTest { ...@@ -1584,7 +1571,7 @@ public final class DefaultTrackSelectorTest {
} }
@Test @Test
public void testSelectTracksWithMultipleVideoTracksOverrideReturnsAdaptiveTrackSelection() public void selectTracksWithMultipleVideoTracksOverrideReturnsAdaptiveTrackSelection()
throws Exception { throws Exception {
TrackGroupArray trackGroups = TrackGroupArray trackGroups =
singleTrackGroup(buildVideoFormat("0"), buildVideoFormat("1"), buildVideoFormat("2")); singleTrackGroup(buildVideoFormat("0"), buildVideoFormat("1"), buildVideoFormat("2"));
......
...@@ -29,7 +29,7 @@ public final class AssetDataSourceTest { ...@@ -29,7 +29,7 @@ public final class AssetDataSourceTest {
private static final String DATA_PATH = "mp3/1024_incrementing_bytes.mp3"; private static final String DATA_PATH = "mp3/1024_incrementing_bytes.mp3";
@Test @Test
public void testReadFileUri() throws Exception { public void readFileUri() throws Exception {
AssetDataSource dataSource = new AssetDataSource(ApplicationProvider.getApplicationContext()); AssetDataSource dataSource = new AssetDataSource(ApplicationProvider.getApplicationContext());
DataSpec dataSpec = new DataSpec(Uri.parse("file:///android_asset/" + DATA_PATH)); DataSpec dataSpec = new DataSpec(Uri.parse("file:///android_asset/" + DATA_PATH));
TestUtil.assertDataSourceContent( TestUtil.assertDataSourceContent(
...@@ -40,7 +40,7 @@ public final class AssetDataSourceTest { ...@@ -40,7 +40,7 @@ public final class AssetDataSourceTest {
} }
@Test @Test
public void testReadAssetUri() throws Exception { public void readAssetUri() throws Exception {
AssetDataSource dataSource = new AssetDataSource(ApplicationProvider.getApplicationContext()); AssetDataSource dataSource = new AssetDataSource(ApplicationProvider.getApplicationContext());
DataSpec dataSpec = new DataSpec(Uri.parse("asset:///" + DATA_PATH)); DataSpec dataSpec = new DataSpec(Uri.parse("asset:///" + DATA_PATH));
TestUtil.assertDataSourceContent( TestUtil.assertDataSourceContent(
......
...@@ -33,17 +33,17 @@ public final class ByteArrayDataSourceTest { ...@@ -33,17 +33,17 @@ public final class ByteArrayDataSourceTest {
private static final byte[] TEST_DATA_ODD = new byte[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; private static final byte[] TEST_DATA_ODD = new byte[] {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
@Test @Test
public void testFullReadSingleBytes() { public void fullReadSingleBytes() {
readTestData(TEST_DATA, 0, C.LENGTH_UNSET, 1, 0, 1, false); readTestData(TEST_DATA, 0, C.LENGTH_UNSET, 1, 0, 1, false);
} }
@Test @Test
public void testFullReadAllBytes() { public void fullReadAllBytes() {
readTestData(TEST_DATA, 0, C.LENGTH_UNSET, 100, 0, 100, false); readTestData(TEST_DATA, 0, C.LENGTH_UNSET, 100, 0, 100, false);
} }
@Test @Test
public void testLimitReadSingleBytes() { public void limitReadSingleBytes() {
// Limit set to the length of the data. // Limit set to the length of the data.
readTestData(TEST_DATA, 0, TEST_DATA.length, 1, 0, 1, false); readTestData(TEST_DATA, 0, TEST_DATA.length, 1, 0, 1, false);
// And less. // And less.
...@@ -51,7 +51,7 @@ public final class ByteArrayDataSourceTest { ...@@ -51,7 +51,7 @@ public final class ByteArrayDataSourceTest {
} }
@Test @Test
public void testFullReadTwoBytes() { public void fullReadTwoBytes() {
// Try with the total data length an exact multiple of the size of each individual read. // Try with the total data length an exact multiple of the size of each individual read.
readTestData(TEST_DATA, 0, C.LENGTH_UNSET, 2, 0, 2, false); readTestData(TEST_DATA, 0, C.LENGTH_UNSET, 2, 0, 2, false);
// And not. // And not.
...@@ -59,7 +59,7 @@ public final class ByteArrayDataSourceTest { ...@@ -59,7 +59,7 @@ public final class ByteArrayDataSourceTest {
} }
@Test @Test
public void testLimitReadTwoBytes() { public void limitReadTwoBytes() {
// Try with the limit an exact multiple of the size of each individual read. // Try with the limit an exact multiple of the size of each individual read.
readTestData(TEST_DATA, 0, 6, 2, 0, 2, false); readTestData(TEST_DATA, 0, 6, 2, 0, 2, false);
// And not. // And not.
...@@ -67,7 +67,7 @@ public final class ByteArrayDataSourceTest { ...@@ -67,7 +67,7 @@ public final class ByteArrayDataSourceTest {
} }
@Test @Test
public void testReadFromValidOffsets() { public void readFromValidOffsets() {
// Read from an offset without bound. // Read from an offset without bound.
readTestData(TEST_DATA, 1, C.LENGTH_UNSET, 1, 0, 1, false); readTestData(TEST_DATA, 1, C.LENGTH_UNSET, 1, 0, 1, false);
// And with bound. // And with bound.
...@@ -79,7 +79,7 @@ public final class ByteArrayDataSourceTest { ...@@ -79,7 +79,7 @@ public final class ByteArrayDataSourceTest {
} }
@Test @Test
public void testReadFromInvalidOffsets() { public void readFromInvalidOffsets() {
// Read from first invalid offset and check failure without bound. // Read from first invalid offset and check failure without bound.
readTestData(TEST_DATA, TEST_DATA.length, C.LENGTH_UNSET, 1, 0, 1, true); readTestData(TEST_DATA, TEST_DATA.length, C.LENGTH_UNSET, 1, 0, 1, true);
// And with bound. // And with bound.
...@@ -87,7 +87,7 @@ public final class ByteArrayDataSourceTest { ...@@ -87,7 +87,7 @@ public final class ByteArrayDataSourceTest {
} }
@Test @Test
public void testReadWithInvalidLength() { public void readWithInvalidLength() {
// Read more data than is available. // Read more data than is available.
readTestData(TEST_DATA, 0, TEST_DATA.length + 1, 1, 0, 1, true); readTestData(TEST_DATA, 0, TEST_DATA.length + 1, 1, 0, 1, true);
// And with bound. // And with bound.
......
...@@ -44,7 +44,7 @@ public final class DataSchemeDataSourceTest { ...@@ -44,7 +44,7 @@ public final class DataSchemeDataSourceTest {
} }
@Test @Test
public void testBase64Data() throws IOException { public void base64Data() throws IOException {
DataSpec dataSpec = buildDataSpec(DATA_SCHEME_URI); DataSpec dataSpec = buildDataSpec(DATA_SCHEME_URI);
assertDataSourceContent( assertDataSourceContent(
schemeDataDataSource, schemeDataDataSource,
...@@ -55,7 +55,7 @@ public final class DataSchemeDataSourceTest { ...@@ -55,7 +55,7 @@ public final class DataSchemeDataSourceTest {
} }
@Test @Test
public void testAsciiData() throws IOException { public void asciiData() throws IOException {
assertDataSourceContent( assertDataSourceContent(
schemeDataDataSource, schemeDataDataSource,
buildDataSpec("data:,A%20brief%20note"), buildDataSpec("data:,A%20brief%20note"),
...@@ -63,7 +63,7 @@ public final class DataSchemeDataSourceTest { ...@@ -63,7 +63,7 @@ public final class DataSchemeDataSourceTest {
} }
@Test @Test
public void testPartialReads() throws IOException { public void partialReads() throws IOException {
byte[] buffer = new byte[18]; byte[] buffer = new byte[18];
DataSpec dataSpec = buildDataSpec("data:,012345678901234567"); DataSpec dataSpec = buildDataSpec("data:,012345678901234567");
assertThat(schemeDataDataSource.open(dataSpec)).isEqualTo(18); assertThat(schemeDataDataSource.open(dataSpec)).isEqualTo(18);
...@@ -76,7 +76,7 @@ public final class DataSchemeDataSourceTest { ...@@ -76,7 +76,7 @@ public final class DataSchemeDataSourceTest {
} }
@Test @Test
public void testSequentialRangeRequests() throws IOException { public void sequentialRangeRequests() throws IOException {
DataSpec dataSpec = DataSpec dataSpec =
buildDataSpec(DATA_SCHEME_URI, /* position= */ 1, /* length= */ C.LENGTH_UNSET); buildDataSpec(DATA_SCHEME_URI, /* position= */ 1, /* length= */ C.LENGTH_UNSET);
assertDataSourceContent( assertDataSourceContent(
...@@ -97,7 +97,7 @@ public final class DataSchemeDataSourceTest { ...@@ -97,7 +97,7 @@ public final class DataSchemeDataSourceTest {
} }
@Test @Test
public void testInvalidStartPositionRequest() throws IOException { public void invalidStartPositionRequest() throws IOException {
try { try {
// Try to open a range starting one byte beyond the resource's length. // Try to open a range starting one byte beyond the resource's length.
schemeDataDataSource.open( schemeDataDataSource.open(
...@@ -109,7 +109,7 @@ public final class DataSchemeDataSourceTest { ...@@ -109,7 +109,7 @@ public final class DataSchemeDataSourceTest {
} }
@Test @Test
public void testRangeExceedingResourceLengthRequest() throws IOException { public void rangeExceedingResourceLengthRequest() throws IOException {
try { try {
// Try to open a range exceeding the resource's length. // Try to open a range exceeding the resource's length.
schemeDataDataSource.open( schemeDataDataSource.open(
...@@ -121,7 +121,7 @@ public final class DataSchemeDataSourceTest { ...@@ -121,7 +121,7 @@ public final class DataSchemeDataSourceTest {
} }
@Test @Test
public void testIncorrectScheme() { public void incorrectScheme() {
try { try {
schemeDataDataSource.open(buildDataSpec("http://www.google.com")); schemeDataDataSource.open(buildDataSpec("http://www.google.com"));
fail(); fail();
...@@ -131,7 +131,7 @@ public final class DataSchemeDataSourceTest { ...@@ -131,7 +131,7 @@ public final class DataSchemeDataSourceTest {
} }
@Test @Test
public void testMalformedData() { public void malformedData() {
try { try {
schemeDataDataSource.open(buildDataSpec("data:text/plain;base64,,This%20is%20Content")); schemeDataDataSource.open(buildDataSpec("data:text/plain;base64,,This%20is%20Content"));
fail(); fail();
......
...@@ -33,7 +33,7 @@ public final class DataSourceInputStreamTest { ...@@ -33,7 +33,7 @@ public final class DataSourceInputStreamTest {
private static final byte[] TEST_DATA = TestUtil.buildTestData(16); private static final byte[] TEST_DATA = TestUtil.buildTestData(16);
@Test @Test
public void testReadSingleBytes() throws IOException { public void readSingleBytes() throws IOException {
DataSourceInputStream inputStream = buildTestInputStream(); DataSourceInputStream inputStream = buildTestInputStream();
// No bytes read yet. // No bytes read yet.
assertThat(inputStream.bytesRead()).isEqualTo(0); assertThat(inputStream.bytesRead()).isEqualTo(0);
...@@ -53,7 +53,7 @@ public final class DataSourceInputStreamTest { ...@@ -53,7 +53,7 @@ public final class DataSourceInputStreamTest {
} }
@Test @Test
public void testRead() throws IOException { public void read() throws IOException {
DataSourceInputStream inputStream = buildTestInputStream(); DataSourceInputStream inputStream = buildTestInputStream();
// Read bytes. // Read bytes.
byte[] readBytes = new byte[TEST_DATA.length]; byte[] readBytes = new byte[TEST_DATA.length];
...@@ -76,7 +76,7 @@ public final class DataSourceInputStreamTest { ...@@ -76,7 +76,7 @@ public final class DataSourceInputStreamTest {
} }
@Test @Test
public void testSkip() throws IOException { public void skip() throws IOException {
DataSourceInputStream inputStream = buildTestInputStream(); DataSourceInputStream inputStream = buildTestInputStream();
// Skip bytes. // Skip bytes.
long totalBytesSkipped = 0; long totalBytesSkipped = 0;
......
...@@ -91,7 +91,7 @@ public final class CacheDataSourceTest { ...@@ -91,7 +91,7 @@ public final class CacheDataSourceTest {
} }
@Test @Test
public void testFragmentSize() throws Exception { public void fragmentSize() throws Exception {
CacheDataSource cacheDataSource = createCacheDataSource(false, false); CacheDataSource cacheDataSource = createCacheDataSource(false, false);
assertReadDataContentLength(cacheDataSource, boundedDataSpec, false, false); assertReadDataContentLength(cacheDataSource, boundedDataSpec, false, false);
for (String key : cache.getKeys()) { for (String key : cache.getKeys()) {
...@@ -103,27 +103,27 @@ public final class CacheDataSourceTest { ...@@ -103,27 +103,27 @@ public final class CacheDataSourceTest {
} }
@Test @Test
public void testCacheAndReadUnboundedRequest() throws Exception { public void cacheAndReadUnboundedRequest() throws Exception {
assertCacheAndRead(unboundedDataSpec, /* unknownLength= */ false); assertCacheAndRead(unboundedDataSpec, /* unknownLength= */ false);
} }
@Test @Test
public void testCacheAndReadUnknownLength() throws Exception { public void cacheAndReadUnknownLength() throws Exception {
assertCacheAndRead(boundedDataSpec, /* unknownLength= */ true); assertCacheAndRead(boundedDataSpec, /* unknownLength= */ true);
} }
@Test @Test
public void testCacheAndReadUnboundedRequestUnknownLength() throws Exception { public void cacheAndReadUnboundedRequestUnknownLength() throws Exception {
assertCacheAndRead(unboundedDataSpec, /* unknownLength= */ true); assertCacheAndRead(unboundedDataSpec, /* unknownLength= */ true);
} }
@Test @Test
public void testCacheAndRead() throws Exception { public void cacheAndRead() throws Exception {
assertCacheAndRead(boundedDataSpec, /* unknownLength= */ false); assertCacheAndRead(boundedDataSpec, /* unknownLength= */ false);
} }
@Test @Test
public void testPropagatesHttpHeadersUpstream() throws Exception { public void propagatesHttpHeadersUpstream() throws Exception {
CacheDataSource cacheDataSource = CacheDataSource cacheDataSource =
createCacheDataSource(/* setReadException= */ false, /* unknownLength= */ false); createCacheDataSource(/* setReadException= */ false, /* unknownLength= */ false);
DataSpec dataSpec = buildDataSpec(/* position= */ 2, /* length= */ 5); DataSpec dataSpec = buildDataSpec(/* position= */ 2, /* length= */ 5);
...@@ -136,7 +136,7 @@ public final class CacheDataSourceTest { ...@@ -136,7 +136,7 @@ public final class CacheDataSourceTest {
} }
@Test @Test
public void testUnsatisfiableRange() throws Exception { public void unsatisfiableRange() throws Exception {
// Bounded request but the content length is unknown. This forces all data to be cached but not // Bounded request but the content length is unknown. This forces all data to be cached but not
// the length. // the length.
assertCacheAndRead(boundedDataSpec, /* unknownLength= */ true); assertCacheAndRead(boundedDataSpec, /* unknownLength= */ true);
...@@ -160,13 +160,13 @@ public final class CacheDataSourceTest { ...@@ -160,13 +160,13 @@ public final class CacheDataSourceTest {
} }
@Test @Test
public void testCacheAndReadUnboundedRequestWithCacheKeyFactoryWithNullDataSpecCacheKey() public void cacheAndReadUnboundedRequestWithCacheKeyFactoryWithNullDataSpecCacheKey()
throws Exception { throws Exception {
assertCacheAndRead(unboundedDataSpec, /* unknownLength= */ false, cacheKeyFactory); assertCacheAndRead(unboundedDataSpec, /* unknownLength= */ false, cacheKeyFactory);
} }
@Test @Test
public void testCacheAndReadUnknownLengthWithCacheKeyFactoryOverridingWithNullDataSpecCacheKey() public void cacheAndReadUnknownLengthWithCacheKeyFactoryOverridingWithNullDataSpecCacheKey()
throws Exception { throws Exception {
assertCacheAndRead(boundedDataSpec, /* unknownLength= */ true, cacheKeyFactory); assertCacheAndRead(boundedDataSpec, /* unknownLength= */ true, cacheKeyFactory);
} }
...@@ -179,12 +179,12 @@ public final class CacheDataSourceTest { ...@@ -179,12 +179,12 @@ public final class CacheDataSourceTest {
} }
@Test @Test
public void testCacheAndReadWithCacheKeyFactoryWithNullDataSpecCacheKey() throws Exception { public void cacheAndReadWithCacheKeyFactoryWithNullDataSpecCacheKey() throws Exception {
assertCacheAndRead(boundedDataSpec, /* unknownLength= */ false, cacheKeyFactory); assertCacheAndRead(boundedDataSpec, /* unknownLength= */ false, cacheKeyFactory);
} }
@Test @Test
public void testUnsatisfiableRangeWithCacheKeyFactoryNullDataSpecCacheKey() throws Exception { public void unsatisfiableRangeWithCacheKeyFactoryNullDataSpecCacheKey() throws Exception {
// Bounded request but the content length is unknown. This forces all data to be cached but not // Bounded request but the content length is unknown. This forces all data to be cached but not
// the length. // the length.
assertCacheAndRead(boundedDataSpec, /* unknownLength= */ true, cacheKeyFactory); assertCacheAndRead(boundedDataSpec, /* unknownLength= */ true, cacheKeyFactory);
...@@ -210,13 +210,13 @@ public final class CacheDataSourceTest { ...@@ -210,13 +210,13 @@ public final class CacheDataSourceTest {
} }
@Test @Test
public void testCacheAndReadUnboundedRequestWithCacheKeyFactoryOverridingDataSpecCacheKey() public void cacheAndReadUnboundedRequestWithCacheKeyFactoryOverridingDataSpecCacheKey()
throws Exception { throws Exception {
assertCacheAndRead(unboundedDataSpecWithKey, false, cacheKeyFactory); assertCacheAndRead(unboundedDataSpecWithKey, false, cacheKeyFactory);
} }
@Test @Test
public void testCacheAndReadUnknownLengthWithCacheKeyFactoryOverridingDataSpecCacheKey() public void cacheAndReadUnknownLengthWithCacheKeyFactoryOverridingDataSpecCacheKey()
throws Exception { throws Exception {
assertCacheAndRead(boundedDataSpecWithKey, true, cacheKeyFactory); assertCacheAndRead(boundedDataSpecWithKey, true, cacheKeyFactory);
} }
...@@ -229,13 +229,12 @@ public final class CacheDataSourceTest { ...@@ -229,13 +229,12 @@ public final class CacheDataSourceTest {
} }
@Test @Test
public void testCacheAndReadWithCacheKeyFactoryOverridingDataSpecCacheKey() throws Exception { public void cacheAndReadWithCacheKeyFactoryOverridingDataSpecCacheKey() throws Exception {
assertCacheAndRead(boundedDataSpecWithKey, /* unknownLength= */ false, cacheKeyFactory); assertCacheAndRead(boundedDataSpecWithKey, /* unknownLength= */ false, cacheKeyFactory);
} }
@Test @Test
public void testUnsatisfiableRangeWithCacheKeyFactoryOverridingDataSpecCacheKey() public void unsatisfiableRangeWithCacheKeyFactoryOverridingDataSpecCacheKey() throws Exception {
throws Exception {
// Bounded request but the content length is unknown. This forces all data to be cached but not // Bounded request but the content length is unknown. This forces all data to be cached but not
// the length. // the length.
assertCacheAndRead(boundedDataSpecWithKey, /* unknownLength= */ true, cacheKeyFactory); assertCacheAndRead(boundedDataSpecWithKey, /* unknownLength= */ true, cacheKeyFactory);
...@@ -264,7 +263,7 @@ public final class CacheDataSourceTest { ...@@ -264,7 +263,7 @@ public final class CacheDataSourceTest {
} }
@Test @Test
public void testContentLengthEdgeCases() throws Exception { public void contentLengthEdgeCases() throws Exception {
DataSpec dataSpec = buildDataSpec(TEST_DATA.length - 2, 2); DataSpec dataSpec = buildDataSpec(TEST_DATA.length - 2, 2);
// Read partial at EOS but don't cross it so length is unknown. // Read partial at EOS but don't cross it so length is unknown.
...@@ -291,7 +290,7 @@ public final class CacheDataSourceTest { ...@@ -291,7 +290,7 @@ public final class CacheDataSourceTest {
} }
@Test @Test
public void testUnknownLengthContentReadInOneConnectionAndLengthIsResolved() throws Exception { public void unknownLengthContentReadInOneConnectionAndLengthIsResolved() throws Exception {
FakeDataSource upstream = new FakeDataSource(); FakeDataSource upstream = new FakeDataSource();
upstream upstream
.getDataSet() .getDataSet()
...@@ -310,7 +309,7 @@ public final class CacheDataSourceTest { ...@@ -310,7 +309,7 @@ public final class CacheDataSourceTest {
} }
@Test @Test
public void testIgnoreCacheForUnsetLengthRequests() throws Exception { public void ignoreCacheForUnsetLengthRequests() throws Exception {
FakeDataSource upstream = new FakeDataSource(); FakeDataSource upstream = new FakeDataSource();
upstream.getDataSet().setData(testDataUri, TEST_DATA); upstream.getDataSet().setData(testDataUri, TEST_DATA);
CacheDataSource cacheDataSource = CacheDataSource cacheDataSource =
...@@ -325,14 +324,14 @@ public final class CacheDataSourceTest { ...@@ -325,14 +324,14 @@ public final class CacheDataSourceTest {
} }
@Test @Test
public void testReadOnlyCache() throws Exception { public void readOnlyCache() throws Exception {
CacheDataSource cacheDataSource = createCacheDataSource(false, false, 0, null); CacheDataSource cacheDataSource = createCacheDataSource(false, false, 0, null);
assertReadDataContentLength(cacheDataSource, boundedDataSpec, false, false); assertReadDataContentLength(cacheDataSource, boundedDataSpec, false, false);
assertCacheEmpty(cache); assertCacheEmpty(cache);
} }
@Test @Test
public void testSwitchToCacheSourceWithReadOnlyCacheDataSource() throws Exception { public void switchToCacheSourceWithReadOnlyCacheDataSource() throws Exception {
// Create a fake data source with a 1 MB default data. // Create a fake data source with a 1 MB default data.
FakeDataSource upstream = new FakeDataSource(); FakeDataSource upstream = new FakeDataSource();
FakeData fakeData = upstream.getDataSet().newDefaultData().appendReadData(1024 * 1024 - 1); FakeData fakeData = upstream.getDataSet().newDefaultData().appendReadData(1024 * 1024 - 1);
...@@ -372,7 +371,7 @@ public final class CacheDataSourceTest { ...@@ -372,7 +371,7 @@ public final class CacheDataSourceTest {
} }
@Test @Test
public void testSwitchToCacheSourceWithNonBlockingCacheDataSource() throws Exception { public void switchToCacheSourceWithNonBlockingCacheDataSource() throws Exception {
// Create a fake data source with a 1 MB default data. // Create a fake data source with a 1 MB default data.
FakeDataSource upstream = new FakeDataSource(); FakeDataSource upstream = new FakeDataSource();
FakeData fakeData = upstream.getDataSet().newDefaultData().appendReadData(1024 * 1024 - 1); FakeData fakeData = upstream.getDataSet().newDefaultData().appendReadData(1024 * 1024 - 1);
...@@ -421,7 +420,7 @@ public final class CacheDataSourceTest { ...@@ -421,7 +420,7 @@ public final class CacheDataSourceTest {
} }
@Test @Test
public void testDeleteCachedWhileReadingFromUpstreamWithReadOnlyCacheDataSourceDoesNotCrash() public void deleteCachedWhileReadingFromUpstreamWithReadOnlyCacheDataSourceDoesNotCrash()
throws Exception { throws Exception {
// Create a fake data source with a 1 KB default data. // Create a fake data source with a 1 KB default data.
FakeDataSource upstream = new FakeDataSource(); FakeDataSource upstream = new FakeDataSource();
...@@ -457,7 +456,7 @@ public final class CacheDataSourceTest { ...@@ -457,7 +456,7 @@ public final class CacheDataSourceTest {
} }
@Test @Test
public void testDeleteCachedWhileReadingFromUpstreamWithBlockingCacheDataSourceDoesNotBlock() public void deleteCachedWhileReadingFromUpstreamWithBlockingCacheDataSourceDoesNotBlock()
throws Exception { throws Exception {
// Create a fake data source with a 1 KB default data. // Create a fake data source with a 1 KB default data.
FakeDataSource upstream = new FakeDataSource(); FakeDataSource upstream = new FakeDataSource();
......
...@@ -105,7 +105,7 @@ public final class CacheUtilTest { ...@@ -105,7 +105,7 @@ public final class CacheUtilTest {
} }
@Test @Test
public void testGenerateKey() { public void generateKey() {
assertThat(CacheUtil.generateKey(Uri.EMPTY)).isNotNull(); assertThat(CacheUtil.generateKey(Uri.EMPTY)).isNotNull();
Uri testUri = Uri.parse("test"); Uri testUri = Uri.parse("test");
...@@ -120,7 +120,7 @@ public final class CacheUtilTest { ...@@ -120,7 +120,7 @@ public final class CacheUtilTest {
} }
@Test @Test
public void testDefaultCacheKeyFactory_buildCacheKey() { public void defaultCacheKeyFactory_buildCacheKey() {
Uri testUri = Uri.parse("test"); Uri testUri = Uri.parse("test");
String key = "key"; String key = "key";
// If DataSpec.key is present, returns it. // If DataSpec.key is present, returns it.
...@@ -136,7 +136,7 @@ public final class CacheUtilTest { ...@@ -136,7 +136,7 @@ public final class CacheUtilTest {
} }
@Test @Test
public void testGetCachedNoData() { public void getCachedNoData() {
Pair<Long, Long> contentLengthAndBytesCached = Pair<Long, Long> contentLengthAndBytesCached =
CacheUtil.getCached( CacheUtil.getCached(
new DataSpec(Uri.parse("test")), mockCache, /* cacheKeyFactory= */ null); new DataSpec(Uri.parse("test")), mockCache, /* cacheKeyFactory= */ null);
...@@ -146,7 +146,7 @@ public final class CacheUtilTest { ...@@ -146,7 +146,7 @@ public final class CacheUtilTest {
} }
@Test @Test
public void testGetCachedDataUnknownLength() { public void getCachedDataUnknownLength() {
// Mock there is 100 bytes cached at the beginning // Mock there is 100 bytes cached at the beginning
mockCache.spansAndGaps = new int[] {100}; mockCache.spansAndGaps = new int[] {100};
Pair<Long, Long> contentLengthAndBytesCached = Pair<Long, Long> contentLengthAndBytesCached =
...@@ -158,7 +158,7 @@ public final class CacheUtilTest { ...@@ -158,7 +158,7 @@ public final class CacheUtilTest {
} }
@Test @Test
public void testGetCachedNoDataKnownLength() { public void getCachedNoDataKnownLength() {
mockCache.contentLength = 1000; mockCache.contentLength = 1000;
Pair<Long, Long> contentLengthAndBytesCached = Pair<Long, Long> contentLengthAndBytesCached =
CacheUtil.getCached( CacheUtil.getCached(
...@@ -169,7 +169,7 @@ public final class CacheUtilTest { ...@@ -169,7 +169,7 @@ public final class CacheUtilTest {
} }
@Test @Test
public void testGetCached() { public void getCached() {
mockCache.contentLength = 1000; mockCache.contentLength = 1000;
mockCache.spansAndGaps = new int[] {100, 100, 200}; mockCache.spansAndGaps = new int[] {100, 100, 200};
Pair<Long, Long> contentLengthAndBytesCached = Pair<Long, Long> contentLengthAndBytesCached =
...@@ -181,7 +181,7 @@ public final class CacheUtilTest { ...@@ -181,7 +181,7 @@ public final class CacheUtilTest {
} }
@Test @Test
public void testGetCachedFromNonZeroPosition() { public void getCachedFromNonZeroPosition() {
mockCache.contentLength = 1000; mockCache.contentLength = 1000;
mockCache.spansAndGaps = new int[] {100, 100, 200}; mockCache.spansAndGaps = new int[] {100, 100, 200};
Pair<Long, Long> contentLengthAndBytesCached = Pair<Long, Long> contentLengthAndBytesCached =
...@@ -195,7 +195,7 @@ public final class CacheUtilTest { ...@@ -195,7 +195,7 @@ public final class CacheUtilTest {
} }
@Test @Test
public void testCache() throws Exception { public void cache() throws Exception {
FakeDataSet fakeDataSet = new FakeDataSet().setRandomData("test_data", 100); FakeDataSet fakeDataSet = new FakeDataSet().setRandomData("test_data", 100);
FakeDataSource dataSource = new FakeDataSource(fakeDataSet); FakeDataSource dataSource = new FakeDataSource(fakeDataSet);
...@@ -213,7 +213,7 @@ public final class CacheUtilTest { ...@@ -213,7 +213,7 @@ public final class CacheUtilTest {
} }
@Test @Test
public void testCacheSetOffsetAndLength() throws Exception { public void cacheSetOffsetAndLength() throws Exception {
FakeDataSet fakeDataSet = new FakeDataSet().setRandomData("test_data", 100); FakeDataSet fakeDataSet = new FakeDataSet().setRandomData("test_data", 100);
FakeDataSource dataSource = new FakeDataSource(fakeDataSet); FakeDataSource dataSource = new FakeDataSource(fakeDataSet);
...@@ -239,7 +239,7 @@ public final class CacheUtilTest { ...@@ -239,7 +239,7 @@ public final class CacheUtilTest {
} }
@Test @Test
public void testCacheUnknownLength() throws Exception { public void cacheUnknownLength() throws Exception {
FakeDataSet fakeDataSet = new FakeDataSet().newData("test_data") FakeDataSet fakeDataSet = new FakeDataSet().newData("test_data")
.setSimulateUnknownLength(true) .setSimulateUnknownLength(true)
.appendReadData(TestUtil.buildTestData(100)).endData(); .appendReadData(TestUtil.buildTestData(100)).endData();
...@@ -255,7 +255,7 @@ public final class CacheUtilTest { ...@@ -255,7 +255,7 @@ public final class CacheUtilTest {
} }
@Test @Test
public void testCacheUnknownLengthPartialCaching() throws Exception { public void cacheUnknownLengthPartialCaching() throws Exception {
FakeDataSet fakeDataSet = new FakeDataSet().newData("test_data") FakeDataSet fakeDataSet = new FakeDataSet().newData("test_data")
.setSimulateUnknownLength(true) .setSimulateUnknownLength(true)
.appendReadData(TestUtil.buildTestData(100)).endData(); .appendReadData(TestUtil.buildTestData(100)).endData();
...@@ -283,7 +283,7 @@ public final class CacheUtilTest { ...@@ -283,7 +283,7 @@ public final class CacheUtilTest {
} }
@Test @Test
public void testCacheLengthExceedsActualDataLength() throws Exception { public void cacheLengthExceedsActualDataLength() throws Exception {
FakeDataSet fakeDataSet = new FakeDataSet().setRandomData("test_data", 100); FakeDataSet fakeDataSet = new FakeDataSet().setRandomData("test_data", 100);
FakeDataSource dataSource = new FakeDataSource(fakeDataSet); FakeDataSource dataSource = new FakeDataSource(fakeDataSet);
...@@ -298,7 +298,7 @@ public final class CacheUtilTest { ...@@ -298,7 +298,7 @@ public final class CacheUtilTest {
} }
@Test @Test
public void testCacheThrowEOFException() throws Exception { public void cacheThrowEOFException() throws Exception {
FakeDataSet fakeDataSet = new FakeDataSet().setRandomData("test_data", 100); FakeDataSet fakeDataSet = new FakeDataSet().setRandomData("test_data", 100);
FakeDataSource dataSource = new FakeDataSource(fakeDataSet); FakeDataSource dataSource = new FakeDataSource(fakeDataSet);
...@@ -324,7 +324,7 @@ public final class CacheUtilTest { ...@@ -324,7 +324,7 @@ public final class CacheUtilTest {
} }
@Test @Test
public void testCachePolling() throws Exception { public void cachePolling() throws Exception {
final CachingCounters counters = new CachingCounters(); final CachingCounters counters = new CachingCounters();
FakeDataSet fakeDataSet = FakeDataSet fakeDataSet =
new FakeDataSet() new FakeDataSet()
...@@ -350,7 +350,7 @@ public final class CacheUtilTest { ...@@ -350,7 +350,7 @@ public final class CacheUtilTest {
} }
@Test @Test
public void testRemove() throws Exception { public void remove() throws Exception {
FakeDataSet fakeDataSet = new FakeDataSet().setRandomData("test_data", 100); FakeDataSet fakeDataSet = new FakeDataSet().setRandomData("test_data", 100);
FakeDataSource dataSource = new FakeDataSource(fakeDataSet); FakeDataSource dataSource = new FakeDataSource(fakeDataSet);
......
...@@ -89,7 +89,7 @@ public class CachedContentIndexTest { ...@@ -89,7 +89,7 @@ public class CachedContentIndexTest {
} }
@Test @Test
public void testAddGetRemove() throws Exception { public void addGetRemove() throws Exception {
final String key1 = "key1"; final String key1 = "key1";
final String key2 = "key2"; final String key2 = "key2";
final String key3 = "key3"; final String key3 = "key3";
...@@ -144,12 +144,12 @@ public class CachedContentIndexTest { ...@@ -144,12 +144,12 @@ public class CachedContentIndexTest {
} }
@Test @Test
public void testLegacyStoreAndLoad() throws Exception { public void legacyStoreAndLoad() throws Exception {
assertStoredAndLoadedEqual(newLegacyInstance(), newLegacyInstance()); assertStoredAndLoadedEqual(newLegacyInstance(), newLegacyInstance());
} }
@Test @Test
public void testLegacyLoadV1() throws Exception { public void legacyLoadV1() throws Exception {
CachedContentIndex index = newLegacyInstance(); CachedContentIndex index = newLegacyInstance();
FileOutputStream fos = FileOutputStream fos =
...@@ -170,7 +170,7 @@ public class CachedContentIndexTest { ...@@ -170,7 +170,7 @@ public class CachedContentIndexTest {
} }
@Test @Test
public void testLegacyLoadV2() throws Exception { public void legacyLoadV2() throws Exception {
CachedContentIndex index = newLegacyInstance(); CachedContentIndex index = newLegacyInstance();
FileOutputStream fos = FileOutputStream fos =
...@@ -192,7 +192,7 @@ public class CachedContentIndexTest { ...@@ -192,7 +192,7 @@ public class CachedContentIndexTest {
} }
@Test @Test
public void testAssignIdForKeyAndGetKeyForId() { public void assignIdForKeyAndGetKeyForId() {
CachedContentIndex index = newInstance(); CachedContentIndex index = newInstance();
final String key1 = "key1"; final String key1 = "key1";
final String key2 = "key2"; final String key2 = "key2";
...@@ -206,7 +206,7 @@ public class CachedContentIndexTest { ...@@ -206,7 +206,7 @@ public class CachedContentIndexTest {
} }
@Test @Test
public void testGetNewId() { public void getNewId() {
SparseArray<String> idToKey = new SparseArray<>(); SparseArray<String> idToKey = new SparseArray<>();
assertThat(CachedContentIndex.getNewId(idToKey)).isEqualTo(0); assertThat(CachedContentIndex.getNewId(idToKey)).isEqualTo(0);
idToKey.put(10, ""); idToKey.put(10, "");
...@@ -218,7 +218,7 @@ public class CachedContentIndexTest { ...@@ -218,7 +218,7 @@ public class CachedContentIndexTest {
} }
@Test @Test
public void testLegacyEncryption() throws Exception { public void legacyEncryption() throws Exception {
byte[] key = Util.getUtf8Bytes("Bar12345Bar12345"); // 128 bit key byte[] key = Util.getUtf8Bytes("Bar12345Bar12345"); // 128 bit key
byte[] key2 = Util.getUtf8Bytes("Foo12345Foo12345"); // 128 bit key byte[] key2 = Util.getUtf8Bytes("Foo12345Foo12345"); // 128 bit key
...@@ -270,7 +270,7 @@ public class CachedContentIndexTest { ...@@ -270,7 +270,7 @@ public class CachedContentIndexTest {
} }
@Test @Test
public void testRemoveEmptyNotLockedCachedContent() { public void removeEmptyNotLockedCachedContent() {
CachedContentIndex index = newInstance(); CachedContentIndex index = newInstance();
CachedContent cachedContent = index.getOrAdd("key1"); CachedContent cachedContent = index.getOrAdd("key1");
...@@ -280,7 +280,7 @@ public class CachedContentIndexTest { ...@@ -280,7 +280,7 @@ public class CachedContentIndexTest {
} }
@Test @Test
public void testCantRemoveNotEmptyCachedContent() throws Exception { public void cantRemoveNotEmptyCachedContent() throws Exception {
CachedContentIndex index = newInstance(); CachedContentIndex index = newInstance();
CachedContent cachedContent = index.getOrAdd("key1"); CachedContent cachedContent = index.getOrAdd("key1");
...@@ -298,7 +298,7 @@ public class CachedContentIndexTest { ...@@ -298,7 +298,7 @@ public class CachedContentIndexTest {
} }
@Test @Test
public void testCantRemoveLockedCachedContent() { public void cantRemoveLockedCachedContent() {
CachedContentIndex index = newInstance(); CachedContentIndex index = newInstance();
CachedContent cachedContent = index.getOrAdd("key1"); CachedContent cachedContent = index.getOrAdd("key1");
cachedContent.setLocked(true); cachedContent.setLocked(true);
......
...@@ -75,13 +75,13 @@ public final class CachedRegionTrackerTest { ...@@ -75,13 +75,13 @@ public final class CachedRegionTrackerTest {
} }
@Test @Test
public void testGetRegion_noSpansInCache() { public void getRegion_noSpansInCache() {
assertThat(tracker.getRegionEndTimeMs(100)).isEqualTo(CachedRegionTracker.NOT_CACHED); assertThat(tracker.getRegionEndTimeMs(100)).isEqualTo(CachedRegionTracker.NOT_CACHED);
assertThat(tracker.getRegionEndTimeMs(150)).isEqualTo(CachedRegionTracker.NOT_CACHED); assertThat(tracker.getRegionEndTimeMs(150)).isEqualTo(CachedRegionTracker.NOT_CACHED);
} }
@Test @Test
public void testGetRegion_fullyCached() throws Exception { public void getRegion_fullyCached() throws Exception {
tracker.onSpanAdded(cache, newCacheSpan(100, 100)); tracker.onSpanAdded(cache, newCacheSpan(100, 100));
assertThat(tracker.getRegionEndTimeMs(101)).isEqualTo(CachedRegionTracker.CACHED_TO_END); assertThat(tracker.getRegionEndTimeMs(101)).isEqualTo(CachedRegionTracker.CACHED_TO_END);
...@@ -89,7 +89,7 @@ public final class CachedRegionTrackerTest { ...@@ -89,7 +89,7 @@ public final class CachedRegionTrackerTest {
} }
@Test @Test
public void testGetRegion_partiallyCached() throws Exception { public void getRegion_partiallyCached() throws Exception {
tracker.onSpanAdded(cache, newCacheSpan(100, 40)); tracker.onSpanAdded(cache, newCacheSpan(100, 40));
assertThat(tracker.getRegionEndTimeMs(101)).isEqualTo(200); assertThat(tracker.getRegionEndTimeMs(101)).isEqualTo(200);
...@@ -97,7 +97,7 @@ public final class CachedRegionTrackerTest { ...@@ -97,7 +97,7 @@ public final class CachedRegionTrackerTest {
} }
@Test @Test
public void testGetRegion_multipleSpanAddsJoinedCorrectly() throws Exception { public void getRegion_multipleSpanAddsJoinedCorrectly() throws Exception {
tracker.onSpanAdded(cache, newCacheSpan(100, 20)); tracker.onSpanAdded(cache, newCacheSpan(100, 20));
tracker.onSpanAdded(cache, newCacheSpan(120, 20)); tracker.onSpanAdded(cache, newCacheSpan(120, 20));
...@@ -106,7 +106,7 @@ public final class CachedRegionTrackerTest { ...@@ -106,7 +106,7 @@ public final class CachedRegionTrackerTest {
} }
@Test @Test
public void testGetRegion_fullyCachedThenPartiallyRemoved() throws Exception { public void getRegion_fullyCachedThenPartiallyRemoved() throws Exception {
// Start with the full stream in cache. // Start with the full stream in cache.
tracker.onSpanAdded(cache, newCacheSpan(100, 100)); tracker.onSpanAdded(cache, newCacheSpan(100, 100));
...@@ -120,7 +120,7 @@ public final class CachedRegionTrackerTest { ...@@ -120,7 +120,7 @@ public final class CachedRegionTrackerTest {
} }
@Test @Test
public void testGetRegion_subchunkEstimation() throws Exception { public void getRegion_subchunkEstimation() throws Exception {
tracker.onSpanAdded(cache, newCacheSpan(100, 10)); tracker.onSpanAdded(cache, newCacheSpan(100, 10));
assertThat(tracker.getRegionEndTimeMs(101)).isEqualTo(50); assertThat(tracker.getRegionEndTimeMs(101)).isEqualTo(50);
......
...@@ -34,35 +34,35 @@ public class DefaultContentMetadataTest { ...@@ -34,35 +34,35 @@ public class DefaultContentMetadataTest {
} }
@Test @Test
public void testContainsReturnsFalseWhenEmpty() throws Exception { public void containsReturnsFalseWhenEmpty() throws Exception {
assertThat(contentMetadata.contains("test metadata")).isFalse(); assertThat(contentMetadata.contains("test metadata")).isFalse();
} }
@Test @Test
public void testContainsReturnsTrueForInitialValue() throws Exception { public void containsReturnsTrueForInitialValue() throws Exception {
contentMetadata = createContentMetadata("metadata name", "value"); contentMetadata = createContentMetadata("metadata name", "value");
assertThat(contentMetadata.contains("metadata name")).isTrue(); assertThat(contentMetadata.contains("metadata name")).isTrue();
} }
@Test @Test
public void testGetReturnsDefaultValueWhenValueIsNotAvailable() throws Exception { public void getReturnsDefaultValueWhenValueIsNotAvailable() throws Exception {
assertThat(contentMetadata.get("metadata name", "default value")).isEqualTo("default value"); assertThat(contentMetadata.get("metadata name", "default value")).isEqualTo("default value");
} }
@Test @Test
public void testGetReturnsInitialValue() throws Exception { public void getReturnsInitialValue() throws Exception {
contentMetadata = createContentMetadata("metadata name", "value"); contentMetadata = createContentMetadata("metadata name", "value");
assertThat(contentMetadata.get("metadata name", "default value")).isEqualTo("value"); assertThat(contentMetadata.get("metadata name", "default value")).isEqualTo("value");
} }
@Test @Test
public void testEmptyMutationDoesNotFail() throws Exception { public void emptyMutationDoesNotFail() throws Exception {
ContentMetadataMutations mutations = new ContentMetadataMutations(); ContentMetadataMutations mutations = new ContentMetadataMutations();
DefaultContentMetadata.EMPTY.copyWithMutationsApplied(mutations); DefaultContentMetadata.EMPTY.copyWithMutationsApplied(mutations);
} }
@Test @Test
public void testAddNewMetadata() throws Exception { public void addNewMetadata() throws Exception {
ContentMetadataMutations mutations = new ContentMetadataMutations(); ContentMetadataMutations mutations = new ContentMetadataMutations();
mutations.set("metadata name", "value"); mutations.set("metadata name", "value");
contentMetadata = contentMetadata.copyWithMutationsApplied(mutations); contentMetadata = contentMetadata.copyWithMutationsApplied(mutations);
...@@ -70,7 +70,7 @@ public class DefaultContentMetadataTest { ...@@ -70,7 +70,7 @@ public class DefaultContentMetadataTest {
} }
@Test @Test
public void testAddNewIntMetadata() throws Exception { public void addNewIntMetadata() throws Exception {
ContentMetadataMutations mutations = new ContentMetadataMutations(); ContentMetadataMutations mutations = new ContentMetadataMutations();
mutations.set("metadata name", 5); mutations.set("metadata name", 5);
contentMetadata = contentMetadata.copyWithMutationsApplied(mutations); contentMetadata = contentMetadata.copyWithMutationsApplied(mutations);
...@@ -78,7 +78,7 @@ public class DefaultContentMetadataTest { ...@@ -78,7 +78,7 @@ public class DefaultContentMetadataTest {
} }
@Test @Test
public void testAddNewByteArrayMetadata() throws Exception { public void addNewByteArrayMetadata() throws Exception {
ContentMetadataMutations mutations = new ContentMetadataMutations(); ContentMetadataMutations mutations = new ContentMetadataMutations();
byte[] value = {1, 2, 3}; byte[] value = {1, 2, 3};
mutations.set("metadata name", value); mutations.set("metadata name", value);
...@@ -87,14 +87,14 @@ public class DefaultContentMetadataTest { ...@@ -87,14 +87,14 @@ public class DefaultContentMetadataTest {
} }
@Test @Test
public void testNewMetadataNotWrittenBeforeCommitted() throws Exception { public void newMetadataNotWrittenBeforeCommitted() throws Exception {
ContentMetadataMutations mutations = new ContentMetadataMutations(); ContentMetadataMutations mutations = new ContentMetadataMutations();
mutations.set("metadata name", "value"); mutations.set("metadata name", "value");
assertThat(contentMetadata.get("metadata name", "default value")).isEqualTo("default value"); assertThat(contentMetadata.get("metadata name", "default value")).isEqualTo("default value");
} }
@Test @Test
public void testEditMetadata() throws Exception { public void editMetadata() throws Exception {
contentMetadata = createContentMetadata("metadata name", "value"); contentMetadata = createContentMetadata("metadata name", "value");
ContentMetadataMutations mutations = new ContentMetadataMutations(); ContentMetadataMutations mutations = new ContentMetadataMutations();
mutations.set("metadata name", "edited value"); mutations.set("metadata name", "edited value");
...@@ -103,7 +103,7 @@ public class DefaultContentMetadataTest { ...@@ -103,7 +103,7 @@ public class DefaultContentMetadataTest {
} }
@Test @Test
public void testRemoveMetadata() throws Exception { public void removeMetadata() throws Exception {
contentMetadata = createContentMetadata("metadata name", "value"); contentMetadata = createContentMetadata("metadata name", "value");
ContentMetadataMutations mutations = new ContentMetadataMutations(); ContentMetadataMutations mutations = new ContentMetadataMutations();
mutations.remove("metadata name"); mutations.remove("metadata name");
...@@ -112,7 +112,7 @@ public class DefaultContentMetadataTest { ...@@ -112,7 +112,7 @@ public class DefaultContentMetadataTest {
} }
@Test @Test
public void testAddAndRemoveMetadata() throws Exception { public void addAndRemoveMetadata() throws Exception {
ContentMetadataMutations mutations = new ContentMetadataMutations(); ContentMetadataMutations mutations = new ContentMetadataMutations();
mutations.set("metadata name", "value"); mutations.set("metadata name", "value");
mutations.remove("metadata name"); mutations.remove("metadata name");
...@@ -121,7 +121,7 @@ public class DefaultContentMetadataTest { ...@@ -121,7 +121,7 @@ public class DefaultContentMetadataTest {
} }
@Test @Test
public void testRemoveAndAddMetadata() throws Exception { public void removeAndAddMetadata() throws Exception {
ContentMetadataMutations mutations = new ContentMetadataMutations(); ContentMetadataMutations mutations = new ContentMetadataMutations();
mutations.remove("metadata name"); mutations.remove("metadata name");
mutations.set("metadata name", "value"); mutations.set("metadata name", "value");
...@@ -130,14 +130,14 @@ public class DefaultContentMetadataTest { ...@@ -130,14 +130,14 @@ public class DefaultContentMetadataTest {
} }
@Test @Test
public void testEqualsStringValues() throws Exception { public void equalsStringValues() throws Exception {
DefaultContentMetadata metadata1 = createContentMetadata("metadata1", "value"); DefaultContentMetadata metadata1 = createContentMetadata("metadata1", "value");
DefaultContentMetadata metadata2 = createContentMetadata("metadata1", "value"); DefaultContentMetadata metadata2 = createContentMetadata("metadata1", "value");
assertThat(metadata1).isEqualTo(metadata2); assertThat(metadata1).isEqualTo(metadata2);
} }
@Test @Test
public void testEquals() throws Exception { public void equals() throws Exception {
DefaultContentMetadata metadata1 = DefaultContentMetadata metadata1 =
createContentMetadata( createContentMetadata(
"metadata1", "value", "metadata2", 12345, "metadata3", new byte[] {1, 2, 3}); "metadata1", "value", "metadata2", 12345, "metadata3", new byte[] {1, 2, 3});
...@@ -149,7 +149,7 @@ public class DefaultContentMetadataTest { ...@@ -149,7 +149,7 @@ public class DefaultContentMetadataTest {
} }
@Test @Test
public void testNotEquals() throws Exception { public void notEquals() throws Exception {
DefaultContentMetadata metadata1 = createContentMetadata("metadata1", new byte[] {1, 2, 3}); DefaultContentMetadata metadata1 = createContentMetadata("metadata1", new byte[] {1, 2, 3});
DefaultContentMetadata metadata2 = createContentMetadata("metadata1", new byte[] {3, 2, 1}); DefaultContentMetadata metadata2 = createContentMetadata("metadata1", new byte[] {3, 2, 1});
assertThat(metadata1).isNotEqualTo(metadata2); assertThat(metadata1).isNotEqualTo(metadata2);
......
...@@ -32,7 +32,7 @@ public class LeastRecentlyUsedCacheEvictorTest { ...@@ -32,7 +32,7 @@ public class LeastRecentlyUsedCacheEvictorTest {
} }
@Test @Test
public void testContentBiggerThanMaxSizeDoesNotThrowException() throws Exception { public void contentBiggerThanMaxSizeDoesNotThrowException() throws Exception {
int maxBytes = 100; int maxBytes = 100;
LeastRecentlyUsedCacheEvictor evictor = new LeastRecentlyUsedCacheEvictor(maxBytes); LeastRecentlyUsedCacheEvictor evictor = new LeastRecentlyUsedCacheEvictor(maxBytes);
evictor.onCacheInitialized(); evictor.onCacheInitialized();
......
...@@ -53,7 +53,7 @@ public class SimpleCacheSpanTest { ...@@ -53,7 +53,7 @@ public class SimpleCacheSpanTest {
} }
@Test @Test
public void testCacheFile() throws Exception { public void cacheFile() throws Exception {
assertCacheSpan("key1", 0, 0); assertCacheSpan("key1", 0, 0);
assertCacheSpan("key2", 1, 2); assertCacheSpan("key2", 1, 2);
assertCacheSpan("<>:\"/\\|?*%", 1, 2); assertCacheSpan("<>:\"/\\|?*%", 1, 2);
...@@ -72,7 +72,7 @@ public class SimpleCacheSpanTest { ...@@ -72,7 +72,7 @@ public class SimpleCacheSpanTest {
} }
@Test @Test
public void testUpgradeFileName() throws Exception { public void upgradeFileName() throws Exception {
String key = "abc%def"; String key = "abc%def";
int id = index.assignIdForKey(key); int id = index.assignIdForKey(key);
File v3file = createTestFile(cacheDir, id + ".0.1.v3.exo"); File v3file = createTestFile(cacheDir, id + ".0.1.v3.exo");
......
...@@ -63,7 +63,7 @@ public class SimpleCacheTest { ...@@ -63,7 +63,7 @@ public class SimpleCacheTest {
} }
@Test @Test
public void testCacheInitialization() { public void cacheInitialization() {
SimpleCache cache = getSimpleCache(); SimpleCache cache = getSimpleCache();
// Cache initialization should have created a non-negative UID. // Cache initialization should have created a non-negative UID.
...@@ -79,7 +79,7 @@ public class SimpleCacheTest { ...@@ -79,7 +79,7 @@ public class SimpleCacheTest {
} }
@Test @Test
public void testCacheInitializationError() throws IOException { public void cacheInitializationError() throws IOException {
// Creating a file where the cache should be will cause an error during initialization. // Creating a file where the cache should be will cause an error during initialization.
assertThat(cacheDir.createNewFile()).isTrue(); assertThat(cacheDir.createNewFile()).isTrue();
...@@ -90,7 +90,7 @@ public class SimpleCacheTest { ...@@ -90,7 +90,7 @@ public class SimpleCacheTest {
} }
@Test @Test
public void testCommittingOneFile() throws Exception { public void committingOneFile() throws Exception {
SimpleCache simpleCache = getSimpleCache(); SimpleCache simpleCache = getSimpleCache();
CacheSpan cacheSpan1 = simpleCache.startReadWrite(KEY_1, 0); CacheSpan cacheSpan1 = simpleCache.startReadWrite(KEY_1, 0);
...@@ -122,7 +122,7 @@ public class SimpleCacheTest { ...@@ -122,7 +122,7 @@ public class SimpleCacheTest {
} }
@Test @Test
public void testReadCacheWithoutReleasingWriteCacheSpan() throws Exception { public void readCacheWithoutReleasingWriteCacheSpan() throws Exception {
SimpleCache simpleCache = getSimpleCache(); SimpleCache simpleCache = getSimpleCache();
CacheSpan cacheSpan1 = simpleCache.startReadWrite(KEY_1, 0); CacheSpan cacheSpan1 = simpleCache.startReadWrite(KEY_1, 0);
...@@ -133,7 +133,7 @@ public class SimpleCacheTest { ...@@ -133,7 +133,7 @@ public class SimpleCacheTest {
} }
@Test @Test
public void testSetGetContentMetadata() throws Exception { public void setGetContentMetadata() throws Exception {
SimpleCache simpleCache = getSimpleCache(); SimpleCache simpleCache = getSimpleCache();
assertThat(ContentMetadata.getContentLength(simpleCache.getContentMetadata(KEY_1))) assertThat(ContentMetadata.getContentLength(simpleCache.getContentMetadata(KEY_1)))
...@@ -173,7 +173,7 @@ public class SimpleCacheTest { ...@@ -173,7 +173,7 @@ public class SimpleCacheTest {
} }
@Test @Test
public void testReloadCache() throws Exception { public void reloadCache() throws Exception {
SimpleCache simpleCache = getSimpleCache(); SimpleCache simpleCache = getSimpleCache();
// write data // write data
...@@ -191,7 +191,7 @@ public class SimpleCacheTest { ...@@ -191,7 +191,7 @@ public class SimpleCacheTest {
} }
@Test @Test
public void testReloadCacheWithoutRelease() throws Exception { public void reloadCacheWithoutRelease() throws Exception {
SimpleCache simpleCache = getSimpleCache(); SimpleCache simpleCache = getSimpleCache();
// Write data for KEY_1. // Write data for KEY_1.
...@@ -226,7 +226,7 @@ public class SimpleCacheTest { ...@@ -226,7 +226,7 @@ public class SimpleCacheTest {
} }
@Test @Test
public void testEncryptedIndex() throws Exception { public void encryptedIndex() throws Exception {
byte[] key = Util.getUtf8Bytes("Bar12345Bar12345"); // 128 bit key byte[] key = Util.getUtf8Bytes("Bar12345Bar12345"); // 128 bit key
SimpleCache simpleCache = getEncryptedSimpleCache(key); SimpleCache simpleCache = getEncryptedSimpleCache(key);
...@@ -245,7 +245,7 @@ public class SimpleCacheTest { ...@@ -245,7 +245,7 @@ public class SimpleCacheTest {
} }
@Test @Test
public void testEncryptedIndexWrongKey() throws Exception { public void encryptedIndexWrongKey() throws Exception {
byte[] key = Util.getUtf8Bytes("Bar12345Bar12345"); // 128 bit key byte[] key = Util.getUtf8Bytes("Bar12345Bar12345"); // 128 bit key
SimpleCache simpleCache = getEncryptedSimpleCache(key); SimpleCache simpleCache = getEncryptedSimpleCache(key);
...@@ -265,7 +265,7 @@ public class SimpleCacheTest { ...@@ -265,7 +265,7 @@ public class SimpleCacheTest {
} }
@Test @Test
public void testEncryptedIndexLostKey() throws Exception { public void encryptedIndexLostKey() throws Exception {
byte[] key = Util.getUtf8Bytes("Bar12345Bar12345"); // 128 bit key byte[] key = Util.getUtf8Bytes("Bar12345Bar12345"); // 128 bit key
SimpleCache simpleCache = getEncryptedSimpleCache(key); SimpleCache simpleCache = getEncryptedSimpleCache(key);
...@@ -284,7 +284,7 @@ public class SimpleCacheTest { ...@@ -284,7 +284,7 @@ public class SimpleCacheTest {
} }
@Test @Test
public void testGetCachedLength() throws Exception { public void getCachedLength() throws Exception {
SimpleCache simpleCache = getSimpleCache(); SimpleCache simpleCache = getSimpleCache();
CacheSpan cacheSpan = simpleCache.startReadWrite(KEY_1, 0); CacheSpan cacheSpan = simpleCache.startReadWrite(KEY_1, 0);
...@@ -320,7 +320,7 @@ public class SimpleCacheTest { ...@@ -320,7 +320,7 @@ public class SimpleCacheTest {
/* Tests https://github.com/google/ExoPlayer/issues/3260 case. */ /* Tests https://github.com/google/ExoPlayer/issues/3260 case. */
@Test @Test
public void testExceptionDuringEvictionByLeastRecentlyUsedCacheEvictorNotHang() throws Exception { public void exceptionDuringEvictionByLeastRecentlyUsedCacheEvictorNotHang() throws Exception {
CachedContentIndex contentIndex = CachedContentIndex contentIndex =
Mockito.spy(new CachedContentIndex(TestUtil.getInMemoryDatabaseProvider())); Mockito.spy(new CachedContentIndex(TestUtil.getInMemoryDatabaseProvider()));
SimpleCache simpleCache = SimpleCache simpleCache =
...@@ -357,7 +357,7 @@ public class SimpleCacheTest { ...@@ -357,7 +357,7 @@ public class SimpleCacheTest {
} }
@Test @Test
public void testUsingReleasedSimpleCacheThrowsException() throws Exception { public void usingReleasedSimpleCacheThrowsException() throws Exception {
SimpleCache simpleCache = new SimpleCache(cacheDir, new NoOpCacheEvictor()); SimpleCache simpleCache = new SimpleCache(cacheDir, new NoOpCacheEvictor());
simpleCache.release(); simpleCache.release();
...@@ -370,7 +370,7 @@ public class SimpleCacheTest { ...@@ -370,7 +370,7 @@ public class SimpleCacheTest {
} }
@Test @Test
public void testMultipleSimpleCacheWithSameCacheDirThrowsException() throws Exception { public void multipleSimpleCacheWithSameCacheDirThrowsException() throws Exception {
new SimpleCache(cacheDir, new NoOpCacheEvictor()); new SimpleCache(cacheDir, new NoOpCacheEvictor());
try { try {
...@@ -382,7 +382,7 @@ public class SimpleCacheTest { ...@@ -382,7 +382,7 @@ public class SimpleCacheTest {
} }
@Test @Test
public void testMultipleSimpleCacheWithSameCacheDirDoesNotThrowsExceptionAfterRelease() public void multipleSimpleCacheWithSameCacheDirDoesNotThrowsExceptionAfterRelease()
throws Exception { throws Exception {
SimpleCache simpleCache = new SimpleCache(cacheDir, new NoOpCacheEvictor()); SimpleCache simpleCache = new SimpleCache(cacheDir, new NoOpCacheEvictor());
simpleCache.release(); simpleCache.release();
......
...@@ -76,7 +76,7 @@ public class AesFlushingCipherTest { ...@@ -76,7 +76,7 @@ public class AesFlushingCipherTest {
// Test a single encrypt and decrypt call. // Test a single encrypt and decrypt call.
@Test @Test
public void testSingle() { public void single() {
byte[] reference = TestUtil.buildTestData(DATA_LENGTH); byte[] reference = TestUtil.buildTestData(DATA_LENGTH);
byte[] data = reference.clone(); byte[] data = reference.clone();
...@@ -92,7 +92,7 @@ public class AesFlushingCipherTest { ...@@ -92,7 +92,7 @@ public class AesFlushingCipherTest {
// Test several encrypt and decrypt calls, each aligned on a 16 byte block size. // Test several encrypt and decrypt calls, each aligned on a 16 byte block size.
@Test @Test
public void testAligned() { public void aligned() {
byte[] reference = TestUtil.buildTestData(DATA_LENGTH); byte[] reference = TestUtil.buildTestData(DATA_LENGTH);
byte[] data = reference.clone(); byte[] data = reference.clone();
Random random = new Random(RANDOM_SEED); Random random = new Random(RANDOM_SEED);
...@@ -125,7 +125,7 @@ public class AesFlushingCipherTest { ...@@ -125,7 +125,7 @@ public class AesFlushingCipherTest {
// Test several encrypt and decrypt calls, not aligned on block boundary. // Test several encrypt and decrypt calls, not aligned on block boundary.
@Test @Test
public void testUnAligned() { public void unAligned() {
byte[] reference = TestUtil.buildTestData(DATA_LENGTH); byte[] reference = TestUtil.buildTestData(DATA_LENGTH);
byte[] data = reference.clone(); byte[] data = reference.clone();
Random random = new Random(RANDOM_SEED); Random random = new Random(RANDOM_SEED);
...@@ -157,7 +157,7 @@ public class AesFlushingCipherTest { ...@@ -157,7 +157,7 @@ public class AesFlushingCipherTest {
// Test decryption starting from the middle of an encrypted block. // Test decryption starting from the middle of an encrypted block.
@Test @Test
public void testMidJoin() { public void midJoin() {
byte[] reference = TestUtil.buildTestData(DATA_LENGTH); byte[] reference = TestUtil.buildTestData(DATA_LENGTH);
byte[] data = reference.clone(); byte[] data = reference.clone();
Random random = new Random(RANDOM_SEED); Random random = new Random(RANDOM_SEED);
......
...@@ -50,14 +50,14 @@ public final class AtomicFileTest { ...@@ -50,14 +50,14 @@ public final class AtomicFileTest {
} }
@Test @Test
public void testDelete() throws Exception { public void delete() throws Exception {
assertThat(file.createNewFile()).isTrue(); assertThat(file.createNewFile()).isTrue();
atomicFile.delete(); atomicFile.delete();
assertThat(file.exists()).isFalse(); assertThat(file.exists()).isFalse();
} }
@Test @Test
public void testWriteRead() throws Exception { public void writeRead() throws Exception {
OutputStream output = atomicFile.startWrite(); OutputStream output = atomicFile.startWrite();
output.write(5); output.write(5);
atomicFile.endWrite(output); atomicFile.endWrite(output);
......
...@@ -35,29 +35,29 @@ public final class ColorParserTest { ...@@ -35,29 +35,29 @@ public final class ColorParserTest {
// Negative tests. // Negative tests.
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
public void testParseUnknownColor() { public void parseUnknownColor() {
ColorParser.parseTtmlColor("colorOfAnElectron"); ColorParser.parseTtmlColor("colorOfAnElectron");
} }
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
public void testParseNull() { public void parseNull() {
ColorParser.parseTtmlColor(null); ColorParser.parseTtmlColor(null);
} }
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
public void testParseEmpty() { public void parseEmpty() {
ColorParser.parseTtmlColor(""); ColorParser.parseTtmlColor("");
} }
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
public void testRgbColorParsingRgbValuesNegative() { public void rgbColorParsingRgbValuesNegative() {
ColorParser.parseTtmlColor("rgb(-4, 55, 209)"); ColorParser.parseTtmlColor("rgb(-4, 55, 209)");
} }
// Positive tests. // Positive tests.
@Test @Test
public void testHexCodeParsing() { public void hexCodeParsing() {
assertThat(parseTtmlColor("#FFFFFF")).isEqualTo(WHITE); assertThat(parseTtmlColor("#FFFFFF")).isEqualTo(WHITE);
assertThat(parseTtmlColor("#FFFFFFFF")).isEqualTo(WHITE); assertThat(parseTtmlColor("#FFFFFFFF")).isEqualTo(WHITE);
assertThat(parseTtmlColor("#123456")).isEqualTo(parseColor("#FF123456")); assertThat(parseTtmlColor("#123456")).isEqualTo(parseColor("#FF123456"));
...@@ -67,14 +67,14 @@ public final class ColorParserTest { ...@@ -67,14 +67,14 @@ public final class ColorParserTest {
} }
@Test @Test
public void testRgbColorParsing() { public void rgbColorParsing() {
assertThat(parseTtmlColor("rgb(255,255,255)")).isEqualTo(WHITE); assertThat(parseTtmlColor("rgb(255,255,255)")).isEqualTo(WHITE);
// Spaces are ignored. // Spaces are ignored.
assertThat(parseTtmlColor(" rgb ( 255, 255, 255)")).isEqualTo(WHITE); assertThat(parseTtmlColor(" rgb ( 255, 255, 255)")).isEqualTo(WHITE);
} }
@Test @Test
public void testRgbColorParsingRgbValuesOutOfBounds() { public void rgbColorParsingRgbValuesOutOfBounds() {
int outOfBounds = ColorParser.parseTtmlColor("rgb(999, 999, 999)"); int outOfBounds = ColorParser.parseTtmlColor("rgb(999, 999, 999)");
int color = Color.rgb(999, 999, 999); int color = Color.rgb(999, 999, 999);
// Behave like the framework does. // Behave like the framework does.
...@@ -82,7 +82,7 @@ public final class ColorParserTest { ...@@ -82,7 +82,7 @@ public final class ColorParserTest {
} }
@Test @Test
public void testRgbaColorParsing() { public void rgbaColorParsing() {
assertThat(parseTtmlColor("rgba(255,255,255,255)")).isEqualTo(WHITE); assertThat(parseTtmlColor("rgba(255,255,255,255)")).isEqualTo(WHITE);
assertThat(parseTtmlColor("rgba(255,255,255,255)")) assertThat(parseTtmlColor("rgba(255,255,255,255)"))
.isEqualTo(argb(255, 255, 255, 255)); .isEqualTo(argb(255, 255, 255, 255));
......
...@@ -30,7 +30,7 @@ public final class ReusableBufferedOutputStreamTest { ...@@ -30,7 +30,7 @@ public final class ReusableBufferedOutputStreamTest {
private static final byte[] TEST_DATA_2 = Util.getUtf8Bytes("2 test data"); private static final byte[] TEST_DATA_2 = Util.getUtf8Bytes("2 test data");
@Test @Test
public void testReset() throws Exception { public void reset() throws Exception {
ByteArrayOutputStream byteArrayOutputStream1 = new ByteArrayOutputStream(1000); ByteArrayOutputStream byteArrayOutputStream1 = new ByteArrayOutputStream(1000);
ReusableBufferedOutputStream outputStream = new ReusableBufferedOutputStream( ReusableBufferedOutputStream outputStream = new ReusableBufferedOutputStream(
byteArrayOutputStream1, 1000); byteArrayOutputStream1, 1000);
......
...@@ -34,7 +34,7 @@ public class TimedValueQueueTest { ...@@ -34,7 +34,7 @@ public class TimedValueQueueTest {
} }
@Test @Test
public void testAddAndPollValues() { public void addAndPollValues() {
queue.add(0, "a"); queue.add(0, "a");
queue.add(1, "b"); queue.add(1, "b");
queue.add(2, "c"); queue.add(2, "c");
...@@ -44,7 +44,7 @@ public class TimedValueQueueTest { ...@@ -44,7 +44,7 @@ public class TimedValueQueueTest {
} }
@Test @Test
public void testBufferCapacityIncreasesAutomatically() { public void bufferCapacityIncreasesAutomatically() {
queue = new TimedValueQueue<>(1); queue = new TimedValueQueue<>(1);
for (int i = 0; i < 20; i++) { for (int i = 0; i < 20; i++) {
queue.add(i, "" + i); queue.add(i, "" + i);
...@@ -56,7 +56,7 @@ public class TimedValueQueueTest { ...@@ -56,7 +56,7 @@ public class TimedValueQueueTest {
} }
@Test @Test
public void testTimeDiscontinuityClearsValues() { public void timeDiscontinuityClearsValues() {
queue.add(1, "b"); queue.add(1, "b");
queue.add(2, "c"); queue.add(2, "c");
queue.add(0, "a"); queue.add(0, "a");
...@@ -65,7 +65,7 @@ public class TimedValueQueueTest { ...@@ -65,7 +65,7 @@ public class TimedValueQueueTest {
} }
@Test @Test
public void testTimeDiscontinuityOnFullBufferClearsValues() { public void timeDiscontinuityOnFullBufferClearsValues() {
queue = new TimedValueQueue<>(2); queue = new TimedValueQueue<>(2);
queue.add(1, "b"); queue.add(1, "b");
queue.add(3, "c"); queue.add(3, "c");
...@@ -75,7 +75,7 @@ public class TimedValueQueueTest { ...@@ -75,7 +75,7 @@ public class TimedValueQueueTest {
} }
@Test @Test
public void testPollReturnsClosestValue() { public void pollReturnsClosestValue() {
queue.add(0, "a"); queue.add(0, "a");
queue.add(3, "b"); queue.add(3, "b");
assertThat(queue.poll(2)).isEqualTo("b"); assertThat(queue.poll(2)).isEqualTo("b");
...@@ -83,7 +83,7 @@ public class TimedValueQueueTest { ...@@ -83,7 +83,7 @@ public class TimedValueQueueTest {
} }
@Test @Test
public void testPollRemovesPreviousValues() { public void pollRemovesPreviousValues() {
queue.add(0, "a"); queue.add(0, "a");
queue.add(1, "b"); queue.add(1, "b");
queue.add(2, "c"); queue.add(2, "c");
...@@ -92,7 +92,7 @@ public class TimedValueQueueTest { ...@@ -92,7 +92,7 @@ public class TimedValueQueueTest {
} }
@Test @Test
public void testPollFloorReturnsClosestPreviousValue() { public void pollFloorReturnsClosestPreviousValue() {
queue.add(0, "a"); queue.add(0, "a");
queue.add(3, "b"); queue.add(3, "b");
assertThat(queue.pollFloor(2)).isEqualTo("a"); assertThat(queue.pollFloor(2)).isEqualTo("a");
...@@ -102,7 +102,7 @@ public class TimedValueQueueTest { ...@@ -102,7 +102,7 @@ public class TimedValueQueueTest {
} }
@Test @Test
public void testPollFloorRemovesPreviousValues() { public void pollFloorRemovesPreviousValues() {
queue.add(0, "a"); queue.add(0, "a");
queue.add(1, "b"); queue.add(1, "b");
queue.add(2, "c"); queue.add(2, "c");
......
...@@ -30,11 +30,11 @@ public final class UriUtilTest { ...@@ -30,11 +30,11 @@ public final class UriUtilTest {
/** /**
* Tests normal usage of {@link UriUtil#resolve(String, String)}. * Tests normal usage of {@link UriUtil#resolve(String, String)}.
* <p> *
* The test cases are taken from RFC-3986 5.4.1. * <p>The test cases are taken from RFC-3986 5.4.1.
*/ */
@Test @Test
public void testResolveNormal() { public void resolveNormal() {
String base = "http://a/b/c/d;p?q"; String base = "http://a/b/c/d;p?q";
assertThat(resolve(base, "g:h")).isEqualTo("g:h"); assertThat(resolve(base, "g:h")).isEqualTo("g:h");
...@@ -63,11 +63,11 @@ public final class UriUtilTest { ...@@ -63,11 +63,11 @@ public final class UriUtilTest {
/** /**
* Tests abnormal usage of {@link UriUtil#resolve(String, String)}. * Tests abnormal usage of {@link UriUtil#resolve(String, String)}.
* <p> *
* The test cases are taken from RFC-3986 5.4.2. * <p>The test cases are taken from RFC-3986 5.4.2.
*/ */
@Test @Test
public void testResolveAbnormal() { public void resolveAbnormal() {
String base = "http://a/b/c/d;p?q"; String base = "http://a/b/c/d;p?q";
assertThat(resolve(base, "../../../g")).isEqualTo("http://a/g"); assertThat(resolve(base, "../../../g")).isEqualTo("http://a/g");
...@@ -95,11 +95,9 @@ public final class UriUtilTest { ...@@ -95,11 +95,9 @@ public final class UriUtilTest {
assertThat(resolve(base, "http:g")).isEqualTo("http:g"); assertThat(resolve(base, "http:g")).isEqualTo("http:g");
} }
/** /** Tests additional abnormal usage of {@link UriUtil#resolve(String, String)}. */
* Tests additional abnormal usage of {@link UriUtil#resolve(String, String)}.
*/
@Test @Test
public void testResolveAbnormalAdditional() { public void resolveAbnormalAdditional() {
assertThat(resolve("http://a/b", "c:d/../e")).isEqualTo("c:e"); assertThat(resolve("http://a/b", "c:d/../e")).isEqualTo("c:e");
assertThat(resolve("a:b", "../c")).isEqualTo("a:c"); assertThat(resolve("a:b", "../c")).isEqualTo("a:c");
} }
......
...@@ -37,19 +37,19 @@ public class FrameRotationQueueTest { ...@@ -37,19 +37,19 @@ public class FrameRotationQueueTest {
} }
@Test @Test
public void testGetRotationMatrixReturnsNull_whenEmpty() throws Exception { public void getRotationMatrixReturnsNull_whenEmpty() throws Exception {
assertThat(frameRotationQueue.pollRotationMatrix(rotationMatrix, 0)).isFalse(); assertThat(frameRotationQueue.pollRotationMatrix(rotationMatrix, 0)).isFalse();
} }
@Test @Test
public void testGetRotationMatrixReturnsNotNull_whenNotEmpty() throws Exception { public void getRotationMatrixReturnsNotNull_whenNotEmpty() throws Exception {
frameRotationQueue.setRotation(0, new float[] {1, 2, 3}); frameRotationQueue.setRotation(0, new float[] {1, 2, 3});
assertThat(frameRotationQueue.pollRotationMatrix(rotationMatrix, 0)).isTrue(); assertThat(frameRotationQueue.pollRotationMatrix(rotationMatrix, 0)).isTrue();
assertThat(rotationMatrix).hasLength(16); assertThat(rotationMatrix).hasLength(16);
} }
@Test @Test
public void testConvertsAngleAxisToRotationMatrix() throws Exception { public void convertsAngleAxisToRotationMatrix() throws Exception {
doTestAngleAxisToRotationMatrix(/* angleRadian= */ 0, /* x= */ 1, /* y= */ 0, /* z= */ 0); doTestAngleAxisToRotationMatrix(/* angleRadian= */ 0, /* x= */ 1, /* y= */ 0, /* z= */ 0);
frameRotationQueue.reset(); frameRotationQueue.reset();
doTestAngleAxisToRotationMatrix(/* angleRadian= */ 1, /* x= */ 1, /* y= */ 0, /* z= */ 0); doTestAngleAxisToRotationMatrix(/* angleRadian= */ 1, /* x= */ 1, /* y= */ 0, /* z= */ 0);
...@@ -61,7 +61,7 @@ public class FrameRotationQueueTest { ...@@ -61,7 +61,7 @@ public class FrameRotationQueueTest {
} }
@Test @Test
public void testRecentering_justYaw() throws Exception { public void recentering_justYaw() throws Exception {
float[] actualMatrix = float[] actualMatrix =
getRotationMatrixFromAngleAxis( getRotationMatrixFromAngleAxis(
/* angleRadian= */ (float) Math.PI, /* x= */ 0, /* y= */ 1, /* z= */ 0); /* angleRadian= */ (float) Math.PI, /* x= */ 0, /* y= */ 1, /* z= */ 0);
...@@ -71,7 +71,7 @@ public class FrameRotationQueueTest { ...@@ -71,7 +71,7 @@ public class FrameRotationQueueTest {
} }
@Test @Test
public void testRecentering_yawAndPitch() throws Exception { public void recentering_yawAndPitch() throws Exception {
float[] matrix = float[] matrix =
getRotationMatrixFromAngleAxis( getRotationMatrixFromAngleAxis(
/* angleRadian= */ (float) Math.PI, /* x= */ 1, /* y= */ 1, /* z= */ 0); /* angleRadian= */ (float) Math.PI, /* x= */ 1, /* y= */ 1, /* z= */ 0);
...@@ -80,7 +80,7 @@ public class FrameRotationQueueTest { ...@@ -80,7 +80,7 @@ public class FrameRotationQueueTest {
} }
@Test @Test
public void testRecentering_yawAndPitch2() throws Exception { public void recentering_yawAndPitch2() throws Exception {
float[] matrix = float[] matrix =
getRotationMatrixFromAngleAxis( getRotationMatrixFromAngleAxis(
/* angleRadian= */ (float) Math.PI / 2, /* x= */ 1, /* y= */ 1, /* z= */ 0); /* angleRadian= */ (float) Math.PI / 2, /* x= */ 1, /* y= */ 1, /* z= */ 0);
...@@ -90,7 +90,7 @@ public class FrameRotationQueueTest { ...@@ -90,7 +90,7 @@ public class FrameRotationQueueTest {
} }
@Test @Test
public void testRecentering_yawAndPitchAndRoll() throws Exception { public void recentering_yawAndPitchAndRoll() throws Exception {
float[] matrix = float[] matrix =
getRotationMatrixFromAngleAxis( getRotationMatrixFromAngleAxis(
/* angleRadian= */ (float) Math.PI * 2 / 3, /* x= */ 1, /* y= */ 1, /* z= */ 1); /* angleRadian= */ (float) Math.PI * 2 / 3, /* x= */ 1, /* y= */ 1, /* z= */ 1);
......
...@@ -44,12 +44,12 @@ public final class ProjectionDecoderTest { ...@@ -44,12 +44,12 @@ public final class ProjectionDecoderTest {
private static final float[] LAST_UV = {1.0f, 1.0f}; private static final float[] LAST_UV = {1.0f, 1.0f};
@Test @Test
public void testDecodeProj() { public void decodeProj() {
testDecoding(PROJ_DATA); testDecoding(PROJ_DATA);
} }
@Test @Test
public void testDecodeMshp() { public void decodeMshp() {
testDecoding(Arrays.copyOfRange(PROJ_DATA, MSHP_OFFSET, PROJ_DATA.length)); testDecoding(Arrays.copyOfRange(PROJ_DATA, MSHP_OFFSET, PROJ_DATA.length));
} }
......
...@@ -37,7 +37,7 @@ public class ProjectionTest { ...@@ -37,7 +37,7 @@ public class ProjectionTest {
private static final float HORIZONTAL_FOV_DEGREES = 360; private static final float HORIZONTAL_FOV_DEGREES = 360;
@Test @Test
public void testSphericalMesh() throws Exception { public void sphericalMesh() throws Exception {
// Only the first param is important in this test. // Only the first param is important in this test.
Projection projection = Projection projection =
Projection.createEquirectangular( Projection.createEquirectangular(
...@@ -61,7 +61,7 @@ public class ProjectionTest { ...@@ -61,7 +61,7 @@ public class ProjectionTest {
} }
@Test @Test
public void testArgumentValidation() { public void argumentValidation() {
checkIllegalArgumentException(0, 1, 1, 1, 1); checkIllegalArgumentException(0, 1, 1, 1, 1);
checkIllegalArgumentException(1, 0, 1, 1, 1); checkIllegalArgumentException(1, 0, 1, 1, 1);
checkIllegalArgumentException(1, 1, 0, 1, 1); checkIllegalArgumentException(1, 1, 0, 1, 1);
......
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