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

Unified Diff: content/public/test/browser_test_utils.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 | « content/public/test/browser_test_utils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/test/browser_test_utils.cc
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc
index 89dd3430e96dbca0330338b1fc035951d215e908..20d6f6c956fa702995dbcfff22395ebb29ce7bd7 100644
--- a/content/public/test/browser_test_utils.cc
+++ b/content/public/test/browser_test_utils.cc
@@ -723,6 +723,28 @@ void RunTaskAndWaitForInterstitialDetach(content::WebContents* web_contents,
loop_runner->Run();
}
+bool WaitForRenderFrameReady(RenderFrameHost* rfh) {
+ if (!rfh)
+ return false;
+ std::string result;
+ EXPECT_TRUE(
+ content::ExecuteScriptAndExtractString(
+ rfh,
+ "(function() {"
+ " var done = false;"
+ " function checkState() {"
+ " if (!done && document.readyState == 'complete') {"
+ " done = true;"
+ " window.domAutomationController.send('pageLoadComplete');"
+ " }"
+ " }"
+ " checkState();"
+ " document.addEventListener('readystatechange', checkState);"
+ "})();",
+ &result));
+ return result == "pageLoadComplete";
+}
+
TitleWatcher::TitleWatcher(WebContents* web_contents,
const base::string16& expected_title)
: WebContentsObserver(web_contents),
« no previous file with comments | « content/public/test/browser_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698