From b9a0ad7182209d4aca708e13e876e9b1b43ffafc Mon Sep 17 00:00:00 2001 From: Steve Howard Date: Thu, 16 Sep 2010 12:04:17 -0700 Subject: 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 --- .../com/android/providers/downloads/PublicApiFunctionalTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/src/com/android') 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)); } -- cgit v1.2.3