summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVasu Nori <vnori@google.com>2010-12-13 16:29:29 -0800
committerVasu Nori <vnori@google.com>2010-12-14 15:11:19 -0800
commit9aadb4b3f2b3c914166ebfae8851fbecaf536f4f (patch)
tree56e8adaa5a2d5e6f649a24ea7acd270002c9e258 /tests
parent331d169b4a0099e888ff603abdb1be88c30bba21 (diff)
downloadandroid_packages_providers_DownloadProvider-9aadb4b3f2b3c914166ebfae8851fbecaf536f4f.zip
android_packages_providers_DownloadProvider-9aadb4b3f2b3c914166ebfae8851fbecaf536f4f.tar.gz
android_packages_providers_DownloadProvider-9aadb4b3f2b3c914166ebfae8851fbecaf536f4f.tar.bz2
Download dir: /data/data/com.android.providers.downloads/cache NOT /cache
bug:3264401 still to do: make sure only N bytes are taken up by downloads dir N = a value specific to each device. default = 100MB. Change-Id: I2a49f4b3831d3a8d7be13b5fd46d85d56e831e38
Diffstat (limited to 'tests')
-rw-r--r--tests/public_api_access/AndroidManifest.xml3
-rw-r--r--tests/src/com/android/providers/downloads/DownloadManagerFunctionalTest.java15
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/public_api_access/AndroidManifest.xml b/tests/public_api_access/AndroidManifest.xml
index 0104846..bec636b 100644
--- a/tests/public_api_access/AndroidManifest.xml
+++ b/tests/public_api_access/AndroidManifest.xml
@@ -23,6 +23,9 @@
</application>
<uses-permission android:name="android.permission.INTERNET"/>
+ <!-- The tests in this package can access /cache. so they need the following permission -->
+ <uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCED"/>
+ <uses-permission android:name="android.permission.ACCESS_CACHE_FILESYSTEM"/>
<!--
The test declared in this instrumentation can be run via this command
diff --git a/tests/src/com/android/providers/downloads/DownloadManagerFunctionalTest.java b/tests/src/com/android/providers/downloads/DownloadManagerFunctionalTest.java
index 7a2bfdf..a5bae8b 100644
--- a/tests/src/com/android/providers/downloads/DownloadManagerFunctionalTest.java
+++ b/tests/src/com/android/providers/downloads/DownloadManagerFunctionalTest.java
@@ -69,6 +69,21 @@ public class DownloadManagerFunctionalTest extends AbstractDownloadManagerFuncti
getDownloadFilename(downloadUri));
}
+ /**
+ * downloading to system cache should succeed because this tests package has
+ * the permission android.permission.ACCESS_CACHE_FILESYSTEM
+ */
+ public void testDownloadToSystemCache() throws Exception {
+ enqueueResponse(HTTP_OK, FILE_CONTENT);
+ Uri downloadUri = requestDownload("/path");
+ updateDownload(downloadUri, Downloads.Impl.COLUMN_DESTINATION,
+ Integer.toString(Downloads.Impl.DESTINATION_SYSTEMCACHE_PARTITION));
+ runUntilStatus(downloadUri, Downloads.Impl.STATUS_SUCCESS);
+ assertEquals(FILE_CONTENT, getDownloadContents(downloadUri));
+ assertStartsWith(Environment.getDownloadCacheDirectory().getPath(),
+ getDownloadFilename(downloadUri));
+ }
+
public void testRoaming() throws Exception {
mSystemFacade.mActiveNetworkType = ConnectivityManager.TYPE_MOBILE;
mSystemFacade.mIsRoaming = true;