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

Side by Side 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: Addresses the review inputs. Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/password_manager/core/browser/password_manager_test_utils.h " 5 #include "components/password_manager/core/browser/password_manager_test_utils.h "
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <ostream> 8 #include <ostream>
9 #include <string> 9 #include <string>
10 10
11 #include "base/feature_list.h"
11 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
13 14
14 using autofill::PasswordForm; 15 using autofill::PasswordForm;
15 16
16 namespace password_manager { 17 namespace password_manager {
17 18
18 const char kTestingIconUrlSpec[] = "https://accounts.google.com/Icon"; 19 const char kTestingIconUrlSpec[] = "https://accounts.google.com/Icon";
19 const char kTestingFederationUrlSpec[] = "https://accounts.google.com/login"; 20 const char kTestingFederationUrlSpec[] = "https://accounts.google.com/login";
20 const int kTestingDaysAfterPasswordsAreSynced = 1; 21 const int kTestingDaysAfterPasswordsAreSynced = 1;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 for (const PasswordForm* remaining_expected_form : remaining_expectations) { 89 for (const PasswordForm* remaining_expected_form : remaining_expectations) {
89 *mismatch_output << std::endl 90 *mismatch_output << std::endl
90 << "Unmatched expected form:" << std::endl 91 << "Unmatched expected form:" << std::endl
91 << *remaining_expected_form; 92 << *remaining_expected_form;
92 } 93 }
93 } 94 }
94 95
95 return !had_mismatched_actual_form && remaining_expectations.empty(); 96 return !had_mismatched_actual_form && remaining_expectations.empty();
96 } 97 }
97 98
99 void EnableFeature(const base::Feature& feature,
100 bool set_enabled,
101 bool appends_to_list) {
102 std::string enable_overrides, disable_overrides;
Bernhard Bauer 2016/02/11 11:12:40 Nit: Declare each variable on a separate line.
Pritam Nikam 2016/02/25 14:16:06 Done.
103 if (appends_to_list) {
104 base::FeatureList::GetInstance()->GetFeatureOverrides(&enable_overrides,
105 &disable_overrides);
106 }
107
108 if (set_enabled) {
109 enable_overrides.push_back(',');
110 enable_overrides.append(feature.name);
111 } else {
112 disable_overrides.push_back(',');
113 disable_overrides.append(feature.name);
114 }
115
116 base::FeatureList::ClearInstanceForTesting();
117 scoped_ptr<base::FeatureList> feature_list(new base::FeatureList);
118 feature_list->InitializeFromCommandLine(enable_overrides, disable_overrides);
119 base::FeatureList::SetInstance(std::move(feature_list));
120 }
121
98 MockPasswordStoreObserver::MockPasswordStoreObserver() {} 122 MockPasswordStoreObserver::MockPasswordStoreObserver() {}
99 123
100 MockPasswordStoreObserver::~MockPasswordStoreObserver() {} 124 MockPasswordStoreObserver::~MockPasswordStoreObserver() {}
101 125
102 } // namespace password_manager 126 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698