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

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

Issue 8332023: Add support for temporarily disabling sync. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simplified startup condition for sync Created 9 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 47724f03d287019acf621f68fb8209f42318e779..d68696699e85b91281da76f0eca3cb4a4310a230 100644
--- a/chrome/browser/sync/profile_sync_service_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_unittest.cc
@@ -155,6 +155,31 @@ TEST_F(ProfileSyncServiceTest, AbortedByShutdown) {
service_.reset();
}
+TEST_F(ProfileSyncServiceTest, DisableAndEnableSyncTemporarily) {
+ service_.reset(new TestProfileSyncService(&factory_,
+ profile_.get(),
+ "test", true, NULL));
+ // Register the bookmark data type.
+ EXPECT_CALL(factory_, CreateDataTypeManager(_, _)).
+ WillRepeatedly(ReturnNewDataTypeManager());
+
+ profile_->GetTokenService()->IssueAuthTokenForTest(
+ GaiaConstants::kSyncService, "token");
+
+ service_->Initialize();
+ EXPECT_TRUE(service_->sync_initialized());
+ EXPECT_TRUE(service_->GetBackendForTest() != NULL);
+ EXPECT_FALSE(profile_->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart));
+
+ service_->StopSyncAndSuppressStartUp();
+ EXPECT_FALSE(service_->sync_initialized());
+ EXPECT_TRUE(profile_->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart));
+
+ service_->DisableSyncSuppressionAndStartUpSync();
+ EXPECT_TRUE(service_->sync_initialized());
+ EXPECT_FALSE(profile_->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart));
+}
+
TEST_F(ProfileSyncServiceTest, JsControllerHandlersBasic) {
StartSyncService();
EXPECT_TRUE(service_->sync_initialized());
« chrome/browser/sync/profile_sync_service.cc ('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