Fix DefaultExtractorInputTest.largeSkip
PiperOrigin-RevId: 365992439
This commit is contained in:
parent
db42bef17b
commit
7aeb476812
@ -227,12 +227,16 @@ public class DefaultExtractorInputTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void largeSkip() throws Exception {
|
public void largeSkip() throws Exception {
|
||||||
DefaultExtractorInput input = createDefaultExtractorInput();
|
FakeDataSource testDataSource = buildLargeDataSource();
|
||||||
|
DefaultExtractorInput input = new DefaultExtractorInput(testDataSource, 0, C.LENGTH_UNSET);
|
||||||
// Check that skipping the entire data source succeeds.
|
// Check that skipping the entire data source succeeds.
|
||||||
int bytesToSkip = LARGE_TEST_DATA_LENGTH;
|
int bytesToSkip = LARGE_TEST_DATA_LENGTH;
|
||||||
while (bytesToSkip > 0) {
|
while (bytesToSkip > 0) {
|
||||||
bytesToSkip -= input.skip(bytesToSkip);
|
int skipped = input.skip(bytesToSkip);
|
||||||
|
assertThat(skipped).isGreaterThan(0);
|
||||||
|
bytesToSkip -= skipped;
|
||||||
}
|
}
|
||||||
|
assertThat(bytesToSkip).isEqualTo(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -612,6 +616,13 @@ public class DefaultExtractorInputTest {
|
|||||||
return testDataSource;
|
return testDataSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static FakeDataSource buildLargeDataSource() throws Exception {
|
||||||
|
FakeDataSource testDataSource = new FakeDataSource();
|
||||||
|
testDataSource.getDataSet().newDefaultData().appendReadData(new byte[LARGE_TEST_DATA_LENGTH]);
|
||||||
|
testDataSource.open(new DataSpec(Uri.parse(TEST_URI)));
|
||||||
|
return testDataSource;
|
||||||
|
}
|
||||||
|
|
||||||
private static FakeDataSource buildFailingDataSource() throws Exception {
|
private static FakeDataSource buildFailingDataSource() throws Exception {
|
||||||
FakeDataSource testDataSource = new FakeDataSource();
|
FakeDataSource testDataSource = new FakeDataSource();
|
||||||
testDataSource.getDataSet().newDefaultData()
|
testDataSource.getDataSet().newDefaultData()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user