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

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

Issue 2905003: Implement support for disabling sync through configuration management. (Closed)
Patch Set: Fix PrefsControllerTest on MAC. Created 10 years, 5 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_observer.h ('k') | chrome/browser/sync/sync_ui_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/profile_sync_service_startup_unittest.cc
diff --git a/chrome/browser/sync/profile_sync_service_startup_unittest.cc b/chrome/browser/sync/profile_sync_service_startup_unittest.cc
index 1f82139f45154820238f4a67de5b12264e744653..4f5935e40d91f5d3428db0a5944b6936f80507be 100644
--- a/chrome/browser/sync/profile_sync_service_startup_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_startup_unittest.cc
@@ -119,6 +119,40 @@ TEST_F(ProfileSyncServiceStartupTest, SKIP_MACOSX(StartNormal)) {
service_->Initialize();
}
+TEST_F(ProfileSyncServiceStartupTest, SKIP_MACOSX(ManagedStartup)) {
+ // Disable sync through policy.
+ profile_.GetPrefs()->SetBoolean(prefs::kSyncManaged, true);
+
+ EXPECT_CALL(factory_, CreateDataTypeManager(_, _)).Times(0);
+ EXPECT_CALL(observer_, OnStateChanged()).Times(1);
+
+ // Service should not be started by Initialize() since it's managed.
+ service_->Initialize();
+}
+
+TEST_F(ProfileSyncServiceStartupTest, SKIP_MACOSX(SwitchManaged)) {
+ DataTypeManagerMock* data_type_manager = SetUpDataTypeManager();
+ EXPECT_CALL(*data_type_manager, Configure(_)).Times(1);
+ EXPECT_CALL(observer_, OnStateChanged()).Times(3);
+
+ service_->Initialize();
+
+ // The service should stop when switching to managed mode.
+ Mock::VerifyAndClearExpectations(data_type_manager);
+ EXPECT_CALL(*data_type_manager, state()).
+ WillOnce(Return(DataTypeManager::CONFIGURED));
+ EXPECT_CALL(*data_type_manager, Stop()).Times(1);
+ EXPECT_CALL(observer_, OnStateChanged()).Times(2);
+ profile_.GetPrefs()->SetBoolean(prefs::kSyncManaged, true);
+
+ // When switching back to unmanaged, the state should change, but the service
+ // should not start up automatically (kSyncSetupCompleted will be false).
+ Mock::VerifyAndClearExpectations(data_type_manager);
+ EXPECT_CALL(factory_, CreateDataTypeManager(_, _)).Times(0);
+ EXPECT_CALL(observer_, OnStateChanged()).Times(1);
+ profile_.GetPrefs()->ClearPref(prefs::kSyncManaged);
+}
+
TEST_F(ProfileSyncServiceStartupTest, SKIP_MACOSX(StartFailure)) {
DataTypeManagerMock* data_type_manager = SetUpDataTypeManager();
DataTypeManager::ConfigureResult result =
« no previous file with comments | « chrome/browser/sync/profile_sync_service_observer.h ('k') | chrome/browser/sync/sync_ui_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698