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

Unified Diff: chrome/browser/ssl/chrome_security_state_model_client_browser_tests.cc

Issue 2472943004: HTTP Bad: Add a switch for showing both verbose state and form warning (Closed)
Patch Set: add a comment Created 4 years, 1 month 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
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | components/security_state/security_state_model.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5e561e3643d2536973fb10d948697adc06b43935..4c95eb6943222c9c2e7061eec1c3c2d89b6b5c7f 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();
@@ -1032,7 +1040,7 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch,
#define MAYBE_PasswordSecurityLevelDowngradedFromHttpsIframe \
PasswordSecurityLevelDowngradedFromHttpsIframe
#endif
-IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch,
+IN_PROC_BROWSER_TEST_P(ChromeSecurityStateModelClientTestWithPasswordCcSwitch,
MAYBE_PasswordSecurityLevelDowngradedFromHttpsIframe) {
content::WebContents* contents =
browser()->tab_strip_model()->GetActiveWebContents();
@@ -1098,7 +1106,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();
@@ -1194,7 +1202,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()));
@@ -1338,7 +1346,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()));
@@ -1422,7 +1430,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()));
@@ -1499,6 +1507,13 @@ IN_PROC_BROWSER_TEST_F(ChromeSecurityStateModelClientTestWithPasswordCcSwitch,
ASSERT_NO_FATAL_FAILURE(CheckForOneHttpWarningConsoleMessage(delegate));
}
+INSTANTIATE_TEST_CASE_P(ChromeSecurityStateModelClientTestWithPasswordCcSwitch,
+ ChromeSecurityStateModelClientTestWithPasswordCcSwitch,
+ // Here 'true' means that the omnibox warning + form
+ // warning are enabled, and 'false' means just the
+ // omnibox warning is enabled.
+ testing::Bool());
+
// 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) {
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | components/security_state/security_state_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698