OLD | NEW |
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 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 test_embedder()->last_rvh_at_position_response()); | 1242 test_embedder()->last_rvh_at_position_response()); |
1243 } | 1243 } |
1244 | 1244 |
1245 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, ChangeWindowName) { | 1245 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, ChangeWindowName) { |
1246 const char kEmbedderURL[] = "files/browser_plugin_naming_embedder.html"; | 1246 const char kEmbedderURL[] = "files/browser_plugin_naming_embedder.html"; |
1247 const char* kGuestURL = "files/browser_plugin_naming_guest.html"; | 1247 const char* kGuestURL = "files/browser_plugin_naming_guest.html"; |
1248 StartBrowserPluginTest(kEmbedderURL, kGuestURL, false, ""); | 1248 StartBrowserPluginTest(kEmbedderURL, kGuestURL, false, ""); |
1249 | 1249 |
1250 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( | 1250 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
1251 test_embedder()->web_contents()->GetRenderViewHost()); | 1251 test_embedder()->web_contents()->GetRenderViewHost()); |
| 1252 // Verify that the plugin's name is properly initialized. |
| 1253 { |
| 1254 scoped_ptr<base::Value> value(rvh->ExecuteJavascriptAndGetValue(string16(), |
| 1255 ASCIIToUTF16("document.getElementById('plugin').name"))); |
| 1256 std::string result; |
| 1257 EXPECT_TRUE(value->GetAsString(&result)); |
| 1258 EXPECT_EQ("start", result); |
| 1259 } |
1252 { | 1260 { |
1253 // Open a channel with the guest, wait until it replies, | 1261 // Open a channel with the guest, wait until it replies, |
1254 // then verify that the plugin's name has been updated. | 1262 // then verify that the plugin's name has been updated. |
1255 const string16 expected_title = ASCIIToUTF16("guest"); | 1263 const string16 expected_title = ASCIIToUTF16("guest"); |
1256 content::TitleWatcher title_watcher(test_embedder()->web_contents(), | 1264 content::TitleWatcher title_watcher(test_embedder()->web_contents(), |
1257 expected_title); | 1265 expected_title); |
1258 ExecuteSyncJSFunction(rvh, "OpenCommChannel();"); | 1266 ExecuteSyncJSFunction(rvh, "OpenCommChannel();"); |
1259 string16 actual_title = title_watcher.WaitAndGetTitle(); | 1267 string16 actual_title = title_watcher.WaitAndGetTitle(); |
1260 EXPECT_EQ(expected_title, actual_title); | 1268 EXPECT_EQ(expected_title, actual_title); |
1261 | 1269 |
(...skipping 11 matching lines...) Expand all Loading... |
1273 expected_title); | 1281 expected_title); |
1274 ExecuteSyncJSFunction(rvh, | 1282 ExecuteSyncJSFunction(rvh, |
1275 "document.getElementById('plugin').name = 'foobar';"); | 1283 "document.getElementById('plugin').name = 'foobar';"); |
1276 string16 actual_title = title_watcher.WaitAndGetTitle(); | 1284 string16 actual_title = title_watcher.WaitAndGetTitle(); |
1277 EXPECT_EQ(expected_title, actual_title); | 1285 EXPECT_EQ(expected_title, actual_title); |
1278 | 1286 |
1279 } | 1287 } |
1280 } | 1288 } |
1281 | 1289 |
1282 } // namespace content | 1290 } // namespace content |
OLD | NEW |