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

Unified Diff: content/browser/browser_plugin/browser_plugin_host_browsertest.cc

Issue 10941042: Browser plugin: Implement loadStart and loadAbort events (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with ToT Created 8 years, 2 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/browser/browser_plugin/browser_plugin_host_browsertest.cc
diff --git a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc
index d868e8f70820f021158778d0bed192bd9dc87623..50e23207b2083f90f21575973a263bf27f519f82 100644
--- a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc
+++ b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc
@@ -795,5 +795,48 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, Renavigate) {
}
}
+IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, LoadStart) {
+ ASSERT_TRUE(test_server()->Start());
+ GURL test_url(test_server()->GetURL(
+ "files/browser_plugin_embedder.html"));
+ NavigateToURL(shell(), test_url);
+
+ WebContentsImpl* embedder_web_contents = static_cast<WebContentsImpl*>(
+ shell()->web_contents());
+ RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
+ embedder_web_contents->GetRenderViewHost());
+
+ rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16(
+ StringPrintf("SetSrc('%s');", kHTMLForGuest)));
+
+ // Wait to make sure embedder is created/attached to WebContents.
+ TestBrowserPluginHostFactory::GetInstance()->WaitForEmbedderCreation();
+
+ TestBrowserPluginEmbedder* test_embedder =
+ static_cast<TestBrowserPluginEmbedder*>(
+ embedder_web_contents->GetBrowserPluginEmbedder());
+ ASSERT_TRUE(test_embedder);
+ test_embedder->WaitForGuestAdded();
+
+ // Verify that we have exactly one guest.
+ const BrowserPluginEmbedder::ContainerInstanceMap& instance_map =
+ test_embedder->guest_web_contents_for_testing();
+ EXPECT_EQ(1u, instance_map.size());
+
+ WebContentsImpl* test_guest_web_contents = static_cast<WebContentsImpl*>(
+ instance_map.begin()->second);
+ TestBrowserPluginGuest* test_guest = static_cast<TestBrowserPluginGuest*>(
+ test_guest_web_contents->GetBrowserPluginGuest());
+
+ // Wait for the guest to send an UpdateRectMsg, meaning it is ready.
+ test_guest->WaitForUpdateRectMsg();
Charlie Reis 2012/10/03 01:52:30 There's a lot of boilerplate code here. Is this m
Fady Samuel 2012/10/04 00:43:38 Done.
+
+ // Verify that we navigated to the URL that we set earlier via SetSrc.
+ base::Value* v =
+ rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16("url"));
+ std::string result;
+ EXPECT_TRUE(v->GetAsString(&result));
+ EXPECT_EQ(result, kHTMLForGuest);
+}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698