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

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

Issue 11554030: <webview>: Add name attribute (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with ToT and back to plumbing directly to BrowserPlugin instead of through WebContents Created 7 years, 12 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 b72818cd0b954b2553613c66982e139415ae7618..026abd53fb9d24e4a68492dbc07cb12933572cdd 100644
--- a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc
+++ b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc
@@ -1250,4 +1250,41 @@ IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, GetRenderViewHostAtPositionTest) {
test_embedder()->last_rvh_at_position_response());
}
+IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, ChangeWindowName) {
+ const char kEmbedderURL[] = "files/browser_plugin_naming_embedder.html";
+ const char* kGuestURL = "files/browser_plugin_naming_guest.html";
+ StartBrowserPluginTest(kEmbedderURL, kGuestURL, false, "");
+
+ RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
+ test_embedder()->web_contents()->GetRenderViewHost());
+ {
+ // Open a channel with the guest, wait until it replies,
+ // then verify that the plugin's name has been updated.
+ const string16 expected_title = ASCIIToUTF16("guest");
+ content::TitleWatcher title_watcher(test_embedder()->web_contents(),
+ expected_title);
+ ExecuteSyncJSFunction(rvh, ASCIIToUTF16("OpenCommChannel();"));
+ string16 actual_title = title_watcher.WaitAndGetTitle();
+ EXPECT_EQ(expected_title, actual_title);
+
+ scoped_ptr<base::Value> value(rvh->ExecuteJavascriptAndGetValue(string16(),
+ ASCIIToUTF16("document.getElementById('plugin').name")));
+ std::string result;
+ EXPECT_TRUE(value->GetAsString(&result));
+ EXPECT_EQ("guest", result);
+ }
+ {
+ // Set the plugin's name and verify that the window.name of the guest
+ // has been updated.
+ const string16 expected_title = ASCIIToUTF16("foobar");
+ content::TitleWatcher title_watcher(test_embedder()->web_contents(),
+ expected_title);
+ ExecuteSyncJSFunction(rvh,
+ ASCIIToUTF16("document.getElementById('plugin').name = 'foobar';"));
+ string16 actual_title = title_watcher.WaitAndGetTitle();
+ EXPECT_EQ(expected_title, actual_title);
+
+ }
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698