Chromium Code Reviews| Index: chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc |
| diff --git a/chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc b/chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc |
| index 48722009d0a37b9060ba2fad6fac4b3189854f30..6320806b020606fa36dd96fac1406b30ca1e3e77 100644 |
| --- a/chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc |
| +++ b/chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc |
| @@ -311,7 +311,8 @@ GURL GetURLWithNonLocalHostname(net::EmbeddedTestServer* server, |
| } |
| class ChromeSecurityStateModelClientTestWithPasswordCcSwitch |
| - : public ChromeSecurityStateModelClientTest { |
| + : public ChromeSecurityStateModelClientTest, |
| + public testing::WithParamInterface<bool> { |
| public: |
| ChromeSecurityStateModelClientTestWithPasswordCcSwitch() |
| : ChromeSecurityStateModelClientTest() {} |
| @@ -325,9 +326,16 @@ class ChromeSecurityStateModelClientTestWithPasswordCcSwitch |
| void SetUpCommandLine(base::CommandLine* command_line) override { |
| ChromeSecurityStateModelClientTest::SetUpCommandLine(command_line); |
| - command_line->AppendSwitchASCII( |
| - security_state::switches::kMarkHttpAs, |
| - security_state::switches::kMarkHttpWithPasswordsOrCcWithChip); |
| + if (GetParam()) { |
| + command_line->AppendSwitchASCII( |
| + security_state::switches::kMarkHttpAs, |
| + security_state::switches:: |
| + kMarkHttpWithPasswordsOrCcWithChipAndFormWarning); |
| + } else { |
| + command_line->AppendSwitchASCII( |
| + security_state::switches::kMarkHttpAs, |
| + security_state::switches::kMarkHttpWithPasswordsOrCcWithChip); |
| + } |
| } |
| private: |
| @@ -940,7 +948,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
| // Tests that when a visible password field is detected on an HTTP page |
| // load, and when the command-line flag is set, the security level is |
| // downgraded to HTTP_SHOW_WARNING. |
| -IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
| +IN_PROC_BROWSER_TEST_P(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
| PasswordSecurityLevelDowngraded) { |
| content::WebContents* contents = |
| browser()->tab_strip_model()->GetActiveWebContents(); |
| @@ -967,7 +975,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
| // Tests that when an invisible password field is present on an HTTP page |
| // load, and when the command-line flag is set, the security level is |
| // *not* downgraded to HTTP_SHOW_WARNING. |
| -IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
| +IN_PROC_BROWSER_TEST_P(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
| PasswordSecurityLevelNotDowngradedForInvisibleInput) { |
| content::WebContents* contents = |
| browser()->tab_strip_model()->GetActiveWebContents(); |
| @@ -995,7 +1003,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
| // Tests that when a visible password field is detected inside an iframe |
| // on an HTTP page load, and when the command-line flag is set, the |
| // security level is downgraded to HTTP_SHOW_WARNING. |
| -IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
| +IN_PROC_BROWSER_TEST_P(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
| PasswordSecurityLevelDowngradedFromIframe) { |
| content::WebContents* contents = |
| browser()->tab_strip_model()->GetActiveWebContents(); |
| @@ -1024,7 +1032,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
| // on an HTTP page load, and when the command-line flag is set, the |
| // security level is downgraded to HTTP_SHOW_WARNING, even if the iframe |
| // itself was loaded over HTTPS. |
| -IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
| +IN_PROC_BROWSER_TEST_P(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
| PasswordSecurityLevelDowngradedFromHttpsIframe) { |
| content::WebContents* contents = |
| browser()->tab_strip_model()->GetActiveWebContents(); |
| @@ -1090,7 +1098,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, |
| // Tests that when a visible password field is detected on an HTTPS page |
| // load, and when the command-line flag is set, the security level is |
| // *not* downgraded to HTTP_SHOW_WARNING. |
| -IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
| +IN_PROC_BROWSER_TEST_P(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
| PasswordSecurityLevelNotDowngradedOnHttps) { |
| content::WebContents* contents = |
| browser()->tab_strip_model()->GetActiveWebContents(); |
| @@ -1186,7 +1194,7 @@ void CheckForOneFutureHttpWarningConsoleMessage( |
| // Tests that console messages are printed upon a call to |
| // GetSecurityInfo() on an HTTP_SHOW_WARNING page, exactly once per |
| // main-frame navigation. |
| -IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
| +IN_PROC_BROWSER_TEST_P(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
| ConsoleMessage) { |
| ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate( |
| Browser::CreateParams(browser()->profile())); |
| @@ -1330,7 +1338,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, ConsoleMessage) { |
| // Tests that additional HTTP_SHOW_WARNING console messages are not |
| // printed after subframe navigations. |
| -IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
| +IN_PROC_BROWSER_TEST_P(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
| ConsoleMessageNotPrintedForFrameNavigation) { |
| ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate( |
| Browser::CreateParams(browser()->profile())); |
| @@ -1414,7 +1422,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
| // Tests that additional HTTP_SHOW_WARNING console messages are not |
| // printed after pushState navigations. |
| -IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
| +IN_PROC_BROWSER_TEST_P(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
| ConsoleMessageNotPrintedForPushStateNavigation) { |
| ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate( |
| Browser::CreateParams(browser()->profile())); |
| @@ -1491,6 +1499,10 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
| ASSERT_NO_FATAL_FAILURE(CheckForOneHttpWarningConsoleMessage(delegate)); |
| } |
| +INSTANTIATE_TEST_CASE_P(ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
| + ChromeSecurityStateModelClientTestWithPasswordCcSwitch, |
| + testing::Bool()); |
|
estark
2016/11/05 03:44:22
nit: maybe you could add a comment here that 'true
lshang
2016/11/05 03:56:53
Done.
|
| + |
| // Tests that the SecurityStateModel for a WebContents is up to date |
| // when the WebContents is inserted into a Browser's TabStripModel. |
| IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTest, AddedTab) { |