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

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: diff properly 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
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 7e9e14dccf9350b6d9ef55a19498fc458b4f37c7..4e0d03cf1dd767e1da5e17dbd0ba3e97e1a79e67 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.
« chrome/browser/sync/profile_sync_service.h ('K') | « 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