diff options
author | Steve Howard <showard@google.com> | 2010-07-15 12:28:45 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-07-15 12:28:45 -0700 |
commit | 88ea0b39bb74c7f8204ba74d3e83bce440a59d88 (patch) | |
tree | 723f6ed28d99948bd76405dc1302731a6ac0d8fb /tests | |
parent | 1d58eb573995366583555ebefdff225c961a58ba (diff) | |
parent | 5224c6fbf20b4803a580ef449ab87ebfbbfedb78 (diff) | |
download | android_packages_providers_DownloadProvider-88ea0b39bb74c7f8204ba74d3e83bce440a59d88.tar.gz android_packages_providers_DownloadProvider-88ea0b39bb74c7f8204ba74d3e83bce440a59d88.tar.bz2 android_packages_providers_DownloadProvider-88ea0b39bb74c7f8204ba74d3e83bce440a59d88.zip |
Merge "Support for custom HTTP headers on download requests" into gingerbread
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java b/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java index e3b278bc..e9195609 100644 --- a/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java +++ b/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java @@ -20,6 +20,7 @@ import android.database.Cursor; import android.net.DownloadManager; import android.net.Uri; import android.os.Environment; +import android.util.Log; import tests.http.RecordedRequest; import java.io.File; @@ -271,6 +272,27 @@ public class PublicApiFunctionalTest extends AbstractDownloadManagerFunctionalTe } } + public void testRequestHeaders() throws Exception { + enqueueEmptyResponse(HTTP_OK); + Download download = enqueueRequest(getRequest().setRequestHeader("Header1", "value1") + .setRequestHeader("Header2", "value2")); + RecordedRequest request = download.runUntilStatus(DownloadManager.STATUS_SUCCESSFUL); + + assertTrue(request.getHeaders().contains("Header1: value1")); + assertTrue(request.getHeaders().contains("Header2: value2")); + } + + public void testDelete() throws Exception { + Download download = enqueueRequest(getRequest().setRequestHeader("header", "value")); + mManager.remove(download.mId); + Cursor cursor = mManager.query(new DownloadManager.Query()); + try { + assertEquals(0, cursor.getCount()); + } finally { + cursor.close(); + } + } + private DownloadManager.Request getRequest() throws MalformedURLException { return getRequest(getServerUri(REQUEST_PATH)); } |