Commit 1b6c18ab authored by Emily Stark's avatar Emily Stark Committed by Commit Bot

Add HTTP-Bad Phase 3 experiment to field trial testing config

Some browser tests needed to be updated accordingly. I deleted a couple
that were redundant with tests where the field trial is enabled. For a
few others that only made sense in the pre-field trial world, I just
disabled the feature for them, though we'll want to clean them up
eventually after the field trial launches.

Bug: 807062
Change-Id: I480b2527375368d6146c1ddace2551dece9ec596
Reviewed-on: https://chromium-review.googlesource.com/891677Reviewed-by: default avatarEric Lawrence <elawrence@chromium.org>
Reviewed-by: default avatarJesse Doherty <jwd@chromium.org>
Commit-Queue: Emily Stark <estark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533845}
parent 6788e47a
...@@ -397,11 +397,9 @@ class SecurityStateTabHelperTest : public CertVerifierBrowserTest { ...@@ -397,11 +397,9 @@ class SecurityStateTabHelperTest : public CertVerifierBrowserTest {
} }
// Navigates to an empty page and runs |javascript| to create a URL with with // Navigates to an empty page and runs |javascript| to create a URL with with
// a scheme of |scheme|. If |expect_warning| is true, expects a password // a scheme of |scheme|. Expects a security level of HTTP_SHOW_WARNING.
// warning. void TestBlobOrFilesystemURL(const std::string& scheme,
void TestPasswordFieldOnBlobOrFilesystemURL(const std::string& scheme, const std::string& javascript) {
const std::string& javascript,
bool expect_warning) {
content::WebContents* contents = content::WebContents* contents =
browser()->tab_strip_model()->GetActiveWebContents(); browser()->tab_strip_model()->GetActiveWebContents();
ASSERT_TRUE(contents); ASSERT_TRUE(contents);
...@@ -429,15 +427,7 @@ class SecurityStateTabHelperTest : public CertVerifierBrowserTest { ...@@ -429,15 +427,7 @@ class SecurityStateTabHelperTest : public CertVerifierBrowserTest {
contents->GetController().GetVisibleEntry(); contents->GetController().GetVisibleEntry();
ASSERT_TRUE(entry); ASSERT_TRUE(entry);
security_state::InsecureInputEventData input_events = GetInputEvents(entry); EXPECT_EQ(security_state::HTTP_SHOW_WARNING, security_info.security_level);
if (expect_warning) {
EXPECT_EQ(security_state::HTTP_SHOW_WARNING,
security_info.security_level);
EXPECT_TRUE(input_events.password_field_shown);
} else {
EXPECT_EQ(security_state::NONE, security_info.security_level);
EXPECT_FALSE(input_events.password_field_shown);
}
} }
net::EmbeddedTestServer https_server_; net::EmbeddedTestServer https_server_;
...@@ -1220,57 +1210,21 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, ...@@ -1220,57 +1210,21 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest,
EXPECT_TRUE(GetInputEvents(entry).password_field_shown); EXPECT_TRUE(GetInputEvents(entry).password_field_shown);
} }
// Tests that when a visible password field is detected on a blob URL, the // Tests the default security level on blob URLs.
// security level is downgraded to HTTP_SHOW_WARNING.
IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest,
PasswordSecurityLevelDowngradedOnBlobUrl) {
TestPasswordFieldOnBlobOrFilesystemURL(
"blob",
"var blob = new Blob(['<html><form><input type=password></form></html>'],"
" {type: 'text/html'});"
"window.domAutomationController.send(URL.createObjectURL(blob));",
true /* expect_warning */);
}
// Tests that when no password field is detected on a blob URL, the security
// level is not downgraded to HTTP_SHOW_WARNING.
IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest,
DefaultSecurityLevelOnBlobUrl) { DefaultSecurityLevelOnBlobUrl) {
TestPasswordFieldOnBlobOrFilesystemURL( TestBlobOrFilesystemURL(
"blob", "blob",
"var blob = new Blob(['<html>no password or credit card field</html>']," "var blob = new Blob(['<html>hello</html>'],"
" {type: 'text/html'});" " {type: 'text/html'});"
"window.domAutomationController.send(URL.createObjectURL(blob));", "window.domAutomationController.send(URL.createObjectURL(blob));");
false /* expect_warning */);
}
// Same as PasswordSecurityLevelDowngradedOnBlobUrl, but instead of a blob URL,
// this creates a filesystem URL.
IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest,
PasswordSecurityLevelDowngradedOnFilesystemUrl) {
TestPasswordFieldOnBlobOrFilesystemURL(
"filesystem",
"window.webkitRequestFileSystem(window.TEMPORARY, 4096, function(fs) {"
" fs.root.getFile('test.html', {create: true}, function(fileEntry) {"
" fileEntry.createWriter(function(writer) {"
" writer.onwriteend = function(e) {"
" window.domAutomationController.send(fileEntry.toURL());"
" };"
" var blob ="
" new Blob(['<html><form><input type=password></form></html>'],"
" {type: 'text/html'});"
" writer.write(blob);"
" });"
" });"
"});",
true /* expect_warning */);
} }
// Same as DefaultSecurityLevelOnBlobUrl, but instead of a blob URL, // Same as DefaultSecurityLevelOnBlobUrl, but instead of a blob URL,
// this creates a filesystem URL. // this creates a filesystem URL.
IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest,
DefaultSecurityLevelOnFilesystemUrl) { DefaultSecurityLevelOnFilesystemUrl) {
TestPasswordFieldOnBlobOrFilesystemURL( TestBlobOrFilesystemURL(
"filesystem", "filesystem",
"window.webkitRequestFileSystem(window.TEMPORARY, 4096, function(fs) {" "window.webkitRequestFileSystem(window.TEMPORARY, 4096, function(fs) {"
" fs.root.getFile('test.html', {create: true}, function(fileEntry) {" " fs.root.getFile('test.html', {create: true}, function(fileEntry) {"
...@@ -1279,19 +1233,22 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, ...@@ -1279,19 +1233,22 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest,
" window.domAutomationController.send(fileEntry.toURL());" " window.domAutomationController.send(fileEntry.toURL());"
" };" " };"
" var blob =" " var blob ="
" new Blob(['<html>no password or credit card field</html>']," " new Blob(['<html>hello</html>'],"
" {type: 'text/html'});" " {type: 'text/html'});"
" writer.write(blob);" " writer.write(blob);"
" });" " });"
" });" " });"
"});", "});");
false /* expect_warning */);
} }
// Tests that when an invisible password field is present on an HTTP page load, // Tests that when an invisible password field is present on an HTTP page load,
// the security level is *not* downgraded to HTTP_SHOW_WARNING. // the security level is *not* downgraded to HTTP_SHOW_WARNING.
IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest,
PasswordSecurityLevelNotDowngradedForInvisibleInput) { PasswordSecurityLevelNotDowngradedForInvisibleInput) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndDisableFeature(
security_state::features::kMarkHttpAsFeature);
content::WebContents* contents = content::WebContents* contents =
browser()->tab_strip_model()->GetActiveWebContents(); browser()->tab_strip_model()->GetActiveWebContents();
ASSERT_TRUE(contents); ASSERT_TRUE(contents);
...@@ -1403,83 +1360,17 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, ...@@ -1403,83 +1360,17 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest,
EXPECT_FALSE(GetInputEvents(entry).password_field_shown); EXPECT_FALSE(GetInputEvents(entry).password_field_shown);
} }
// Tests that the security level of a HTTP page is downgraded to // Tests that the security level of a HTTP page is not downgraded when a form
// HTTP_SHOW_WARNING after editing a form field in the relevant configurations. // field is modified by JavaScript.
IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest,
SecurityLevelDowngradedAfterEditing) { SecurityLevelNotDowngradedAfterScriptModification) {
content::WebContents* contents =
browser()->tab_strip_model()->GetActiveWebContents();
SecurityStateTabHelper* helper =
SecurityStateTabHelper::FromWebContents(contents);
ASSERT_TRUE(helper);
// Navigate to an HTTP page. Use a non-local hostname so that it is
// not considered secure.
ui_test_utils::NavigateToURL(
browser(),
GetURLWithNonLocalHostname(embedded_test_server(),
"/textinput/focus_input_on_load.html"));
security_state::SecurityInfo security_info;
helper->GetSecurityInfo(&security_info);
EXPECT_EQ(security_state::NONE, security_info.security_level);
// Type one character into the focused input control and wait for a security
// state change.
SecurityStyleTestObserver observer(contents);
content::SimulateKeyPress(contents, ui::DomKey::FromCharacter('A'),
ui::DomCode::US_A, ui::VKEY_A, false, false, false,
false);
observer.WaitForDidChangeVisibleSecurityState();
// Verify that the security state degrades as expected.
helper->GetSecurityInfo(&security_info);
EXPECT_EQ(security_state::HTTP_SHOW_WARNING, security_info.security_level);
EXPECT_TRUE(security_info.field_edit_downgraded_security_level);
EXPECT_EQ(1u, observer.latest_explanations().neutral_explanations.size());
content::NavigationEntry* entry = contents->GetController().GetVisibleEntry();
ASSERT_TRUE(entry);
EXPECT_TRUE(GetInputEvents(entry).insecure_field_edited);
{
// Ensure that the security level remains Dangerous in the
// kMarkHttpAsDangerous configuration.
base::test::ScopedFeatureList scoped_feature_list; base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeatureWithParameters( scoped_feature_list.InitAndEnableFeatureWithParameters(
security_state::features::kMarkHttpAsFeature, security_state::features::kMarkHttpAsFeature,
{{security_state::features::kMarkHttpAsFeatureParameterName, {{security_state::features::kMarkHttpAsFeatureParameterName,
security_state::features::kMarkHttpAsParameterDangerous}}); security_state::features::
kMarkHttpAsParameterWarningAndDangerousOnFormEdits}});
helper->GetSecurityInfo(&security_info);
EXPECT_EQ(security_state::DANGEROUS, security_info.security_level);
EXPECT_FALSE(security_info.field_edit_downgraded_security_level);
}
// Verify security state stays degraded after same-page navigation.
ui_test_utils::NavigateToURL(
browser(), GetURLWithNonLocalHostname(
embedded_test_server(),
"/textinput/focus_input_on_load.html#fragment"));
content::WaitForLoadStop(contents);
helper->GetSecurityInfo(&security_info);
EXPECT_EQ(security_state::HTTP_SHOW_WARNING, security_info.security_level);
EXPECT_TRUE(security_info.field_edit_downgraded_security_level);
EXPECT_EQ(1u, observer.latest_explanations().neutral_explanations.size());
// Verify that after a refresh, the HTTP_SHOW_WARNING state is cleared.
contents->GetController().Reload(content::ReloadType::NORMAL, false);
content::WaitForLoadStop(contents);
helper->GetSecurityInfo(&security_info);
EXPECT_EQ(security_state::NONE, security_info.security_level);
EXPECT_FALSE(security_info.field_edit_downgraded_security_level);
EXPECT_EQ(0u, observer.latest_explanations().neutral_explanations.size());
}
// Tests that the security level of a HTTP page is not downgraded when a form
// field is modified by JavaScript.
IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest,
SecurityLevelNotDowngradedAfterScriptModification) {
content::WebContents* contents = content::WebContents* contents =
browser()->tab_strip_model()->GetActiveWebContents(); browser()->tab_strip_model()->GetActiveWebContents();
...@@ -1495,7 +1386,7 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, ...@@ -1495,7 +1386,7 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest,
"/textinput/focus_input_on_load.html")); "/textinput/focus_input_on_load.html"));
security_state::SecurityInfo security_info; security_state::SecurityInfo security_info;
helper->GetSecurityInfo(&security_info); helper->GetSecurityInfo(&security_info);
EXPECT_EQ(security_state::NONE, security_info.security_level); EXPECT_EQ(security_state::HTTP_SHOW_WARNING, security_info.security_level);
// Verify a value set operation isn't treated as user-input. // Verify a value set operation isn't treated as user-input.
EXPECT_TRUE(content::ExecuteScript( EXPECT_TRUE(content::ExecuteScript(
...@@ -1503,7 +1394,7 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, ...@@ -1503,7 +1394,7 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest,
InjectScript(contents); InjectScript(contents);
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
helper->GetSecurityInfo(&security_info); helper->GetSecurityInfo(&security_info);
ASSERT_EQ(security_state::NONE, security_info.security_level); ASSERT_EQ(security_state::HTTP_SHOW_WARNING, security_info.security_level);
ASSERT_FALSE(security_info.field_edit_downgraded_security_level); ASSERT_FALSE(security_info.field_edit_downgraded_security_level);
// Verify an InsertText operation isn't treated as user-input. // Verify an InsertText operation isn't treated as user-input.
...@@ -1512,7 +1403,7 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, ...@@ -1512,7 +1403,7 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest,
InjectScript(contents); InjectScript(contents);
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
helper->GetSecurityInfo(&security_info); helper->GetSecurityInfo(&security_info);
ASSERT_EQ(security_state::NONE, security_info.security_level); ASSERT_EQ(security_state::HTTP_SHOW_WARNING, security_info.security_level);
ASSERT_FALSE(security_info.field_edit_downgraded_security_level); ASSERT_FALSE(security_info.field_edit_downgraded_security_level);
} }
...@@ -1572,7 +1463,15 @@ void CheckForOneHttpWarningConsoleMessage( ...@@ -1572,7 +1463,15 @@ void CheckForOneHttpWarningConsoleMessage(
// Tests that console messages are printed upon a call to // Tests that console messages are printed upon a call to
// GetSecurityInfo() on an HTTP_SHOW_WARNING page, exactly once per // GetSecurityInfo() on an HTTP_SHOW_WARNING page, exactly once per
// main-frame navigation. // main-frame navigation.
//
// TODO(estark): add console messages for the |kMarkHttpAsParameterWarning|
// configuration of |kMarkHttpAsFeature| and update this test accordingly.
// https://crbug.com/802921
IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, ConsoleMessage) { IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, ConsoleMessage) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndDisableFeature(
security_state::features::kMarkHttpAsFeature);
ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate( ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate(
Browser::CreateParams(browser()->profile(), true)); Browser::CreateParams(browser()->profile(), true));
content::WebContents* original_contents = content::WebContents* original_contents =
...@@ -1639,8 +1538,16 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, ConsoleMessage) { ...@@ -1639,8 +1538,16 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, ConsoleMessage) {
// Tests that additional HTTP_SHOW_WARNING console messages are not // Tests that additional HTTP_SHOW_WARNING console messages are not
// printed after subframe navigations. // printed after subframe navigations.
//
// TODO(estark): add console messages for the |kMarkHttpAsParameterWarning|
// configuration of |kMarkHttpAsFeature| and update this test accordingly.
// https://crbug.com/802921
IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest,
ConsoleMessageNotPrintedForFrameNavigation) { ConsoleMessageNotPrintedForFrameNavigation) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndDisableFeature(
security_state::features::kMarkHttpAsFeature);
ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate( ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate(
Browser::CreateParams(browser()->profile(), true)); Browser::CreateParams(browser()->profile(), true));
content::WebContents* original_contents = content::WebContents* original_contents =
...@@ -1722,8 +1629,16 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, ...@@ -1722,8 +1629,16 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest,
// Tests that additional HTTP_SHOW_WARNING console messages are not // Tests that additional HTTP_SHOW_WARNING console messages are not
// printed after pushState navigations. // printed after pushState navigations.
//
// TODO(estark): add console messages for the |kMarkHttpAsParameterWarning|
// configuration of |kMarkHttpAsFeature| and update this test accordingly.
// https://crbug.com/802921
IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest,
ConsoleMessageNotPrintedForPushStateNavigation) { ConsoleMessageNotPrintedForPushStateNavigation) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndDisableFeature(
security_state::features::kMarkHttpAsFeature);
ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate( ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate(
Browser::CreateParams(browser()->profile(), true)); Browser::CreateParams(browser()->profile(), true));
content::WebContents* original_contents = content::WebContents* original_contents =
...@@ -1979,6 +1894,10 @@ IN_PROC_BROWSER_TEST_F(DidChangeVisibleSecurityStateTest, ...@@ -1979,6 +1894,10 @@ IN_PROC_BROWSER_TEST_F(DidChangeVisibleSecurityStateTest,
// to HTTP_SHOW_WARNING. // to HTTP_SHOW_WARNING.
IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperIncognitoTest, IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperIncognitoTest,
SecurityLevelDowngradedForHTTPInIncognito) { SecurityLevelDowngradedForHTTPInIncognito) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndDisableFeature(
security_state::features::kMarkHttpAsFeature);
ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate( ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate(
Browser::CreateParams(browser()->profile(), true)); Browser::CreateParams(browser()->profile(), true));
content::WebContents* original_contents = content::WebContents* original_contents =
...@@ -2030,8 +1949,16 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperIncognitoTest, ...@@ -2030,8 +1949,16 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperIncognitoTest,
// Tests that additional HTTP_SHOW_WARNING console messages are not // Tests that additional HTTP_SHOW_WARNING console messages are not
// printed after aborted navigations. // printed after aborted navigations.
//
// TODO(estark): add console messages for the |kMarkHttpAsParameterWarning|
// configuration of |kMarkHttpAsFeature| and update this test accordingly.
// https://crbug.com/802921
IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperIncognitoTest, IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperIncognitoTest,
ConsoleMessageNotPrintedForAbortedNavigation) { ConsoleMessageNotPrintedForAbortedNavigation) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndDisableFeature(
security_state::features::kMarkHttpAsFeature);
ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate( ConsoleWebContentsDelegate* delegate = new ConsoleWebContentsDelegate(
Browser::CreateParams(browser()->profile(), true)); Browser::CreateParams(browser()->profile(), true));
content::WebContents* original_contents = content::WebContents* original_contents =
...@@ -2098,6 +2025,10 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperIncognitoTest, ...@@ -2098,6 +2025,10 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperIncognitoTest,
#endif #endif
IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest,
MAYBE_SecurityLevelNotDowngradedForHTTPInGuestMode) { MAYBE_SecurityLevelNotDowngradedForHTTPInGuestMode) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndDisableFeature(
security_state::features::kMarkHttpAsFeature);
// Create a new browser in Guest Mode. // Create a new browser in Guest Mode.
EXPECT_EQ(1U, BrowserList::GetInstance()->size()); EXPECT_EQ(1U, BrowserList::GetInstance()->size());
content::WindowedNotificationObserver browser_creation_observer( content::WindowedNotificationObserver browser_creation_observer(
...@@ -2511,6 +2442,20 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, ...@@ -2511,6 +2442,20 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest,
helper->GetSecurityInfo(&security_info); helper->GetSecurityInfo(&security_info);
EXPECT_EQ(security_state::HTTP_SHOW_WARNING, security_info.security_level); EXPECT_EQ(security_state::HTTP_SHOW_WARNING, security_info.security_level);
{
// Ensure that the security level remains Dangerous in the
// kMarkHttpAsDangerous configuration.
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeatureWithParameters(
security_state::features::kMarkHttpAsFeature,
{{security_state::features::kMarkHttpAsFeatureParameterName,
security_state::features::kMarkHttpAsParameterDangerous}});
helper->GetSecurityInfo(&security_info);
EXPECT_EQ(security_state::DANGEROUS, security_info.security_level);
EXPECT_FALSE(security_info.field_edit_downgraded_security_level);
}
// Type one character into the focused input control and wait for a security // Type one character into the focused input control and wait for a security
// state change. // state change.
SecurityStyleTestObserver observer(contents); SecurityStyleTestObserver observer(contents);
...@@ -2522,6 +2467,21 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, ...@@ -2522,6 +2467,21 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest,
// Verify that the security state degrades as expected. // Verify that the security state degrades as expected.
helper->GetSecurityInfo(&security_info); helper->GetSecurityInfo(&security_info);
EXPECT_EQ(security_state::DANGEROUS, security_info.security_level); EXPECT_EQ(security_state::DANGEROUS, security_info.security_level);
// Verify security state stays degraded after same-page navigation.
ui_test_utils::NavigateToURL(
browser(), GetURLWithNonLocalHostname(
embedded_test_server(),
"/textinput/focus_input_on_load.html#fragment"));
content::WaitForLoadStop(contents);
helper->GetSecurityInfo(&security_info);
EXPECT_EQ(security_state::DANGEROUS, security_info.security_level);
// Verify that after a refresh, the DANGEROUS state is cleared.
contents->GetController().Reload(content::ReloadType::NORMAL, false);
content::WaitForLoadStop(contents);
helper->GetSecurityInfo(&security_info);
EXPECT_EQ(security_state::HTTP_SHOW_WARNING, security_info.security_level);
} }
IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest, IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTest,
......
...@@ -1596,6 +1596,29 @@ ...@@ -1596,6 +1596,29 @@
] ]
} }
], ],
"HTTPBadPhase3": [
{
"platforms": [
"android",
"chromeos",
"ios",
"linux",
"mac",
"win"
],
"experiments": [
{
"name": "NotSecureWarning",
"params": {
"treatment": "warning"
},
"enable_features": [
"MarkHttpAs"
]
}
]
}
],
"Html5ByDefault": [ "Html5ByDefault": [
{ {
"platforms": [ "platforms": [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment