use of android.content.SyncResult in project iosched by google.
the class ForceSyncNowAction method run.
@Override
public void run(final Context context, final Callback callback) {
ConferenceDataHandler.resetDataTimestamp(context);
final Bundle bundle = new Bundle();
bundle.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true);
new AsyncTask<Context, Void, Void>() {
@Override
protected Void doInBackground(Context... contexts) {
Account account = AccountUtils.getActiveAccount(context);
if (account == null) {
callback.done(false, "Cannot sync if there is no active account.");
} else {
new SyncHelper(contexts[0]).performSync(new SyncResult(), bundle);
}
return null;
}
}.execute(context);
}
use of android.content.SyncResult in project robolectric by robolectric.
the class ShadowSyncResultTest method testConstructor.
@Test
public void testConstructor() throws Exception {
SyncResult result = new SyncResult();
assertThat(result.stats).isNotNull();
}
use of android.content.SyncResult in project robolectric by robolectric.
the class ShadowSyncResultTest method hasSoftError.
@Test
public void hasSoftError() throws Exception {
SyncResult result = new SyncResult();
assertFalse(result.hasSoftError());
result.stats.numIoExceptions++;
assertTrue(result.hasSoftError());
assertTrue(result.hasError());
}
use of android.content.SyncResult in project robolectric by robolectric.
the class ShadowSyncResultTest method testMadeSomeProgress.
@Test
public void testMadeSomeProgress() throws Exception {
SyncResult result = new SyncResult();
assertFalse(result.madeSomeProgress());
result.stats.numInserts++;
assertTrue(result.madeSomeProgress());
}
use of android.content.SyncResult in project robolectric by robolectric.
the class ShadowSyncResultTest method testClear.
@Test
public void testClear() throws Exception {
SyncResult result = new SyncResult();
result.moreRecordsToGet = true;
result.stats.numInserts++;
result.clear();
assertFalse(result.moreRecordsToGet);
assertThat(result.stats.numInserts).isEqualTo(0L);
}
Aggregations