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

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: mattm comments, fix test 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
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..bc341b37057d5aaf17bfb541c14fccc95b8a23d1 100644
--- a/content/public/test/browser_test_utils.cc
+++ b/content/public/test/browser_test_utils.cc
@@ -21,6 +21,7 @@
#include "content/public/browser/browser_context.h"
#include "content/public/browser/dom_operation_notification_details.h"
#include "content/public/browser/histogram_fetcher.h"
+#include "content/public/browser/interstitial_page.h"
mattm 2015/01/22 04:51:27 no longer needed
meacer 2015/01/22 18:31:37 Done.
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
@@ -723,6 +724,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);"
Paweł Hajdan Jr. 2015/01/22 15:43:10 I might be wrong (not a JS/DOM expert), but should
mmenke 2015/01/22 15:53:25 Javascript and the DOM are essentially single-thre
mmenke 2015/01/22 15:55:00 That is, they can't change except as a result of a
+ "})();",
+ &result));
+ return result == "pageLoadComplete";
+}
+
TitleWatcher::TitleWatcher(WebContents* web_contents,
const base::string16& expected_title)
: WebContentsObserver(web_contents),
« content/public/test/browser_test_utils.h ('K') | « 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