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

Unified Diff: chrome/browser/sync/test/integration/password_manager_setting_migrator_helper.cc

Issue 1256803002: [Smart Lock, Prefs reconciliation] Prefs migration logic for desktop platforms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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/test/integration/password_manager_setting_migrator_helper.cc
diff --git a/chrome/browser/sync/test/integration/password_manager_setting_migrator_helper.cc b/chrome/browser/sync/test/integration/password_manager_setting_migrator_helper.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d7ff6bdca574929d21081d44775b636f1890dbce
--- /dev/null
+++ b/chrome/browser/sync/test/integration/password_manager_setting_migrator_helper.cc
@@ -0,0 +1,50 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/sync/test/integration/password_manager_setting_migrator_helper.h"
+
+#include "base/metrics/field_trial.h"
+#include "base/prefs/pref_service.h"
+#include "chrome/browser/chrome_notification_types.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/sync/test/integration/preferences_helper.h"
+#include "components/password_manager/core/common/password_manager_pref_names.h"
+#include "content/public/browser/notification_details.h"
+#include "content/public/browser/notification_service.h"
+#include "content/public/browser/notification_source.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+using preferences_helper::GetPrefs;
+
+namespace {
+
+const char kFieldTrialName[] = "PasswordManagerSettingsMigration";
+const char kEnabledGroupName[] = "Enable";
+
+} // namespace
+
+namespace password_manager_setting_migrater_helper {
+
+void SetupFieldTrial() {
+ base::FieldTrialList::CreateFieldTrial(kFieldTrialName, kEnabledGroupName);
+}
+
+void SendProfileAddNotification(Profile* profile) {
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_PROFILE_ADDED, content::Source<Profile>(profile),
+ content::NotificationService::NoDetails());
+}
+
+void ExpectPrefValuesOnClient(int index,
+ bool new_pref_value,
+ bool old_pref_value) {
+ using password_manager::prefs::kCredentialsEnableService;
+ using password_manager::prefs::kPasswordManagerSavingEnabled;
+ EXPECT_EQ(new_pref_value,
+ GetPrefs(index)->GetBoolean(kCredentialsEnableService));
+ EXPECT_EQ(old_pref_value,
+ GetPrefs(index)->GetBoolean(kPasswordManagerSavingEnabled));
+}
+
+} // namespace password_manager_setting_migrater_helper

Powered by Google App Engine
This is Rietveld 408576698