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

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

Issue 10917225: Browser Plugin: Reload and Stop operations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated Created 8 years, 3 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 6c9a689ff2f1876091025688d5795e7ebd67b584..6cfb38b38d73d30e4ca90b8e4c1080ffb47465b7 100644
--- a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc
+++ b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc
@@ -446,4 +446,47 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, EmbedderSameAfterNav) {
ASSERT_EQ(test_embedder_after_nav, test_embedder_);
}
+// This test verifies that calling the reload method reloads the guest.
+IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, ReloadGuest) {
+ 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.
+ ASSERT_TRUE(
+ TestBrowserPluginHostFactory::GetInstance()->WaitForEmbedderCreation());
+
+ TestBrowserPluginEmbedder* test_embedder =
+ static_cast<TestBrowserPluginEmbedder*>(
+ embedder_web_contents->GetBrowserPluginEmbedder());
+ ASSERT_TRUE(test_embedder);
+ ASSERT_TRUE(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());
+ ASSERT_TRUE(test_guest->WaitForUpdateRectMsg());
+ test_guest->ResetUpdateRectCount();
+
+ rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16(
+ "document.getElementById('plugin').reload()"));
+ ASSERT_TRUE(test_guest->WaitForUpdateRectMsg());
lazyboy 2012/09/13 19:14:15 Add a comment saying that a successful reload woul
Fady Samuel 2012/09/19 14:38:09 Done.
+
lazyboy 2012/09/13 19:14:15 nit: rm empty line at the end.
Fady Samuel 2012/09/19 14:38:09 Done.
Fady Samuel 2012/09/19 14:38:09 Done.
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698