Commit 7aeb4768 by olly Committed by Oliver Woodman

Fix DefaultExtractorInputTest.largeSkip

PiperOrigin-RevId: 365992439
parent db42bef1
......@@ -227,12 +227,16 @@ public class DefaultExtractorInputTest {
@Test
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.
int bytesToSkip = LARGE_TEST_DATA_LENGTH;
while (bytesToSkip > 0) {
bytesToSkip -= input.skip(bytesToSkip);
int skipped = input.skip(bytesToSkip);
assertThat(skipped).isGreaterThan(0);
bytesToSkip -= skipped;
}
assertThat(bytesToSkip).isEqualTo(0);
}
@Test
......@@ -612,6 +616,13 @@ public class DefaultExtractorInputTest {
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 {
FakeDataSource testDataSource = new FakeDataSource();
testDataSource.getDataSet().newDefaultData()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment