Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(783)

Unified Diff: sync/android/javatests/src/org/chromium/sync/notifier/InvalidationPreferencesTest.java

Issue 23643002: Enable invalidations for arbitrary objects on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sync/android/javatests/src/org/chromium/sync/notifier/InvalidationPreferencesTest.java
diff --git a/sync/android/javatests/src/org/chromium/sync/notifier/InvalidationPreferencesTest.java b/sync/android/javatests/src/org/chromium/sync/notifier/InvalidationPreferencesTest.java
index 2c5e84168661e04ac73f2b03549162c7be5d658e..b58bda62127b4a624306846b069bb4a75810a8db 100644
--- a/sync/android/javatests/src/org/chromium/sync/notifier/InvalidationPreferencesTest.java
+++ b/sync/android/javatests/src/org/chromium/sync/notifier/InvalidationPreferencesTest.java
@@ -9,6 +9,8 @@ import android.content.Context;
import android.test.InstrumentationTestCase;
import android.test.suitebuilder.annotation.SmallTest;
+import com.google.ipc.invalidation.external.client.types.ObjectId;
+
import org.chromium.base.CollectionUtil;
import org.chromium.base.test.util.AdvancedMockContext;
import org.chromium.base.test.util.Feature;
@@ -69,6 +71,7 @@ public class InvalidationPreferencesTest extends InstrumentationTestCase {
InvalidationPreferences invPreferences = new InvalidationPreferences(mContext);
assertNull(invPreferences.getSavedSyncedAccount());
assertNull(invPreferences.getSavedSyncedTypes());
+ assertNull(invPreferences.getSavedObjectIds());
assertNull(invPreferences.getInternalNotificationClientState());
}
@@ -85,20 +88,26 @@ public class InvalidationPreferencesTest extends InstrumentationTestCase {
// We should never write both a real type and the all-types type in practice, but we test
// with them here to ensure that preferences are not interpreting the written data.
Set<String> syncTypes = CollectionUtil.newHashSet("BOOKMARK", ModelType.ALL_TYPES_TYPE);
+ Set<ObjectId> objectIds = CollectionUtil.newHashSet(
+ ObjectId.newInstance(1, "obj1".getBytes()),
+ ObjectId.newInstance(2, "obj2".getBytes()));
Account account = new Account("test@example.com", "bogus");
byte[] internalClientState = new byte[]{100,101,102};
invPreferences.setSyncTypes(editContext, syncTypes);
+ invPreferences.setObjectIds(editContext, objectIds);
invPreferences.setAccount(editContext, account);
invPreferences.setInternalNotificationClientState(editContext, internalClientState);
// Nothing should yet have been written.
assertNull(invPreferences.getSavedSyncedAccount());
assertNull(invPreferences.getSavedSyncedTypes());
+ assertNull(invPreferences.getSavedObjectIds());
// Write the new data and verify that they are correctly read back.
invPreferences.commit(editContext);
assertEquals(account, invPreferences.getSavedSyncedAccount());
assertEquals(syncTypes, invPreferences.getSavedSyncedTypes());
+ assertEquals(objectIds, invPreferences.getSavedObjectIds());
assertTrue(Arrays.equals(
internalClientState, invPreferences.getInternalNotificationClientState()));
}

Powered by Google App Engine
This is Rietveld 408576698