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

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

Issue 22642004: Ensure we never try to register for the object id "NULL" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 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/InvalidationControllerTest.java
diff --git a/sync/android/javatests/src/org/chromium/sync/notifier/InvalidationControllerTest.java b/sync/android/javatests/src/org/chromium/sync/notifier/InvalidationControllerTest.java
index 44f9eb40e5451085ac89760c8ac23b7ba01fe790..bd1ead655daf80af2de6bbfbf6a6b20e093451b7 100644
--- a/sync/android/javatests/src/org/chromium/sync/notifier/InvalidationControllerTest.java
+++ b/sync/android/javatests/src/org/chromium/sync/notifier/InvalidationControllerTest.java
@@ -177,6 +177,32 @@ public class InvalidationControllerTest extends InstrumentationTestCase {
@SmallTest
@Feature({"Sync"})
+ public void testRegisterForSpecificTypesNoProxyTabs() {
+ InvalidationController controller = new InvalidationController(mContext);
+ Account account = new Account("test@example.com", "bogus");
+ controller.setRegisteredTypes(account, false,
+ Sets.newHashSet(ModelType.BOOKMARK, ModelType.SESSION, ModelType.PROXY_TABS));
+ assertEquals(1, mContext.getNumStartedIntents());
+
+ // Validate destination.
+ Intent intent = mContext.getStartedIntent(0);
+ validateIntentComponent(intent);
+ assertEquals(IntentProtocol.ACTION_REGISTER, intent.getAction());
+
+ // Validate account.
+ Account intentAccount = intent.getParcelableExtra(IntentProtocol.EXTRA_ACCOUNT);
+ assertEquals(account, intentAccount);
+
+ // Validate registered types. Should not include PROXY_TABS.
+ Set<String> expectedTypes =
+ Sets.newHashSet(ModelType.BOOKMARK.name(), ModelType.SESSION.name());
+ Set<String> actualTypes = Sets.newHashSet();
+ actualTypes.addAll(intent.getStringArrayListExtra(IntentProtocol.EXTRA_REGISTERED_TYPES));
+ assertEquals(expectedTypes, actualTypes);
+ }
+
+ @SmallTest
+ @Feature({"Sync"})
public void testRegisterForAllTypes() {
Account account = new Account("test@example.com", "bogus");
mController.setRegisteredTypes(account, true,

Powered by Google App Engine
This is Rietveld 408576698