Index: content/test/layout_browsertest.cc |
=================================================================== |
--- content/test/layout_browsertest.cc (revision 129871) |
+++ content/test/layout_browsertest.cc (working copy) |
@@ -68,15 +68,23 @@ |
static const std::string preamble = |
"\n<script>\n" |
"function LayoutTestController() {\n" |
+ " this.wait_until_done_ = false;\n" |
" this.dumpAsText = function () {};\n" |
- " this.waitUntilDone = function () {};\n" |
+ " this.waitUntilDone = function () {\n" |
+ " this.wait_until_done_ = true;\n" |
+ " }\n" |
" this.notifyDone = function () {\n" |
" document.title = 'done';\n" |
" }\n" |
" this.overridePreference = function () {}\n" |
+ " this.OnEvent = function () {\n" |
+ " if (!layoutTestController.wait_until_done_)\n" |
+ " layoutTestController.notifyDone();\n" |
+ " }\n" |
" this.workerThreadCount = 0; \n" |
"}\n" |
"window.layoutTestController = new LayoutTestController();\n" |
+ "window.addEventListener('load', layoutTestController.OnEvent, false);\n" |
"</script>"; |
} |
@@ -180,6 +188,7 @@ |
ui_test_utils::TitleWatcher title_watcher( |
browser()->GetSelectedWebContents(), expected_title); |
ui_test_utils::NavigateToURL(browser(), url); |
+ |
LOG(INFO) << "Navigation completed, now waiting for title."; |
string16 final_title = title_watcher.WaitAndGetTitle(); |
EXPECT_EQ(expected_title, final_title); |