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()); |