| 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),
|
|
|