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

Unified Diff: chrome/browser/sync/profile_sync_service_unittest.cc

Issue 11043012: [Sync] Notify invalidation handlers when sync is disabled/enabled (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 2 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
« no previous file with comments | « chrome/browser/sync/profile_sync_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/profile_sync_service_unittest.cc
diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc
index 4bd18df6fce0508d130477159002618aab945a15..4379614aef9abe18b54d12a14f764ddd59f9e112 100644
--- a/chrome/browser/sync/profile_sync_service_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_unittest.cc
@@ -399,6 +399,31 @@ TEST_F(ProfileSyncServiceTest, FailToOpenDatabase) {
EXPECT_FALSE(harness_.service->sync_initialized());
}
+// Register a handler with the ProfileSyncService, and disable and
+// reenable sync. The handler should get notified of the state
+// changes.
+TEST_F(ProfileSyncServiceTest, DisableInvalidationsOnStop) {
+ harness_.StartSyncService();
+
+ syncer::FakeInvalidationHandler handler;
+ harness_.service->RegisterInvalidationHandler(&handler);
+
+ SyncBackendHostForProfileSyncTest* const backend =
+ harness_.service->GetBackendForTest();
+
+ backend->EmitOnInvalidatorStateChange(syncer::INVALIDATIONS_ENABLED);
+ EXPECT_EQ(syncer::INVALIDATIONS_ENABLED, handler.GetInvalidatorState());
+
+ harness_.service->StopAndSuppress();
+ EXPECT_EQ(syncer::TRANSIENT_INVALIDATION_ERROR,
+ handler.GetInvalidatorState());
+
+ harness_.service->UnsuppressAndStart();
+ EXPECT_EQ(syncer::INVALIDATIONS_ENABLED, handler.GetInvalidatorState());
+
+ harness_.service->UnregisterInvalidationHandler(&handler);
+}
+
// Register for some IDs with the ProfileSyncService, restart sync,
// and trigger some invalidation messages. They should still be
// received by the handler.
« no previous file with comments | « chrome/browser/sync/profile_sync_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698