| 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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 #if defined(OS_MACOSX) | 479 #if defined(OS_MACOSX) |
| 480 const char kLibraryName[] = "clearkeycdmadapter.plugin"; | 480 const char kLibraryName[] = "clearkeycdmadapter.plugin"; |
| 481 #elif defined(OS_POSIX) | 481 #elif defined(OS_POSIX) |
| 482 const char kLibraryName[] = "libclearkeycdmadapter.so"; | 482 const char kLibraryName[] = "libclearkeycdmadapter.so"; |
| 483 #endif // defined(OS_MACOSX) | 483 #endif // defined(OS_MACOSX) |
| 484 #endif // defined(OS_WIN) | 484 #endif // defined(OS_WIN) |
| 485 | 485 |
| 486 // Append the switch to register the External Clear Key CDM. | 486 // Append the switch to register the External Clear Key CDM. |
| 487 base::FilePath::StringType pepper_plugins = BuildPepperPluginRegistration( | 487 base::FilePath::StringType pepper_plugins = BuildPepperPluginRegistration( |
| 488 kLibraryName, "Clear Key CDM", kExternalClearKeyMimeType); | 488 kLibraryName, "Clear Key CDM", kExternalClearKeyMimeType); |
| 489 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 489 #if defined(ENABLE_WIDEVINE_CDM) && defined(WIDEVINE_CDM_IS_COMPONENT) |
| 490 // The CDM must be registered when it is a component. | 490 // The CDM must be registered when it is a component. |
| 491 pepper_plugins.append(FILE_PATH_LITERAL(",")); | 491 pepper_plugins.append(FILE_PATH_LITERAL(",")); |
| 492 pepper_plugins.append( | 492 pepper_plugins.append( |
| 493 BuildPepperPluginRegistration(kWidevineCdmAdapterFileName, | 493 BuildPepperPluginRegistration(kWidevineCdmAdapterFileName, |
| 494 kWidevineCdmDisplayName, | 494 kWidevineCdmDisplayName, |
| 495 kWidevineCdmPluginMimeType)); | 495 kWidevineCdmPluginMimeType)); |
| 496 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 496 #endif // defined(ENABLE_WIDEVINE_CDM) && defined(WIDEVINE_CDM_IS_COMPONENT) |
| 497 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, | 497 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, |
| 498 pepper_plugins); | 498 pepper_plugins); |
| 499 #endif // defined(ENABLE_PEPPER_CDMS) | 499 #endif // defined(ENABLE_PEPPER_CDMS) |
| 500 | 500 |
| 501 #if !defined(DISABLE_NACL) | 501 #if !defined(DISABLE_NACL) |
| 502 // Ensure NaCl can run. | 502 // Ensure NaCl can run. |
| 503 command_line->AppendSwitch(switches::kEnableNaCl); | 503 command_line->AppendSwitch(switches::kEnableNaCl); |
| 504 #endif | 504 #endif |
| 505 } | 505 } |
| 506 | 506 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest, | 659 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest, |
| 660 Normal) { | 660 Normal) { |
| 661 #if defined(OS_WIN) && defined(USE_ASH) | 661 #if defined(OS_WIN) && defined(USE_ASH) |
| 662 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 662 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
| 663 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 663 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
| 664 return; | 664 return; |
| 665 #endif | 665 #endif |
| 666 RunLoadPepperPluginTest(kExternalClearKeyMimeType, false); | 666 RunLoadPepperPluginTest(kExternalClearKeyMimeType, false); |
| 667 } | 667 } |
| 668 | 668 |
| 669 #if defined(WIDEVINE_CDM_AVAILABLE) | 669 #if defined(ENABLE_WIDEVINE_CDM) |
| 670 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest, | 670 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest, |
| 671 WidevineCdm) { | 671 WidevineCdm) { |
| 672 #if defined(OS_WIN) && defined(USE_ASH) | 672 #if defined(OS_WIN) && defined(USE_ASH) |
| 673 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 673 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
| 674 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 674 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
| 675 return; | 675 return; |
| 676 #endif | 676 #endif |
| 677 RunLoadPepperPluginTest(kWidevineCdmPluginMimeType, true); | 677 RunLoadPepperPluginTest(kWidevineCdmPluginMimeType, true); |
| 678 } | 678 } |
| 679 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 679 #endif // defined(ENABLE_WIDEVINE_CDM) |
| 680 #endif // defined(ENABLE_PEPPER_CDMS) | 680 #endif // defined(ENABLE_PEPPER_CDMS) |
| 681 | 681 |
| 682 #if !defined(DISABLE_NACL) | 682 #if !defined(DISABLE_NACL) |
| 683 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest, | 683 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesPluginsBlockedTest, |
| 684 NaCl) { | 684 NaCl) { |
| 685 #if defined(OS_WIN) && defined(USE_ASH) | 685 #if defined(OS_WIN) && defined(USE_ASH) |
| 686 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 686 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
| 687 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 687 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
| 688 return; | 688 return; |
| 689 #endif | 689 #endif |
| 690 RunLoadPepperPluginTest("application/x-nacl", true); | 690 RunLoadPepperPluginTest("application/x-nacl", true); |
| 691 } | 691 } |
| 692 #endif // !defined(DISABLE_NACL) | 692 #endif // !defined(DISABLE_NACL) |
| 693 | 693 |
| 694 // The following tests verify that those same Pepper plugins do not work when | 694 // The following tests verify that those same Pepper plugins do not work when |
| 695 // JavaScript is blocked. | 695 // JavaScript is blocked. |
| 696 | 696 |
| 697 #if defined(ENABLE_PEPPER_CDMS) | 697 #if defined(ENABLE_PEPPER_CDMS) |
| 698 // A plugin with no special behavior is not blocked when JavaScript is blocked. | 698 // A plugin with no special behavior is not blocked when JavaScript is blocked. |
| 699 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest, | 699 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest, |
| 700 Normal) { | 700 Normal) { |
| 701 #if defined(OS_WIN) && defined(USE_ASH) | 701 #if defined(OS_WIN) && defined(USE_ASH) |
| 702 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 702 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
| 703 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 703 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
| 704 return; | 704 return; |
| 705 #endif | 705 #endif |
| 706 RunJavaScriptBlockedTest("load_clearkey_no_js.html", false); | 706 RunJavaScriptBlockedTest("load_clearkey_no_js.html", false); |
| 707 } | 707 } |
| 708 | 708 |
| 709 #if defined(WIDEVINE_CDM_AVAILABLE) | 709 #if defined(ENABLE_WIDEVINE_CDM) |
| 710 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest, | 710 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest, |
| 711 WidevineCdm) { | 711 WidevineCdm) { |
| 712 #if defined(OS_WIN) && defined(USE_ASH) | 712 #if defined(OS_WIN) && defined(USE_ASH) |
| 713 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 713 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
| 714 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 714 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
| 715 return; | 715 return; |
| 716 #endif | 716 #endif |
| 717 RunJavaScriptBlockedTest("load_widevine_no_js.html", true); | 717 RunJavaScriptBlockedTest("load_widevine_no_js.html", true); |
| 718 } | 718 } |
| 719 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 719 #endif // defined(ENABLE_WIDEVINE_CDM) |
| 720 #endif // defined(ENABLE_PEPPER_CDMS) | 720 #endif // defined(ENABLE_PEPPER_CDMS) |
| 721 | 721 |
| 722 #if !defined(DISABLE_NACL) | 722 #if !defined(DISABLE_NACL) |
| 723 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest, | 723 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest, |
| 724 NaCl) { | 724 NaCl) { |
| 725 #if defined(OS_WIN) && defined(USE_ASH) | 725 #if defined(OS_WIN) && defined(USE_ASH) |
| 726 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 726 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
| 727 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 727 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
| 728 return; | 728 return; |
| 729 #endif | 729 #endif |
| 730 RunJavaScriptBlockedTest("load_nacl_no_js.html", true); | 730 RunJavaScriptBlockedTest("load_nacl_no_js.html", true); |
| 731 } | 731 } |
| 732 #endif // !defined(DISABLE_NACL) | 732 #endif // !defined(DISABLE_NACL) |
| 733 | 733 |
| 734 #endif // defined(ENABLE_PLUGINS) | 734 #endif // defined(ENABLE_PLUGINS) |
| OLD | NEW |