mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00:00
Fix DefaultExtractorInputTest.largeSkip
PiperOrigin-RevId: 365992439
This commit is contained in:
parent
db42bef17b
commit
7aeb476812
1 changed files with 13 additions and 2 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue