summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/sync/glue/sync_backend_host.cc4
-rw-r--r--chrome/browser/sync/profile_sync_factory_impl.cc2
-rw-r--r--chrome/browser/sync/profile_sync_factory_impl_unittest.cc38
-rw-r--r--chrome/common/chrome_switches.cc6
-rw-r--r--chrome/common/chrome_switches.h2
-rw-r--r--chrome/test/live_sync/live_sync_test.cc5
6 files changed, 38 insertions, 19 deletions
diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc
index 7d833bd..f33c8c9 100644
--- a/chrome/browser/sync/glue/sync_backend_host.cc
+++ b/chrome/browser/sync/glue/sync_backend_host.cc
@@ -120,8 +120,8 @@ void SyncBackendHost::Initialize(
// TODO(tim): Remove this special case once NIGORI is populated by
// default. We piggy back off of the passwords flag for now to not
// require both encryption and passwords flags.
- bool enable_encryption = CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableSyncPasswords) || types.count(syncable::PASSWORDS);
+ bool enable_encryption = !CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableSyncPasswords);
if (enable_encryption)
registrar_.routing_info[syncable::NIGORI] = GROUP_PASSIVE;
diff --git a/chrome/browser/sync/profile_sync_factory_impl.cc b/chrome/browser/sync/profile_sync_factory_impl.cc
index ed8f429..2585f71 100644
--- a/chrome/browser/sync/profile_sync_factory_impl.cc
+++ b/chrome/browser/sync/profile_sync_factory_impl.cc
@@ -111,7 +111,7 @@ ProfileSyncService* ProfileSyncFactoryImpl::CreateProfileSyncService(
// Password sync is disabled by default. Register only if
// explicitly enabled.
- if (command_line_->HasSwitch(switches::kEnableSyncPasswords)) {
+ if (!command_line_->HasSwitch(switches::kDisableSyncPasswords)) {
pss->RegisterDataTypeController(
new PasswordDataTypeController(this, profile_, pss));
}
diff --git a/chrome/browser/sync/profile_sync_factory_impl_unittest.cc b/chrome/browser/sync/profile_sync_factory_impl_unittest.cc
index f622ef4..2e1a708 100644
--- a/chrome/browser/sync/profile_sync_factory_impl_unittest.cc
+++ b/chrome/browser/sync/profile_sync_factory_impl_unittest.cc
@@ -43,13 +43,14 @@ TEST_F(ProfileSyncFactoryImplTest, CreatePSSDefault) {
DataTypeController::StateMap controller_states;
DataTypeController::StateMap* controller_states_ptr = &controller_states;
pss->GetDataTypeControllerStates(controller_states_ptr);
- EXPECT_EQ(6U, controller_states_ptr->size());
+ EXPECT_EQ(7U, controller_states_ptr->size());
EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::APPS));
+ EXPECT_EQ(1U, controller_states_ptr->count(syncable::PASSWORDS));
}
TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableAutofill) {
@@ -59,13 +60,14 @@ TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableAutofill) {
DataTypeController::StateMap controller_states;
DataTypeController::StateMap* controller_states_ptr = &controller_states;
pss->GetDataTypeControllerStates(controller_states_ptr);
- EXPECT_EQ(5U, controller_states_ptr->size());
+ EXPECT_EQ(6U, controller_states_ptr->size());
EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES));
EXPECT_EQ(0U, controller_states_ptr->count(syncable::AUTOFILL));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::APPS));
+ EXPECT_EQ(1U, controller_states_ptr->count(syncable::PASSWORDS));
}
TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableBookmarks) {
@@ -75,13 +77,14 @@ TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableBookmarks) {
DataTypeController::StateMap controller_states;
DataTypeController::StateMap* controller_states_ptr = &controller_states;
pss->GetDataTypeControllerStates(controller_states_ptr);
- EXPECT_EQ(5U, controller_states_ptr->size());
+ EXPECT_EQ(6U, controller_states_ptr->size());
EXPECT_EQ(0U, controller_states_ptr->count(syncable::BOOKMARKS));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::APPS));
+ EXPECT_EQ(1U, controller_states_ptr->count(syncable::PASSWORDS));
}
TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisablePreferences) {
@@ -91,13 +94,14 @@ TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisablePreferences) {
DataTypeController::StateMap controller_states;
DataTypeController::StateMap* controller_states_ptr = &controller_states;
pss->GetDataTypeControllerStates(controller_states_ptr);
- EXPECT_EQ(5U, controller_states_ptr->size());
+ EXPECT_EQ(6U, controller_states_ptr->size());
EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS));
EXPECT_EQ(0U, controller_states_ptr->count(syncable::PREFERENCES));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::APPS));
+ EXPECT_EQ(1U, controller_states_ptr->count(syncable::PASSWORDS));
}
TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableThemes) {
@@ -107,13 +111,14 @@ TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableThemes) {
DataTypeController::StateMap controller_states;
DataTypeController::StateMap* controller_states_ptr = &controller_states;
pss->GetDataTypeControllerStates(controller_states_ptr);
- EXPECT_EQ(5U, controller_states_ptr->size());
+ EXPECT_EQ(6U, controller_states_ptr->size());
EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL));
EXPECT_EQ(0U, controller_states_ptr->count(syncable::THEMES));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::APPS));
+ EXPECT_EQ(1U, controller_states_ptr->count(syncable::PASSWORDS));
}
TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableExtensions) {
@@ -123,13 +128,14 @@ TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableExtensions) {
DataTypeController::StateMap controller_states;
DataTypeController::StateMap* controller_states_ptr = &controller_states;
pss->GetDataTypeControllerStates(controller_states_ptr);
- EXPECT_EQ(5U, controller_states_ptr->size());
+ EXPECT_EQ(6U, controller_states_ptr->size());
EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES));
EXPECT_EQ(0U, controller_states_ptr->count(syncable::EXTENSIONS));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::APPS));
+ EXPECT_EQ(1U, controller_states_ptr->count(syncable::PASSWORDS));
}
TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableApps) {
@@ -139,11 +145,29 @@ TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisableApps) {
DataTypeController::StateMap controller_states;
DataTypeController::StateMap* controller_states_ptr = &controller_states;
pss->GetDataTypeControllerStates(controller_states_ptr);
- EXPECT_EQ(5U, controller_states_ptr->size());
+ EXPECT_EQ(6U, controller_states_ptr->size());
EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES));
EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS));
EXPECT_EQ(0U, controller_states_ptr->count(syncable::APPS));
+ EXPECT_EQ(1U, controller_states_ptr->count(syncable::PASSWORDS));
+}
+
+TEST_F(ProfileSyncFactoryImplTest, CreatePSSDisablePasswords) {
+ command_line_->AppendSwitch(switches::kDisableSyncPasswords);
+ scoped_ptr<ProfileSyncService> pss;
+ pss.reset(profile_sync_service_factory_->CreateProfileSyncService(""));
+ DataTypeController::StateMap controller_states;
+ DataTypeController::StateMap* controller_states_ptr = &controller_states;
+ pss->GetDataTypeControllerStates(controller_states_ptr);
+ EXPECT_EQ(6U, controller_states_ptr->size());
+ EXPECT_EQ(1U, controller_states_ptr->count(syncable::BOOKMARKS));
+ EXPECT_EQ(1U, controller_states_ptr->count(syncable::PREFERENCES));
+ EXPECT_EQ(1U, controller_states_ptr->count(syncable::AUTOFILL));
+ EXPECT_EQ(1U, controller_states_ptr->count(syncable::THEMES));
+ EXPECT_EQ(1U, controller_states_ptr->count(syncable::EXTENSIONS));
+ EXPECT_EQ(1U, controller_states_ptr->count(syncable::APPS));
+ EXPECT_EQ(0U, controller_states_ptr->count(syncable::PASSWORDS));
}
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index b8026f5..7db7b2d 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -297,6 +297,9 @@ const char kDisableSyncBookmarks[] = "disable-sync-bookmarks";
// Disable syncing of extensions.
const char kDisableSyncExtensions[] = "disable-sync-extensions";
+// Disable syncing browser passwords.
+const char kDisableSyncPasswords[] = "disable-sync-passwords";
+
// Disable syncing of preferences.
const char kDisableSyncPreferences[] = "disable-sync-preferences";
@@ -490,9 +493,6 @@ const char kEnableSync[] = "enable-sync";
// Enable syncing browser autofill.
const char kEnableSyncAutofill[] = "enable-sync-autofill";
-// Enable syncing browser passwords.
-const char kEnableSyncPasswords[] = "enable-sync-passwords";
-
// Enable syncing browser sessions.
const char kEnableSyncSessions[] = "enable-sync-sessions";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 5a787e1..5d23435 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -97,6 +97,7 @@ extern const char kDisableSyncApps[];
extern const char kDisableSyncAutofill[];
extern const char kDisableSyncBookmarks[];
extern const char kDisableSyncExtensions[];
+extern const char kDisableSyncPasswords[];
extern const char kDisableSyncPreferences[];
extern const char kDisableSyncThemes[];
extern const char kDisableTabCloseableStateWatcher[];
@@ -150,7 +151,6 @@ extern const char kEnableSnapStart[];
extern const char kEnableStatsTable[];
extern const char kEnableSync[];
extern const char kEnableSyncAutofill[];
-extern const char kEnableSyncPasswords[];
extern const char kEnableSyncPreferences[];
extern const char kEnableSyncSessions[];
extern const char kEnableSyncTypedUrls[];
diff --git a/chrome/test/live_sync/live_sync_test.cc b/chrome/test/live_sync/live_sync_test.cc
index 6fd16cb..ba55dd4 100644
--- a/chrome/test/live_sync/live_sync_test.cc
+++ b/chrome/test/live_sync/live_sync_test.cc
@@ -118,11 +118,6 @@ void LiveSyncTest::SetUp() {
cl->AppendSwitch(switches::kSyncUseSslTcp);
}
- // TODO(sync): Remove this once passwords sync is enabled by default.
- if (!cl->HasSwitch(switches::kEnableSyncPasswords)) {
- cl->AppendSwitch(switches::kEnableSyncPasswords);
- }
-
// Mock the Mac Keychain service. The real Keychain can block on user input.
#if defined(OS_MACOSX)
Encryptor::UseMockKeychain(true);