diff options
Diffstat (limited to 'tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java')
-rw-r--r-- | tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java b/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java index e9195609..a9810fc1 100644 --- a/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java +++ b/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java @@ -17,10 +17,11 @@ package com.android.providers.downloads; import android.database.Cursor; +import android.net.ConnectivityManager; import android.net.DownloadManager; import android.net.Uri; import android.os.Environment; -import android.util.Log; +import android.test.suitebuilder.annotation.LargeTest; import tests.http.RecordedRequest; import java.io.File; @@ -28,6 +29,7 @@ import java.io.FileInputStream; import java.io.InputStream; import java.net.MalformedURLException; +@LargeTest public class PublicApiFunctionalTest extends AbstractDownloadManagerFunctionalTest { private static final String REQUEST_PATH = "/path"; @@ -293,6 +295,21 @@ public class PublicApiFunctionalTest extends AbstractDownloadManagerFunctionalTe } } + public void testSizeLimitOverMobile() throws Exception { + mSystemFacade.mMaxBytesOverMobile = FILE_CONTENT.length() - 1; + + mSystemFacade.mActiveNetworkType = ConnectivityManager.TYPE_MOBILE; + enqueueResponse(HTTP_OK, FILE_CONTENT); + Download download = enqueueRequest(getRequest()); + download.runUntilStatus(DownloadManager.STATUS_PAUSED); + + mSystemFacade.mActiveNetworkType = ConnectivityManager.TYPE_WIFI; + // first response was read, but aborted after the DL manager processed the Content-Length + // header, so we need to enqueue a second one + enqueueResponse(HTTP_OK, FILE_CONTENT); + download.runUntilStatus(DownloadManager.STATUS_SUCCESSFUL); + } + private DownloadManager.Request getRequest() throws MalformedURLException { return getRequest(getServerUri(REQUEST_PATH)); } |