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

Unified Diff: chrome/browser/prerender/prerender_browsertest.cc

Issue 10918189: Add PrerenderStatusEvent on Prerenders (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: rebase to trunk, remove some unrelated fixes... Created 8 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_contents.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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],
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698