summaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/providers/downloads/FakeSystemFacade.java
diff options
context:
space:
mode:
authorSteve Howard <showard@google.com>2010-07-21 11:41:30 -0700
committerSteve Howard <showard@google.com>2010-07-21 19:03:51 -0700
commit0a77c62a82503b38c484e0079648f0231dd85d53 (patch)
treeb6e9999d7f527bc8addf005aa881005e3e66ba3c /tests/src/com/android/providers/downloads/FakeSystemFacade.java
parentb5629da794cb3c1ca1970d206343743b165b9644 (diff)
downloadandroid_packages_providers_DownloadProvider-0a77c62a82503b38c484e0079648f0231dd85d53.tar.gz
android_packages_providers_DownloadProvider-0a77c62a82503b38c484e0079648f0231dd85d53.tar.bz2
android_packages_providers_DownloadProvider-0a77c62a82503b38c484e0079648f0231dd85d53.zip
Public API support for broadcasts and connectivity control.
* Three new DB fields, one indicating whether a download was initiated by the public API or not, two to hold connectivity control info. DB migration to add these fields and code in DownloadProvider.insert() to handle them. * Change broadcast intent code to match public API spec, for public API downloads only. (Legacy code can go away once existing clients are converted over to the new API.) * Introduce SystemFacade methods for sending broadcasts and checking package ownership; this facilitates new tests of broadcast code. * Change DownloadInfo.canUseNetwork() to obey new connectivity controls available in public API, but again, retain legacy behavior for downloads initiated directly through DownloadProvider * New test cases to cover the new behavior Also made a couple changes to reduce some test flakiness I was observing: * in tearDown(), wait for any running UpdateThread to complete * in PublicApiFunctionalTest.setUp(), if the test directory already exists, remove it rather than aborting DB changes for broadcast + roaming support Change-Id: I60f39fc133f678f3510880ea6eb9f639358914b4
Diffstat (limited to 'tests/src/com/android/providers/downloads/FakeSystemFacade.java')
-rw-r--r--tests/src/com/android/providers/downloads/FakeSystemFacade.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/src/com/android/providers/downloads/FakeSystemFacade.java b/tests/src/com/android/providers/downloads/FakeSystemFacade.java
index 4ff313ab..0f8a9801 100644
--- a/tests/src/com/android/providers/downloads/FakeSystemFacade.java
+++ b/tests/src/com/android/providers/downloads/FakeSystemFacade.java
@@ -1,12 +1,18 @@
package com.android.providers.downloads;
+import android.content.Intent;
+import android.content.pm.PackageManager.NameNotFoundException;
import android.net.ConnectivityManager;
+import java.util.ArrayList;
+import java.util.List;
+
public class FakeSystemFacade implements SystemFacade {
long mTimeMillis = 0;
Integer mActiveNetworkType = ConnectivityManager.TYPE_WIFI;
boolean mIsRoaming = false;
Integer mMaxBytesOverMobile = null;
+ List<Intent> mBroadcastsSent = new ArrayList<Intent>();
void incrementTimeMillis(long delta) {
mTimeMillis += delta;
@@ -27,4 +33,14 @@ public class FakeSystemFacade implements SystemFacade {
public Integer getMaxBytesOverMobile() {
return mMaxBytesOverMobile ;
}
+
+ @Override
+ public void sendBroadcast(Intent intent) {
+ mBroadcastsSent.add(intent);
+ }
+
+ @Override
+ public boolean userOwnsPackage(int uid, String pckg) throws NameNotFoundException {
+ return true;
+ }
}