| 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 "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 } | 315 } |
| 316 | 316 |
| 317 #if defined(ENABLE_PLUGINS) | 317 #if defined(ENABLE_PLUGINS) |
| 318 class PepperContentSettingsSpecialCasesTest : public ContentSettingsTest { | 318 class PepperContentSettingsSpecialCasesTest : public ContentSettingsTest { |
| 319 protected: | 319 protected: |
| 320 static const char kExternalClearKeyMimeType[]; | 320 static const char kExternalClearKeyMimeType[]; |
| 321 | 321 |
| 322 // Registers any CDM plugins not registered by default. | 322 // Registers any CDM plugins not registered by default. |
| 323 void SetUpCommandLine(base::CommandLine* command_line) override { | 323 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 324 #if defined(ENABLE_PEPPER_CDMS) | 324 #if defined(ENABLE_PEPPER_CDMS) |
| 325 // Base path for Clear Key CDM (relative to the chrome executable). | 325 // Platform-specific filename relative to the chrome executable. |
| 326 const char kClearKeyCdmBaseDirectory[] = "ClearKeyCdm"; | |
| 327 | |
| 328 // Platform-specific filename relative to kClearKeyCdmBaseDirectory. | |
| 329 #if defined(OS_WIN) | 326 #if defined(OS_WIN) |
| 330 const char kClearKeyCdmAdapterFileName[] = "clearkeycdmadapter.dll"; | 327 const char kLibraryName[] = "clearkeycdmadapter.dll"; |
| 331 #else // !defined(OS_WIN) | 328 #else // !defined(OS_WIN) |
| 332 #if defined(OS_MACOSX) | 329 #if defined(OS_MACOSX) |
| 333 const char kClearKeyCdmAdapterFileName[] = "clearkeycdmadapter.plugin"; | 330 const char kLibraryName[] = "clearkeycdmadapter.plugin"; |
| 334 #elif defined(OS_POSIX) | 331 #elif defined(OS_POSIX) |
| 335 const char kClearKeyCdmAdapterFileName[] = "libclearkeycdmadapter.so"; | 332 const char kLibraryName[] = "libclearkeycdmadapter.so"; |
| 336 #endif // defined(OS_MACOSX) | 333 #endif // defined(OS_MACOSX) |
| 337 #endif // defined(OS_WIN) | 334 #endif // defined(OS_WIN) |
| 338 | 335 |
| 339 // Append the switch to register the External Clear Key CDM. | 336 // Append the switch to register the External Clear Key CDM. |
| 340 base::FilePath::StringType pepper_plugins = BuildPepperPluginRegistration( | 337 base::FilePath::StringType pepper_plugins = BuildPepperPluginRegistration( |
| 341 kClearKeyCdmBaseDirectory, kClearKeyCdmAdapterFileName, "Clear Key CDM", | 338 kLibraryName, "Clear Key CDM", kExternalClearKeyMimeType); |
| 342 kExternalClearKeyMimeType); | |
| 343 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 339 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
| 344 // The CDM must be registered when it is a component. | 340 // The CDM must be registered when it is a component. |
| 345 pepper_plugins.append(FILE_PATH_LITERAL(",")); | 341 pepper_plugins.append(FILE_PATH_LITERAL(",")); |
| 346 pepper_plugins.append(BuildPepperPluginRegistration( | 342 pepper_plugins.append( |
| 347 kWidevineCdmBaseDirectory, kWidevineCdmAdapterFileName, | 343 BuildPepperPluginRegistration(kWidevineCdmAdapterFileName, |
| 348 kWidevineCdmDisplayName, kWidevineCdmPluginMimeType)); | 344 kWidevineCdmDisplayName, |
| 345 kWidevineCdmPluginMimeType)); |
| 349 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 346 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
| 350 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, | 347 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, |
| 351 pepper_plugins); | 348 pepper_plugins); |
| 352 #endif // defined(ENABLE_PEPPER_CDMS) | 349 #endif // defined(ENABLE_PEPPER_CDMS) |
| 353 | 350 |
| 354 #if !defined(DISABLE_NACL) | 351 #if !defined(DISABLE_NACL) |
| 355 // Ensure NaCl can run. | 352 // Ensure NaCl can run. |
| 356 command_line->AppendSwitch(switches::kEnableNaCl); | 353 command_line->AppendSwitch(switches::kEnableNaCl); |
| 357 #endif | 354 #endif |
| 358 } | 355 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 EXPECT_EQ(expect_is_javascript_content_blocked, | 427 EXPECT_EQ(expect_is_javascript_content_blocked, |
| 431 tab_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_JAVASCRIPT)); | 428 tab_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_JAVASCRIPT)); |
| 432 EXPECT_FALSE(tab_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_PLUGINS)); | 429 EXPECT_FALSE(tab_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_PLUGINS)); |
| 433 } | 430 } |
| 434 | 431 |
| 435 private: | 432 private: |
| 436 // Builds the string to pass to kRegisterPepperPlugins for a single | 433 // Builds the string to pass to kRegisterPepperPlugins for a single |
| 437 // plugin using the provided parameters and a dummy version. | 434 // plugin using the provided parameters and a dummy version. |
| 438 // Multiple results may be passed to kRegisterPepperPlugins, separated by ",". | 435 // Multiple results may be passed to kRegisterPepperPlugins, separated by ",". |
| 439 base::FilePath::StringType BuildPepperPluginRegistration( | 436 base::FilePath::StringType BuildPepperPluginRegistration( |
| 440 const char* library_path, | |
| 441 const char* library_name, | 437 const char* library_name, |
| 442 const char* display_name, | 438 const char* display_name, |
| 443 const char* mime_type) { | 439 const char* mime_type) { |
| 444 base::FilePath plugin_dir; | 440 base::FilePath plugin_dir; |
| 445 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir)); | 441 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir)); |
| 446 plugin_dir = plugin_dir.AppendASCII(library_path); | |
| 447 | 442 |
| 448 base::FilePath plugin_lib = plugin_dir.AppendASCII(library_name); | 443 base::FilePath plugin_lib = plugin_dir.AppendASCII(library_name); |
| 449 EXPECT_TRUE(base::PathExists(plugin_lib)); | 444 EXPECT_TRUE(base::PathExists(plugin_lib)); |
| 450 | 445 |
| 451 base::FilePath::StringType pepper_plugin = plugin_lib.value(); | 446 base::FilePath::StringType pepper_plugin = plugin_lib.value(); |
| 452 std::string string_to_append = "#"; | 447 std::string string_to_append = "#"; |
| 453 string_to_append.append(display_name); | 448 string_to_append.append(display_name); |
| 454 string_to_append.append("#A CDM#0.1.0.0;"); | 449 string_to_append.append("#A CDM#0.1.0.0;"); |
| 455 string_to_append.append(mime_type); | 450 string_to_append.append(mime_type); |
| 456 | 451 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 #endif // defined(ENABLE_PEPPER_CDMS) | 544 #endif // defined(ENABLE_PEPPER_CDMS) |
| 550 | 545 |
| 551 #if !defined(DISABLE_NACL) | 546 #if !defined(DISABLE_NACL) |
| 552 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest, | 547 IN_PROC_BROWSER_TEST_F(PepperContentSettingsSpecialCasesJavaScriptBlockedTest, |
| 553 NaCl) { | 548 NaCl) { |
| 554 RunJavaScriptBlockedTest("load_nacl_no_js.html", true); | 549 RunJavaScriptBlockedTest("load_nacl_no_js.html", true); |
| 555 } | 550 } |
| 556 #endif // !defined(DISABLE_NACL) | 551 #endif // !defined(DISABLE_NACL) |
| 557 | 552 |
| 558 #endif // defined(ENABLE_PLUGINS) | 553 #endif // defined(ENABLE_PLUGINS) |
| OLD | NEW |