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

Unified Diff: components/password_manager/core/browser/password_manager_test_utils.cc

Issue 1668523002: [Password Manager] Switch password manager code to use the Feature framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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: components/password_manager/core/browser/password_manager_test_utils.cc
diff --git a/components/password_manager/core/browser/password_manager_test_utils.cc b/components/password_manager/core/browser/password_manager_test_utils.cc
index edfe3900363386e2eb6f90f413c011bf206e4f15..ccf2829fd66815f00d762d3330b6fb2cefbd4b6e 100644
--- a/components/password_manager/core/browser/password_manager_test_utils.cc
+++ b/components/password_manager/core/browser/password_manager_test_utils.cc
@@ -8,6 +8,7 @@
#include <ostream>
#include <string>
+#include "base/feature_list.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -15,6 +16,18 @@ using autofill::PasswordForm;
namespace password_manager {
+namespace {
+
+void GetFeatureOverridesAsCSV(const std::vector<const base::Feature*>& features,
+ std::string* overrides) {
+ for (const base::Feature* feature : features) {
+ overrides->append(feature->name);
+ overrides->push_back(',');
+ }
+}
+
+} // namespace
+
const char kTestingIconUrlSpec[] = "https://accounts.google.com/Icon";
const char kTestingFederationUrlSpec[] = "https://accounts.google.com/login";
const int kTestingDaysAfterPasswordsAreSynced = 1;
@@ -95,6 +108,20 @@ bool ContainsEqualPasswordFormsUnordered(
return !had_mismatched_actual_form && remaining_expectations.empty();
}
+void SetFeatures(const std::vector<const base::Feature*>& enable_features,
+ const std::vector<const base::Feature*>& disable_features,
+ scoped_ptr<base::FeatureList> feature_list) {
+ std::string enable_overrides;
+ std::string disable_overrides;
+
+ GetFeatureOverridesAsCSV(enable_features, &enable_overrides);
+ GetFeatureOverridesAsCSV(disable_features, &disable_overrides);
+
+ base::FeatureList::ClearInstanceForTesting();
+ feature_list->InitializeFromCommandLine(enable_overrides, disable_overrides);
+ base::FeatureList::SetInstance(std::move(feature_list));
+}
+
MockPasswordStoreObserver::MockPasswordStoreObserver() {}
MockPasswordStoreObserver::~MockPasswordStoreObserver() {}

Powered by Google App Engine
This is Rietveld 408576698