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

Side by Side 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, 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/memory/singleton.h" 6 #include "base/memory/singleton.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/test/test_timeouts.h" 8 #include "base/test/test_timeouts.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "content/browser/browser_plugin/browser_plugin_guest.h" 10 #include "content/browser/browser_plugin/browser_plugin_guest.h"
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 StartBrowserPluginTest(kEmbedderURL, kHTMLForGuestWithSize, true, 1243 StartBrowserPluginTest(kEmbedderURL, kHTMLForGuestWithSize, true,
1244 embedder_code); 1244 embedder_code);
1245 // Check for render view host at position (150, 150) that is outside the 1245 // Check for render view host at position (150, 150) that is outside the
1246 // bounds of our guest, so this would respond with the render view host of the 1246 // bounds of our guest, so this would respond with the render view host of the
1247 // embedder. 1247 // embedder.
1248 test_embedder()->WaitForRenderViewHostAtPosition(150, 150); 1248 test_embedder()->WaitForRenderViewHostAtPosition(150, 150);
1249 ASSERT_EQ(test_embedder()->web_contents()->GetRenderViewHost(), 1249 ASSERT_EQ(test_embedder()->web_contents()->GetRenderViewHost(),
1250 test_embedder()->last_rvh_at_position_response()); 1250 test_embedder()->last_rvh_at_position_response());
1251 } 1251 }
1252 1252
1253 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, ChangeWindowName) {
1254 const char kEmbedderURL[] = "files/browser_plugin_naming_embedder.html";
1255 const char* kGuestURL = "files/browser_plugin_naming_guest.html";
1256 StartBrowserPluginTest(kEmbedderURL, kGuestURL, false, "");
1257
1258 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
1259 test_embedder()->web_contents()->GetRenderViewHost());
1260 {
1261 // Open a channel with the guest, wait until it replies,
1262 // then verify that the plugin's name has been updated.
1263 const string16 expected_title = ASCIIToUTF16("guest");
1264 content::TitleWatcher title_watcher(test_embedder()->web_contents(),
1265 expected_title);
1266 ExecuteSyncJSFunction(rvh, ASCIIToUTF16("OpenCommChannel();"));
1267 string16 actual_title = title_watcher.WaitAndGetTitle();
1268 EXPECT_EQ(expected_title, actual_title);
1269
1270 scoped_ptr<base::Value> value(rvh->ExecuteJavascriptAndGetValue(string16(),
1271 ASCIIToUTF16("document.getElementById('plugin').name")));
1272 std::string result;
1273 EXPECT_TRUE(value->GetAsString(&result));
1274 EXPECT_EQ("guest", result);
1275 }
1276 {
1277 // Set the plugin's name and verify that the window.name of the guest
1278 // has been updated.
1279 const string16 expected_title = ASCIIToUTF16("foobar");
1280 content::TitleWatcher title_watcher(test_embedder()->web_contents(),
1281 expected_title);
1282 ExecuteSyncJSFunction(rvh,
1283 ASCIIToUTF16("document.getElementById('plugin').name = 'foobar';"));
1284 string16 actual_title = title_watcher.WaitAndGetTitle();
1285 EXPECT_EQ(expected_title, actual_title);
1286
1287 }
1288 }
1289
1253 } // namespace content 1290 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698