Chromium Code Reviews| Index: chrome/renderer/autofill/password_autofill_agent_browsertest.cc |
| diff --git a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc |
| index 2fa4a8eee6a1851ced36d5af88f3181eed5da259..49234f3726209df38789e4f7ce96d8c13f613be1 100644 |
| --- a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc |
| +++ b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc |
| @@ -4,7 +4,7 @@ |
| #include <tuple> |
| -#include "base/command_line.h" |
| +#include "base/feature_list.h" |
| #include "base/macros.h" |
| #include "base/strings/string_util.h" |
| #include "base/strings/utf_string_conversions.h" |
| @@ -17,7 +17,6 @@ |
| #include "components/autofill/content/renderer/test_password_autofill_agent.h" |
| #include "components/autofill/content/renderer/test_password_generation_agent.h" |
| #include "components/autofill/core/common/autofill_constants.h" |
| -#include "components/autofill/core/common/autofill_switches.h" |
| #include "components/autofill/core/common/form_data.h" |
| #include "components/autofill/core/common/form_field_data.h" |
| #include "components/autofill/core/common/password_form_field_prediction_map.h" |
| @@ -45,6 +44,14 @@ using blink::WebInputElement; |
| using blink::WebString; |
| using blink::WebView; |
| +namespace password_manager { |
|
vabr (Chromium)
2016/06/15 09:15:33
You should be able to just
#include "components/pa
jww
2016/06/15 17:17:56
components/password_manager/core/common wasn't in
vabr (Chromium)
2016/06/16 07:03:38
Acknowledged, this kind of dependency is OK.
(Also
|
| +namespace features { |
| + |
| +extern const base::Feature kFillOnAccountSelect; |
| + |
| +} // namespace features |
| +} // namespace password_manager |
| + |
| namespace { |
| const int kPasswordFillFormDataId = 1234; |
| @@ -327,6 +334,14 @@ class PasswordAutofillAgentTest : public ChromeRenderViewTest { |
| ChromeRenderViewTest::TearDown(); |
| } |
| + void SetFillOnAccountSelect() { |
| + base::FeatureList::ClearInstanceForTesting(); |
| + std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); |
| + feature_list->InitializeFromCommandLine( |
| + password_manager::features::kFillOnAccountSelect.name, ""); |
| + base::FeatureList::SetInstance(std::move(feature_list)); |
| + } |
| + |
| void UpdateOriginForHTML(const std::string& html) { |
| std::string origin = "data:text/html;charset=utf-8," + html; |
| fill_data_.origin = GURL(origin); |
| @@ -1290,8 +1305,7 @@ TEST_F(PasswordAutofillAgentTest, CredentialsOnClick) { |
| // user clicks on the password field when FillOnAccountSelect is enabled. |
| TEST_F(PasswordAutofillAgentTest, |
| FillOnAccountSelectOnlyNoCredentialsOnPasswordClick) { |
| - base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| - autofill::switches::kEnableFillOnAccountSelect); |
| + SetFillOnAccountSelect(); |
| // Simulate the browser sending back the login info. |
| SimulateOnShowInitialPasswordAccountSuggestions(fill_data_); |
| @@ -1320,8 +1334,7 @@ TEST_F(PasswordAutofillAgentTest, |
| // suggested. |
| TEST_F(PasswordAutofillAgentTest, |
| FillOnAccountSelectOnlyCredentialsOnPasswordClick) { |
| - base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| - autofill::switches::kEnableFillOnAccountSelect); |
| + SetFillOnAccountSelect(); |
| // Simulate the browser sending back the login info. |
| SimulateOnShowInitialPasswordAccountSuggestions(fill_data_); |
| @@ -1570,8 +1583,7 @@ TEST_F(PasswordAutofillAgentTest, FormFillDataMustHaveUsername) { |
| } |
| TEST_F(PasswordAutofillAgentTest, FillOnAccountSelectOnly) { |
| - base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| - autofill::switches::kEnableFillOnAccountSelect); |
| + SetFillOnAccountSelect(); |
| ClearUsernameAndPasswordFields(); |
| @@ -1583,8 +1595,7 @@ TEST_F(PasswordAutofillAgentTest, FillOnAccountSelectOnly) { |
| } |
| TEST_F(PasswordAutofillAgentTest, FillOnAccountSelectOnlyReadonlyUsername) { |
| - base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| - autofill::switches::kEnableFillOnAccountSelect); |
| + SetFillOnAccountSelect(); |
| ClearUsernameAndPasswordFields(); |
| @@ -1599,8 +1610,7 @@ TEST_F(PasswordAutofillAgentTest, FillOnAccountSelectOnlyReadonlyUsername) { |
| TEST_F(PasswordAutofillAgentTest, |
| FillOnAccountSelectOnlyReadonlyNotPreferredUsername) { |
| - base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| - autofill::switches::kEnableFillOnAccountSelect); |
| + SetFillOnAccountSelect(); |
| ClearUsernameAndPasswordFields(); |
| @@ -1614,8 +1624,7 @@ TEST_F(PasswordAutofillAgentTest, |
| } |
| TEST_F(PasswordAutofillAgentTest, FillOnAccountSelectOnlyNoUsername) { |
| - base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| - autofill::switches::kEnableFillOnAccountSelect); |
| + SetFillOnAccountSelect(); |
| // Load a form with no username and update test data. |
| LoadHTML(kVisibleFormWithNoUsernameHTML); |
| @@ -1739,8 +1748,7 @@ TEST_F(PasswordAutofillAgentTest, NotShowPopupPasswordField) { |
| // highlighted as autofillable (regression test for https://crbug.com/442564). |
| TEST_F(PasswordAutofillAgentTest, |
| FillOnAccountSelectOnlyReadonlyUnknownUsername) { |
| - base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| - autofill::switches::kEnableFillOnAccountSelect); |
| + SetFillOnAccountSelect(); |
| ClearUsernameAndPasswordFields(); |