| 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/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/content_settings/cookie_settings.h" | 9 #include "chrome/browser/content_settings/cookie_settings.h" |
| 10 #include "chrome/browser/content_settings/host_content_settings_map.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 host->Send(new ChromeViewMsg_LoadBlockedPlugins( | 374 host->Send(new ChromeViewMsg_LoadBlockedPlugins( |
| 375 host->GetRoutingID(), std::string())); | 375 host->GetRoutingID(), std::string())); |
| 376 EXPECT_EQ(expected_title1, title_watcher1.WaitAndGetTitle()); | 376 EXPECT_EQ(expected_title1, title_watcher1.WaitAndGetTitle()); |
| 377 | 377 |
| 378 string16 expected_title2(ASCIIToUTF16("2")); | 378 string16 expected_title2(ASCIIToUTF16("2")); |
| 379 content::TitleWatcher title_watcher2( | 379 content::TitleWatcher title_watcher2( |
| 380 chrome::GetActiveWebContents(browser()), expected_title2); | 380 chrome::GetActiveWebContents(browser()), expected_title2); |
| 381 | 381 |
| 382 ASSERT_TRUE(content::ExecuteJavaScript( | 382 ASSERT_TRUE(content::ExecuteJavaScript( |
| 383 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), | 383 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), |
| 384 "", | 384 L"", L"window.inject()")); |
| 385 "window.inject()")); | |
| 386 | 385 |
| 387 EXPECT_EQ(expected_title2, title_watcher2.WaitAndGetTitle()); | 386 EXPECT_EQ(expected_title2, title_watcher2.WaitAndGetTitle()); |
| 388 } | 387 } |
| 389 | 388 |
| 390 // If this flakes, use http://crbug.com/113057. | 389 // If this flakes, use http://crbug.com/113057. |
| 391 IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, NoCallbackAtLoad) { | 390 IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, NoCallbackAtLoad) { |
| 392 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( | 391 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( |
| 393 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK); | 392 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK); |
| 394 | 393 |
| 395 GURL url("data:application/vnd.npapi-test,CallOnStartup();"); | 394 GURL url("data:application/vnd.npapi-test,CallOnStartup();"); |
| 396 ui_test_utils::NavigateToURL(browser(), url); | 395 ui_test_utils::NavigateToURL(browser(), url); |
| 397 | 396 |
| 398 // Inject the callback function into the HTML page generated by the browser. | 397 // Inject the callback function into the HTML page generated by the browser. |
| 399 ASSERT_TRUE(content::ExecuteJavaScript( | 398 ASSERT_TRUE(content::ExecuteJavaScript( |
| 400 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), | 399 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), |
| 401 "", | 400 L"", L"CallOnStartup = function() { document.title = \"OK\"; }")); |
| 402 "CallOnStartup = function() { document.title = \"OK\"; }")); | |
| 403 | 401 |
| 404 string16 expected_title(ASCIIToUTF16("OK")); | 402 string16 expected_title(ASCIIToUTF16("OK")); |
| 405 content::TitleWatcher title_watcher( | 403 content::TitleWatcher title_watcher( |
| 406 chrome::GetActiveWebContents(browser()), expected_title); | 404 chrome::GetActiveWebContents(browser()), expected_title); |
| 407 | 405 |
| 408 content::RenderViewHost* host = | 406 content::RenderViewHost* host = |
| 409 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); | 407 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); |
| 410 host->Send(new ChromeViewMsg_LoadBlockedPlugins( | 408 host->Send(new ChromeViewMsg_LoadBlockedPlugins( |
| 411 host->GetRoutingID(), std::string())); | 409 host->GetRoutingID(), std::string())); |
| 412 | 410 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 427 | 425 |
| 428 content::RenderViewHost* host = | 426 content::RenderViewHost* host = |
| 429 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); | 427 chrome::GetActiveWebContents(browser())->GetRenderViewHost(); |
| 430 host->Send(new ChromeViewMsg_LoadBlockedPlugins( | 428 host->Send(new ChromeViewMsg_LoadBlockedPlugins( |
| 431 host->GetRoutingID(), std::string())); | 429 host->GetRoutingID(), std::string())); |
| 432 | 430 |
| 433 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 431 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
| 434 } | 432 } |
| 435 | 433 |
| 436 #endif // !defined(USE_AURA) | 434 #endif // !defined(USE_AURA) |
| OLD | NEW |