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() {} |