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 |