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

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

Issue 2686223002: Fix flaky password visibility browser test (Closed)
Patch Set: fix typo 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..5b306481aca12fc27b20ce0b94f12b00dd2005c6 100644
--- a/chrome/browser/ssl/security_state_tab_helper_browser_tests.cc
+++ b/chrome/browser/ssl/security_state_tab_helper_browser_tests.cc
@@ -63,16 +63,20 @@ enum CertificateStatus { VALID_CERTIFICATE, INVALID_CERTIFICATE };
const base::FilePath::CharType kDocRoot[] =
FILE_PATH_LITERAL("chrome/test/data");
-// Inject a script into the page. Used by tests that check for visible
-// password fields to wait for notifications about these
-// 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.
+// Inject a script into every frame in the page. Used by tests that check for
+// visible password fields to wait for notifications about these
+// 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
+// notifications have been sent.
void InjectScript(content::WebContents* contents) {
- bool js_result = false;
- EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
- contents, "window.domAutomationController.send(true);", &js_result));
- EXPECT_TRUE(js_result);
+ // Any frame in the page might have a password field, so inject scripts into
+ // all of them to ensure that notifications from all of them have been sent.
+ for (const auto& frame : contents->GetAllFrames()) {
+ bool js_result = false;
+ EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
+ frame, "window.domAutomationController.send(true);", &js_result));
+ EXPECT_TRUE(js_result);
+ }
}
// A WebContentsObserver useful for testing the DidChangeVisibleSecurityState()
@@ -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);
« 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