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

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: Renamed methods for stopping/starting sync and added google services username to sync prefs 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
« no previous file with comments | « chrome/browser/sync/profile_sync_service.cc ('k') | chrome/browser/sync/sync_prefs.h » ('j') | 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 47724f03d287019acf621f68fb8209f42318e779..22768f12d9e22cb9556785ed192a963d8529f668 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_->StopAndSuppress();
+ EXPECT_FALSE(service_->sync_initialized());
+ EXPECT_TRUE(profile_->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart));
+
+ service_->UnsuppressAndStart();
+ EXPECT_TRUE(service_->sync_initialized());
+ EXPECT_FALSE(profile_->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart));
+}
+
TEST_F(ProfileSyncServiceTest, JsControllerHandlersBasic) {
StartSyncService();
EXPECT_TRUE(service_->sync_initialized());
« no previous file with comments | « chrome/browser/sync/profile_sync_service.cc ('k') | chrome/browser/sync/sync_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698