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