summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSudheer Shanka <sudheersai@google.com>2019-05-06 21:24:14 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-05-06 21:24:14 +0000
commitab55bc184442d7b5367c1d9f4848c9229ab13529 (patch)
tree51ea3edfdea54b73a91a17521a9857662b161b8b
parent8208a9c0a33ec0432616d9165ea302700031e97a (diff)
parentb502cd3bc3730feb4a6e2684b54974960467f961 (diff)
downloadandroid_packages_providers_DownloadProvider-ab55bc184442d7b5367c1d9f4848c9229ab13529.tar.gz
android_packages_providers_DownloadProvider-ab55bc184442d7b5367c1d9f4848c9229ab13529.tar.bz2
android_packages_providers_DownloadProvider-ab55bc184442d7b5367c1d9f4848c9229ab13529.zip
Merge "Fix DownloadProviderTests." into qt-dev
-rw-r--r--tests/src/com/android/providers/downloads/AbstractPublicApiTest.java8
-rw-r--r--tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java6
2 files changed, 11 insertions, 3 deletions
diff --git a/tests/src/com/android/providers/downloads/AbstractPublicApiTest.java b/tests/src/com/android/providers/downloads/AbstractPublicApiTest.java
index 3a585b47..bb89b6f6 100644
--- a/tests/src/com/android/providers/downloads/AbstractPublicApiTest.java
+++ b/tests/src/com/android/providers/downloads/AbstractPublicApiTest.java
@@ -26,6 +26,7 @@ import android.content.ContentResolver;
import android.content.ContextWrapper;
import android.database.Cursor;
import android.net.Uri;
+import android.os.Environment;
import android.os.ParcelFileDescriptor;
import android.os.SystemClock;
import android.util.Log;
@@ -238,6 +239,13 @@ public abstract class AbstractPublicApiTest extends AbstractDownloadProviderFunc
return getRequest(getServerUri(REQUEST_PATH));
}
+ protected DownloadManager.Request getRequestWithDestinationDownloadsDir()
+ throws MalformedURLException, UnknownHostException {
+ final DownloadManager.Request request = getRequest();
+ request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "testfile.txt");
+ return request;
+ }
+
protected DownloadManager.Request getRequest(String path) {
return new DownloadManager.Request(Uri.parse(path));
}
diff --git a/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java b/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java
index cabcc313..ae0e7e52 100644
--- a/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java
+++ b/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java
@@ -250,15 +250,15 @@ public class PublicApiFunctionalTest extends AbstractPublicApiTest {
enqueueResponse(buildEmptyResponse(HTTP_OK));
enqueueResponse(buildEmptyResponse(HTTP_NOT_FOUND));
- Download download1 = enqueueRequest(getRequest());
+ Download download1 = enqueueRequest(getRequestWithDestinationDownloadsDir());
download1.runUntilStatus(DownloadManager.STATUS_SUCCESSFUL);
mSystemFacade.incrementTimeMillis(1); // ensure downloads are correctly ordered by time
- Download download2 = enqueueRequest(getRequest());
+ Download download2 = enqueueRequest(getRequestWithDestinationDownloadsDir());
download2.runUntilStatus(DownloadManager.STATUS_FAILED);
mSystemFacade.incrementTimeMillis(1);
- Download download3 = enqueueRequest(getRequest());
+ Download download3 = enqueueRequest(getRequestWithDestinationDownloadsDir());
Cursor cursor = mManager.query(new DownloadManager.Query());
checkAndCloseCursor(cursor, download3, download2, download1);