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

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

Issue 2686223002: Fix flaky password visibility browser test (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ssl/security_state_tab_helper_browser_tests.cc
diff --git a/chrome/browser/ssl/security_state_tab_helper_browser_tests.cc b/chrome/browser/ssl/security_state_tab_helper_browser_tests.cc
index 39f0dcd748e7afced93928107c1108b9be279e5e..e3474a4bb651dacb1b83102ae496e9de9988ae79 100644
--- a/chrome/browser/ssl/security_state_tab_helper_browser_tests.cc
+++ b/chrome/browser/ssl/security_state_tab_helper_browser_tests.cc
@@ -68,10 +68,10 @@ const base::FilePath::CharType kDocRoot[] =
// fields. Notifications about visible password fields are queued at the
// end of the event loop, so waiting for a dummy script to run ensures
// that these notifcations have been sent.
-void InjectScript(content::WebContents* contents) {
+void InjectScript(const content::ToRenderFrameHost& adapter) {
bool js_result = false;
EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
- contents, "window.domAutomationController.send(true);", &js_result));
+ adapter, "window.domAutomationController.send(true);", &js_result));
EXPECT_TRUE(js_result);
}
@@ -1137,7 +1137,11 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTestWithPasswordCcSwitch,
browser(),
GetURLWithNonLocalHostname(embedded_test_server(),
"/password/simple_password_in_iframe.html"));
- InjectScript(contents);
+ // Inject a dummy script into each frame to ensure that password notifications
estark 2017/02/10 00:55:34 note: this test was not marked as flaky. I'm guess
meacer 2017/02/10 01:07:40 Would it make sense to move this code to InjectScr
estark 2017/02/10 01:45:13 Done.
+ // from any subframe have been sent.
+ for (const auto& frame : contents->GetAllFrames()) {
+ InjectScript(content::ToRenderFrameHost(frame));
+ }
security_state::SecurityInfo security_info;
helper->GetSecurityInfo(&security_info);
EXPECT_EQ(security_state::HTTP_SHOW_WARNING, security_info.security_level);
@@ -1152,16 +1156,8 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTestWithPasswordCcSwitch,
// 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.
-#if defined(OS_LINUX)
-// Flaky on Linux. See https://crbug.com/662485.
-#define MAYBE_PasswordSecurityLevelDowngradedFromHttpsIframe \
- DISABLED_PasswordSecurityLevelDowngradedFromHttpsIframe
-#else
-#define MAYBE_PasswordSecurityLevelDowngradedFromHttpsIframe \
- PasswordSecurityLevelDowngradedFromHttpsIframe
-#endif
IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTestWithPasswordCcSwitch,
- MAYBE_PasswordSecurityLevelDowngradedFromHttpsIframe) {
+ PasswordSecurityLevelDowngradedFromHttpsIframe) {
content::WebContents* contents =
browser()->tab_strip_model()->GetActiveWebContents();
ASSERT_TRUE(contents);
@@ -1179,7 +1175,11 @@ IN_PROC_BROWSER_TEST_F(SecurityStateTabHelperTestWithPasswordCcSwitch,
ui_test_utils::NavigateToURL(
browser(),
GetURLWithNonLocalHostname(embedded_test_server(), replacement_path));
- InjectScript(contents);
+ // Inject a dummy script into each frame to ensure that password notifications
+ // from any subframe have been sent.
meacer 2017/02/10 01:07:40 nit: any subframe or all subframes? They sound dif
estark 2017/02/10 01:45:13 Probably should have been "all subframes", but n/a
+ for (const auto& frame : contents->GetAllFrames()) {
+ InjectScript(content::ToRenderFrameHost(frame));
+ }
security_state::SecurityInfo security_info;
helper->GetSecurityInfo(&security_info);
EXPECT_EQ(security_state::HTTP_SHOW_WARNING, security_info.security_level);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698