diff options
Diffstat (limited to 'test-runner')
| -rw-r--r-- | test-runner/android/test/SyncBaseInstrumentation.java | 33 |
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 */); } } |
