summaryrefslogtreecommitdiffstats
path: root/tests/src/com/android
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/com/android')
-rw-r--r--tests/src/com/android/providers/downloads/FakeSystemFacade.java9
-rw-r--r--tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java5
2 files changed, 10 insertions, 4 deletions
diff --git a/tests/src/com/android/providers/downloads/FakeSystemFacade.java b/tests/src/com/android/providers/downloads/FakeSystemFacade.java
index 9620ffc3..fbaf6366 100644
--- a/tests/src/com/android/providers/downloads/FakeSystemFacade.java
+++ b/tests/src/com/android/providers/downloads/FakeSystemFacade.java
@@ -4,6 +4,7 @@ import android.app.Notification;
import android.content.Intent;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
import android.test.AssertionFailedError;
import java.util.ArrayList;
@@ -36,8 +37,12 @@ public class FakeSystemFacade implements SystemFacade {
return mTimeMillis;
}
- public Integer getActiveNetworkType() {
- return mActiveNetworkType;
+ public NetworkInfo getActiveNetworkInfo(int uid) {
+ if (mActiveNetworkType == null) {
+ return null;
+ } else {
+ return new NetworkInfo(mActiveNetworkType, 0, null, null);
+ }
}
public boolean isNetworkRoaming() {
diff --git a/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java b/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java
index 64c19530..f2a26f12 100644
--- a/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java
+++ b/tests/src/com/android/providers/downloads/PublicApiFunctionalTest.java
@@ -441,11 +441,12 @@ public class PublicApiFunctionalTest extends AbstractPublicApiTest {
}
public void testBasicConnectivityChanges() throws Exception {
+ // without connectivity, download immediately pauses
+ mSystemFacade.mActiveNetworkType = null;
+
enqueueResponse(HTTP_OK, FILE_CONTENT);
Download download = enqueueRequest(getRequest());
- // without connectivity, download immediately pauses
- mSystemFacade.mActiveNetworkType = null;
download.runUntilStatus(DownloadManager.STATUS_PAUSED);
// connecting should start the download