summaryrefslogtreecommitdiffstats
path: root/test-runner
diff options
context:
space:
mode:
authorFred Quintana <fredq@google.com>2009-06-22 18:00:59 -0700
committerFred Quintana <fredq@google.com>2009-06-23 15:53:16 -0700
commitac9385ef3105fb7464e1f46049c62755a8b7f0e9 (patch)
tree922fb69a8ec88aaa1ade3be16a9f7aa0d46fa25b /test-runner
parentf86a58ff3d14fa6af3fa447809b45895bbb365f6 (diff)
downloadframeworks_base-ac9385ef3105fb7464e1f46049c62755a8b7f0e9.zip
frameworks_base-ac9385ef3105fb7464e1f46049c62755a8b7f0e9.tar.gz
frameworks_base-ac9385ef3105fb7464e1f46049c62755a8b7f0e9.tar.bz2
- clean up the sync settings names to:
(get|set)SyncAutomatically (get|set)MasterSyncAutomatically - change SYNC_EXTRAS_FORCE to SYNC_EXTRAS_MANUAL to mace clear that this overrides the .*SyncAutomatically settings - make ContentResolver methods that call the sync controls methods in IContentService so that SDK users can use them - rename startSync to requestSync to reinforce the fact that a sync is not immediately or always started when this method is called - add an Account parameter to all the sync settings and control methods - change the sync control methods to take a String authority rather than a Uri uri
Diffstat (limited to 'test-runner')
-rw-r--r--test-runner/android/test/SyncBaseInstrumentation.java33
1 files changed, 7 insertions, 26 deletions
diff --git a/test-runner/android/test/SyncBaseInstrumentation.java b/test-runner/android/test/SyncBaseInstrumentation.java
index bf9e783..a860bb3 100644
--- a/test-runner/android/test/SyncBaseInstrumentation.java
+++ b/test-runner/android/test/SyncBaseInstrumentation.java
@@ -19,7 +19,6 @@ package android.test;
import android.content.ContentResolver;
import android.content.Context;
import android.os.Bundle;
-import android.os.RemoteException;
import android.os.SystemClock;
import android.net.Uri;
import android.accounts.Account;
@@ -45,13 +44,12 @@ public class SyncBaseInstrumentation extends InstrumentationTestCase {
* Syncs the specified provider.
* @throws Exception
*/
- protected void syncProvider(Uri uri, String account, String authority) throws Exception {
+ protected void syncProvider(Uri uri, String accountName, String authority) throws Exception {
Bundle extras = new Bundle();
- extras.putBoolean(ContentResolver.SYNC_EXTRAS_FORCE, true);
- Account account1 = new Account(account, "com.google.GAIA");
- extras.putParcelable(ContentResolver.SYNC_EXTRAS_ACCOUNT, account1);
+ extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
+ Account account = new Account(accountName, "com.google.GAIA");
- mContentResolver.startSync(uri, extras);
+ ContentResolver.requestSync(account, authority, extras);
long startTimeInMillis = SystemClock.elapsedRealtime();
long endTimeInMillis = startTimeInMillis + MAX_TIME_FOR_SYNC_IN_MINS * 60000;
@@ -66,7 +64,7 @@ public class SyncBaseInstrumentation extends InstrumentationTestCase {
break;
}
- if (isSyncActive(account1, authority)) {
+ if (ContentResolver.isSyncActive(account, authority)) {
counter = 0;
continue;
}
@@ -75,24 +73,7 @@ public class SyncBaseInstrumentation extends InstrumentationTestCase {
}
protected void cancelSyncsandDisableAutoSync() {
- try {
- ContentResolver.getContentService().setListenForNetworkTickles(false);
- } catch (RemoteException e) {
- }
- mContentResolver.cancelSync(null);
- }
-
- /**
- * This method tests if any sync is active or not. Sync is considered to be active if the
- * entry is in either the Pending or Active tables.
- * @return
- */
- private boolean isSyncActive(Account account, String authority) {
- try {
- return ContentResolver.getContentService().isSyncActive(account,
- authority);
- } catch (RemoteException e) {
- return false;
- }
+ ContentResolver.setMasterSyncAutomatically(false);
+ ContentResolver.cancelSync(null /* all accounts */, null /* all authorities */);
}
}