diff options
author | Steve Howard <showard@google.com> | 2010-09-16 12:04:17 -0700 |
---|---|---|
committer | Steve Howard <showard@google.com> | 2010-09-20 13:45:30 -0700 |
commit | b9a0ad7182209d4aca708e13e876e9b1b43ffafc (patch) | |
tree | e49d39e80dfc9c2ffc6a43c81f08ee0edce26c31 /tests/src/com | |
parent | dbefa6f5eff88f97dd91a8adfd65dbd946adb99e (diff) | |
download | android_packages_providers_DownloadProvider-b9a0ad7182209d4aca708e13e876e9b1b43ffafc.tar.gz android_packages_providers_DownloadProvider-b9a0ad7182209d4aca708e13e876e9b1b43ffafc.tar.bz2 android_packages_providers_DownloadProvider-b9a0ad7182209d4aca708e13e876e9b1b43ffafc.zip |
Improve file error reporting + new detailed error messages in UI
* support new error code for "destination file already exists"
* improve error handling for various file error cases to return a more
specific error code when appropriate
* make UI support more detailed error messages for some cases
* use Uri.getPath() instead of Uri.getSchemeSpecificPart() for file
URIs
Change-Id: Icb01d4d3b47c7776be3ddcd8347212e950cd023e
Diffstat (limited to 'tests/src/com')
-rw-r--r-- | tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java b/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java index d577e2c8..554cc1ea 100644 --- a/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java +++ b/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java @@ -292,7 +292,7 @@ public class PublicApiFunctionalTest extends AbstractPublicApiTest { Uri localUri = Uri.parse(download.getStringField(DownloadManager.COLUMN_LOCAL_URI)); assertEquals(destination, localUri); - InputStream stream = new FileInputStream(destination.getSchemeSpecificPart()); + InputStream stream = new FileInputStream(destination.getPath()); try { assertEquals(FILE_CONTENT, readStream(stream)); } finally { @@ -525,12 +525,12 @@ public class PublicApiFunctionalTest extends AbstractPublicApiTest { public void testExistingFile() throws Exception { Uri destination = getExternalUri(); - new File(destination.getSchemeSpecificPart()).createNewFile(); + new File(destination.getPath()).createNewFile(); enqueueEmptyResponse(HTTP_OK); Download download = enqueueRequest(getRequest().setDestinationUri(destination)); download.runUntilStatus(DownloadManager.STATUS_FAILED); - assertEquals(DownloadManager.ERROR_FILE_ERROR, + assertEquals(DownloadManager.ERROR_FILE_ALREADY_EXISTS, download.getLongField(DownloadManager.COLUMN_ERROR_CODE)); } |