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

Unified Diff: chrome/browser/captive_portal/captive_portal_browsertest.cc

Issue 829263004: Add WaitForInterstitialReady to browser_test_utils. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 5 years, 11 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 | chrome/browser/safe_browsing/safe_browsing_blocking_page.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/captive_portal/captive_portal_browsertest.cc
diff --git a/chrome/browser/captive_portal/captive_portal_browsertest.cc b/chrome/browser/captive_portal/captive_portal_browsertest.cc
index 1560e3a5b325d434cef6cb7b673a54f5b82f2ee5..7fd838939b3079a964889e8fcfb606b7defcd5d0 100644
--- a/chrome/browser/captive_portal/captive_portal_browsertest.cc
+++ b/chrome/browser/captive_portal/captive_portal_browsertest.cc
@@ -120,30 +120,6 @@ const char* const kMockHttpsQuickTimeoutUrl =
// captive portal.
const char* const kInternetConnectedTitle = "Title Of Awesomeness";
-// Wait until all resources have loaded in an interstitial page.
-bool WaitForInterstitialReady(content::InterstitialPage* interstitial) {
- content::RenderFrameHost* rfh = interstitial->GetMainFrame();
- if (!rfh)
- return false;
- bool load_complete = false;
- EXPECT_TRUE(
- content::ExecuteScriptAndExtractBool(
- rfh,
- "(function() {"
- " var done = false;"
- " function checkState() {"
- " if (!done && document.readyState == 'complete') {"
- " done = true;"
- " window.domAutomationController.send(true);"
- " }"
- " }"
- " checkState();"
- " document.addEventListener('readystatechange', checkState);"
- "})();",
- &load_complete));
- return load_complete;
-}
-
// A URL request job that hangs until FailJobs() is called. Started jobs
// are stored in a static class variable containing a linked list so that
// FailJobs() can locate them.
@@ -1982,10 +1958,9 @@ IN_PROC_BROWSER_TEST_F(CaptivePortalBrowserTest,
tab_strip_model->ActivateTabAt(cert_error_tab_index, false);
// Wait for the interstitial to load all the JavaScript code. Otherwise,
// trying to click on a button will fail.
- EXPECT_TRUE(WaitForInterstitialReady(
- broken_tab_contents->GetInterstitialPage()));
content::RenderFrameHost* rfh =
broken_tab_contents->GetInterstitialPage()->GetMainFrame();
+ EXPECT_TRUE(WaitForRenderFrameReady(rfh));
const char kClickConnectButtonJS[] =
"document.getElementById('primary-button').click();";
EXPECT_TRUE(
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/safe_browsing_blocking_page.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698