Skip to content

Commit

Permalink
Mini cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ojw28 committed Jun 30, 2017
1 parent 5eb64db commit d293cc4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@
*/
public final class ContentDataSourceTest extends InstrumentationTestCase {

private static final String AUTHORITY = "com.google.android.exoplayer2.core.test";
private static final String DATA_PATH = "binary/1024_incrementing_bytes.mp3";
private static final long DATA_LENGTH = 1024;

public void testReadValidUri() throws Exception {
ContentDataSource dataSource = new ContentDataSource(getInstrumentation().getContext());
Uri contentUri = new Uri.Builder()
.scheme(ContentResolver.SCHEME_CONTENT)
.authority(TestContentProvider.AUTHORITY)
.authority(AUTHORITY)
.path(DATA_PATH).build();
DataSpec dataSpec = new DataSpec(contentUri);
try {
Expand All @@ -57,7 +58,7 @@ public void testReadInvalidUri() throws Exception {
ContentDataSource dataSource = new ContentDataSource(getInstrumentation().getContext());
Uri contentUri = new Uri.Builder()
.scheme(ContentResolver.SCHEME_CONTENT)
.authority(TestContentProvider.AUTHORITY)
.authority(AUTHORITY)
.build();
DataSpec dataSpec = new DataSpec(contentUri);
try {
Expand All @@ -70,10 +71,11 @@ public void testReadInvalidUri() throws Exception {
}
}

/**
* A {@link ContentProvider} for the test.
*/
public static final class TestContentProvider extends ContentProvider {

private static final String AUTHORITY = "com.google.android.exoplayer2.core.test";

@Override
public boolean onCreate() {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ public long open(DataSpec dataSpec) throws ContentDataSourceException {
// The asset must extend to the end of the file.
bytesRemaining = inputStream.available();
if (bytesRemaining == 0) {
// FileInputStream.available() returns 0 if the remaining length cannot be determined, or
// if it's greater than Integer.MAX_VALUE. We don't know the true length in either case,
// so treat as unbounded.
// FileInputStream.available() returns 0 if the remaining length cannot be determined,
// or if it's greater than Integer.MAX_VALUE. We don't know the true length in either
// case, so treat as unbounded.
bytesRemaining = C.LENGTH_UNSET;
}
}
Expand Down

0 comments on commit d293cc4

Please sign in to comment.