summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/public_api_access/src/com/android/providers/downloads/public_api_access_tests/PublicApiAccessTest.java20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/public_api_access/src/com/android/providers/downloads/public_api_access_tests/PublicApiAccessTest.java b/tests/public_api_access/src/com/android/providers/downloads/public_api_access_tests/PublicApiAccessTest.java
index 4b2ae09..3929c59 100644
--- a/tests/public_api_access/src/com/android/providers/downloads/public_api_access_tests/PublicApiAccessTest.java
+++ b/tests/public_api_access/src/com/android/providers/downloads/public_api_access_tests/PublicApiAccessTest.java
@@ -18,6 +18,8 @@ package com.android.providers.downloads.public_api_access_tests;
import android.content.ContentResolver;
import android.content.ContentValues;
+import android.net.DownloadManager;
+import android.net.Uri;
import android.provider.Downloads;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.MediumTest;
@@ -43,11 +45,13 @@ public class PublicApiAccessTest extends AndroidTestCase {
};
private ContentResolver mContentResolver;
+ private DownloadManager mManager;
@Override
protected void setUp() throws Exception {
super.setUp();
mContentResolver = getContext().getContentResolver();
+ mManager = new DownloadManager(mContentResolver, getContext().getPackageName());
}
@Override
@@ -70,6 +74,7 @@ public class PublicApiAccessTest extends AndroidTestCase {
values.put(Downloads.Impl.COLUMN_NOTIFICATION_PACKAGE, "foo");
values.put(Downloads.Impl.COLUMN_ALLOWED_NETWORK_TYPES, 0);
values.put(Downloads.Impl.COLUMN_ALLOW_ROAMING, true);
+ values.put(Downloads.Impl.RequestHeaders.INSERT_KEY_PREFIX + "0", "X-Some-Header: value");
mContentResolver.insert(Downloads.Impl.CONTENT_URI, values);
}
@@ -133,4 +138,19 @@ public class PublicApiAccessTest extends AndroidTestCase {
// expected
}
}
+
+ public void testDownloadManagerRequest() {
+ // first try a minimal request
+ DownloadManager.Request request = new DownloadManager.Request(Uri.parse("http://localhost/path"));
+ mManager.enqueue(request);
+
+ // now set everything we can, save for external destintion (for which we lack permission)
+ request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI);
+ request.setAllowedOverRoaming(false);
+ request.setTitle("test");
+ request.setDescription("test");
+ request.setMediaType("text/html");
+ request.setRequestHeader("X-Some-Header", "value");
+ mManager.enqueue(request);
+ }
}