summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/providers/downloads/AbstractDownloadManagerFunctionalTest.java3
-rw-r--r--tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java16
2 files changed, 15 insertions, 4 deletions
diff --git a/tests/src/com/android/providers/downloads/AbstractDownloadManagerFunctionalTest.java b/tests/src/com/android/providers/downloads/AbstractDownloadManagerFunctionalTest.java
index 3e4bccc..d04fd2d 100644
--- a/tests/src/com/android/providers/downloads/AbstractDownloadManagerFunctionalTest.java
+++ b/tests/src/com/android/providers/downloads/AbstractDownloadManagerFunctionalTest.java
@@ -165,7 +165,8 @@ public abstract class AbstractDownloadManagerFunctionalTest extends
}
private boolean isDatabaseEmpty() {
- Cursor cursor = mResolver.query(Downloads.CONTENT_URI, null, null, null, null);
+ Cursor cursor = mResolver.query(Downloads.Impl.ALL_DOWNLOADS_CONTENT_URI,
+ null, null, null, null);
try {
return cursor.getCount() == 0;
} finally {
diff --git a/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java b/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java
index e48ce22..d577e2c 100644
--- a/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java
+++ b/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java
@@ -29,6 +29,8 @@ import tests.http.RecordedRequest;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.util.List;
@@ -89,9 +91,8 @@ public class PublicApiFunctionalTest extends AbstractPublicApiTest {
assertEquals(REQUEST_PATH, request.getPath());
Uri localUri = Uri.parse(download.getStringField(DownloadManager.COLUMN_LOCAL_URI));
- assertEquals("file", localUri.getScheme());
- assertStartsWith("//" + Environment.getDownloadCacheDirectory().getPath(),
- localUri.getSchemeSpecificPart());
+ assertEquals("content", localUri.getScheme());
+ checkUriContent(localUri);
assertEquals("text/plain", download.getStringField(DownloadManager.COLUMN_MEDIA_TYPE));
int size = FILE_CONTENT.length();
@@ -103,6 +104,15 @@ public class PublicApiFunctionalTest extends AbstractPublicApiTest {
checkCompleteDownload(download);
}
+ private void checkUriContent(Uri uri) throws FileNotFoundException, IOException {
+ InputStream inputStream = mResolver.openInputStream(uri);
+ try {
+ assertEquals(FILE_CONTENT, readStream(inputStream));
+ } finally {
+ inputStream.close();
+ }
+ }
+
public void testTitleAndDescription() throws Exception {
Download download = enqueueRequest(getRequest()
.setTitle("my title")