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

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: Addressed comments + merged with ToT/latest patch 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 d64c134e26a71284e965fdd23d0e9c84bc926663..941ebee810a839934aba5dfee230ec10ac131260 100644
--- a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc
+++ b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc
@@ -480,4 +480,47 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, VisibilityChanged) {
test_guest->WaitUntilHidden();
}
+// 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.
+ 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());
+ test_guest->WaitForUpdateRectMsg();
+ test_guest->ResetUpdateRectCount();
+
+ rvh->ExecuteJavascriptAndGetValue(string16(), ASCIIToUTF16(
+ "document.getElementById('plugin').reload()"));
+ // A successful reload will force the page to repaint itself as well, and
+ // thereby issue a ViewHostMsg_UpdateRect message.
+ test_guest->WaitForUpdateRectMsg();
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698