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