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/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/content_settings/cookie_settings.h" | 10 #include "chrome/browser/content_settings/cookie_settings.h" |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 // If this flakes, use http://crbug.com/113057. | 414 // If this flakes, use http://crbug.com/113057. |
415 // TODO(jschuh): Hanging plugin tests. crbug.com/244653 | 415 // TODO(jschuh): Hanging plugin tests. crbug.com/244653 |
416 #if !defined(OS_WIN) && !defined(ARCH_CPU_X86_64) | 416 #if !defined(OS_WIN) && !defined(ARCH_CPU_X86_64) |
417 IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, NoCallbackAtLoad) { | 417 IN_PROC_BROWSER_TEST_F(ClickToPlayPluginTest, NoCallbackAtLoad) { |
418 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( | 418 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( |
419 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK); | 419 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK); |
420 | 420 |
421 GURL url("data:application/vnd.npapi-test,CallOnStartup();"); | 421 GURL url("data:application/vnd.npapi-test,CallOnStartup();"); |
422 ui_test_utils::NavigateToURL(browser(), url); | 422 ui_test_utils::NavigateToURL(browser(), url); |
423 | 423 |
| 424 std::string script("CallOnStartup = function() { "); |
| 425 script.append("document.documentElement.appendChild"); |
| 426 script.append("(document.createElement(\"head\")); "); |
| 427 script.append("document.title = \"OK\"; }"); |
| 428 |
424 // Inject the callback function into the HTML page generated by the browser. | 429 // Inject the callback function into the HTML page generated by the browser. |
425 ASSERT_TRUE(content::ExecuteScript( | 430 ASSERT_TRUE(content::ExecuteScript( |
426 browser()->tab_strip_model()->GetActiveWebContents(), | 431 browser()->tab_strip_model()->GetActiveWebContents(), script)); |
427 "CallOnStartup = function() { document.title = \"OK\"; }")); | |
428 | 432 |
429 base::string16 expected_title(base::ASCIIToUTF16("OK")); | 433 base::string16 expected_title(base::ASCIIToUTF16("OK")); |
430 content::TitleWatcher title_watcher( | 434 content::TitleWatcher title_watcher( |
431 browser()->tab_strip_model()->GetActiveWebContents(), expected_title); | 435 browser()->tab_strip_model()->GetActiveWebContents(), expected_title); |
432 | 436 |
433 ChromePluginServiceFilter::GetInstance()->AuthorizeAllPlugins( | 437 ChromePluginServiceFilter::GetInstance()->AuthorizeAllPlugins( |
434 browser()->tab_strip_model()->GetActiveWebContents(), true, | 438 browser()->tab_strip_model()->GetActiveWebContents(), true, |
435 std::string()); | 439 std::string()); |
436 | 440 |
437 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 441 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 #if defined(OS_WIN) && defined(USE_ASH) | 727 #if defined(OS_WIN) && defined(USE_ASH) |
724 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 728 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
725 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 729 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
726 return; | 730 return; |
727 #endif | 731 #endif |
728 RunJavaScriptBlockedTest("load_nacl_no_js.html", true); | 732 RunJavaScriptBlockedTest("load_nacl_no_js.html", true); |
729 } | 733 } |
730 #endif // !defined(DISABLE_NACL) | 734 #endif // !defined(DISABLE_NACL) |
731 | 735 |
732 #endif // defined(ENABLE_PLUGINS) | 736 #endif // defined(ENABLE_PLUGINS) |
OLD | NEW |