Index: chrome/browser/prerender/prerender_browsertest.cc |
diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc |
index 67ddad431ecdb07c0c1222e2fef52cde1b6ad25b..cfce72848bf5c86c72c05103aefab3fb7d7dd87c 100644 |
--- a/chrome/browser/prerender/prerender_browsertest.cc |
+++ b/chrome/browser/prerender/prerender_browsertest.cc |
@@ -2285,12 +2285,44 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderCancelAll) { |
1); |
// Post a task to cancel all the prerenders. |
MessageLoop::current()->PostTask( |
- FROM_HERE, |
- base::Bind(&CancelAllPrerenders, GetPrerenderManager())); |
+ FROM_HERE, base::Bind(&CancelAllPrerenders, GetPrerenderManager())); |
content::RunMessageLoop(); |
EXPECT_TRUE(GetPrerenderContents() == NULL); |
} |
+IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderEvents) { |
+ PrerenderTestURL("files/prerender/prerender_page.html", |
+ FINAL_STATUS_CANCELLED, 1); |
+ WebContents* web_contents = chrome::GetActiveWebContents(browser()); |
+ bool received_prerender_started = false; |
+ bool received_prerender_stopped = false; |
+ ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( |
+ web_contents->GetRenderViewHost(), L"", |
+ L"window.domAutomationController.send(receivedPrerenderStartEvent)", |
+ &received_prerender_started)); |
+ ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( |
+ web_contents->GetRenderViewHost(), L"", |
+ L"window.domAutomationController.send(receivedPrerenderStopEvent)", |
+ &received_prerender_stopped)); |
+ ASSERT_TRUE(received_prerender_started); |
+ ASSERT_FALSE(received_prerender_stopped); |
+ |
+ MessageLoop::current()->PostTask( |
+ FROM_HERE, base::Bind(&CancelAllPrerenders, GetPrerenderManager())); |
+ content::RunMessageLoop(); |
+ |
+ ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( |
+ web_contents->GetRenderViewHost(), L"", |
+ L"window.domAutomationController.send(receivedPrerenderStartEvent)", |
+ &received_prerender_started)); |
+ ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool( |
+ web_contents->GetRenderViewHost(), L"", |
+ L"window.domAutomationController.send(receivedPrerenderStopEvent)", |
+ &received_prerender_stopped)); |
+ ASSERT_TRUE(received_prerender_started); |
+ ASSERT_TRUE(received_prerender_stopped); |
+} |
+ |
// Prerendering and history tests. |
// The prerendered page is navigated to in several ways [navigate via |
// omnibox, click on link, key-modified click to open in background tab, etc], |