summaryrefslogtreecommitdiffstats
path: root/content/public/test/browser_test_utils.cc
diff options
context:
space:
mode:
Diffstat (limited to 'content/public/test/browser_test_utils.cc')
-rw-r--r--content/public/test/browser_test_utils.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc
index 89dd343..20d6f6c9 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),