Commit d293cc49 by Oliver Woodman

Mini cleanup

parent 5eb64dbe
...@@ -33,6 +33,7 @@ import java.io.IOException; ...@@ -33,6 +33,7 @@ import java.io.IOException;
*/ */
public final class ContentDataSourceTest extends InstrumentationTestCase { 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 String DATA_PATH = "binary/1024_incrementing_bytes.mp3";
private static final long DATA_LENGTH = 1024; private static final long DATA_LENGTH = 1024;
...@@ -40,7 +41,7 @@ public final class ContentDataSourceTest extends InstrumentationTestCase { ...@@ -40,7 +41,7 @@ public final class ContentDataSourceTest extends InstrumentationTestCase {
ContentDataSource dataSource = new ContentDataSource(getInstrumentation().getContext()); ContentDataSource dataSource = new ContentDataSource(getInstrumentation().getContext());
Uri contentUri = new Uri.Builder() Uri contentUri = new Uri.Builder()
.scheme(ContentResolver.SCHEME_CONTENT) .scheme(ContentResolver.SCHEME_CONTENT)
.authority(TestContentProvider.AUTHORITY) .authority(AUTHORITY)
.path(DATA_PATH).build(); .path(DATA_PATH).build();
DataSpec dataSpec = new DataSpec(contentUri); DataSpec dataSpec = new DataSpec(contentUri);
try { try {
...@@ -57,7 +58,7 @@ public final class ContentDataSourceTest extends InstrumentationTestCase { ...@@ -57,7 +58,7 @@ public final class ContentDataSourceTest extends InstrumentationTestCase {
ContentDataSource dataSource = new ContentDataSource(getInstrumentation().getContext()); ContentDataSource dataSource = new ContentDataSource(getInstrumentation().getContext());
Uri contentUri = new Uri.Builder() Uri contentUri = new Uri.Builder()
.scheme(ContentResolver.SCHEME_CONTENT) .scheme(ContentResolver.SCHEME_CONTENT)
.authority(TestContentProvider.AUTHORITY) .authority(AUTHORITY)
.build(); .build();
DataSpec dataSpec = new DataSpec(contentUri); DataSpec dataSpec = new DataSpec(contentUri);
try { try {
...@@ -70,10 +71,11 @@ public final class ContentDataSourceTest extends InstrumentationTestCase { ...@@ -70,10 +71,11 @@ public final class ContentDataSourceTest extends InstrumentationTestCase {
} }
} }
/**
* A {@link ContentProvider} for the test.
*/
public static final class TestContentProvider extends ContentProvider { public static final class TestContentProvider extends ContentProvider {
private static final String AUTHORITY = "com.google.android.exoplayer2.core.test";
@Override @Override
public boolean onCreate() { public boolean onCreate() {
return true; return true;
......
...@@ -91,9 +91,9 @@ public final class ContentDataSource implements DataSource { ...@@ -91,9 +91,9 @@ public final class ContentDataSource implements DataSource {
// The asset must extend to the end of the file. // The asset must extend to the end of the file.
bytesRemaining = inputStream.available(); bytesRemaining = inputStream.available();
if (bytesRemaining == 0) { if (bytesRemaining == 0) {
// FileInputStream.available() returns 0 if the remaining length cannot be determined, or // FileInputStream.available() returns 0 if the remaining length cannot be determined,
// if it's greater than Integer.MAX_VALUE. We don't know the true length in either case, // or if it's greater than Integer.MAX_VALUE. We don't know the true length in either
// so treat as unbounded. // case, so treat as unbounded.
bytesRemaining = C.LENGTH_UNSET; bytesRemaining = C.LENGTH_UNSET;
} }
} }
......
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