Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7aeb4768
authored
Mar 31, 2021
by
olly
Committed by
Oliver Woodman
Apr 01, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix DefaultExtractorInputTest.largeSkip
PiperOrigin-RevId: 365992439
parent
db42bef1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/DefaultExtractorInputTest.java
library/extractor/src/test/java/com/google/android/exoplayer2/extractor/DefaultExtractorInputTest.java
View file @
7aeb4768
...
@@ -227,12 +227,16 @@ public class DefaultExtractorInputTest {
...
@@ -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 {
...
@@ -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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment