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

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 Created 7 years, 11 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 5dc3de4ffe43db1f8c156dcf9bff34d1a0baa9e9..742a31ad1cb455cbb28d4a02db7f74345b97ec37 100644
--- a/content/browser/browser_plugin/browser_plugin_host_browsertest.cc
+++ b/content/browser/browser_plugin/browser_plugin_host_browsertest.cc
@@ -1242,4 +1242,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, "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,
+ "document.getElementById('plugin').name = 'foobar';");
+ string16 actual_title = title_watcher.WaitAndGetTitle();
+ EXPECT_EQ(expected_title, actual_title);
+
+ }
+}
+
} // namespace content
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest_helper.cc ('k') | content/common/browser_plugin_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698