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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 } | 316 } |
317 | 317 |
318 #if defined(ENABLE_PLUGINS) | 318 #if defined(ENABLE_PLUGINS) |
319 class PepperContentSettingsSpecialCasesTest : public ContentSettingsTest { | 319 class PepperContentSettingsSpecialCasesTest : public ContentSettingsTest { |
320 protected: | 320 protected: |
321 static const char kExternalClearKeyMimeType[]; | 321 static const char kExternalClearKeyMimeType[]; |
322 | 322 |
323 // Registers any CDM plugins not registered by default. | 323 // Registers any CDM plugins not registered by default. |
324 void SetUpCommandLine(base::CommandLine* command_line) override { | 324 void SetUpCommandLine(base::CommandLine* command_line) override { |
325 #if defined(ENABLE_PEPPER_CDMS) | 325 #if defined(ENABLE_PEPPER_CDMS) |
326 // Platform-specific filename relative to the chrome executable. | 326 // Base path for Clear Key CDM (relative to the chrome executable). |
| 327 const char kClearKeyCdmBaseDirectory[] = "ClearKeyCdm"; |
| 328 |
| 329 // Platform-specific filename relative to kClearKeyCdmBaseDirectory. |
327 #if defined(OS_WIN) | 330 #if defined(OS_WIN) |
328 const char kLibraryName[] = "clearkeycdmadapter.dll"; | 331 const char kClearKeyCdmAdapterFileName[] = "clearkeycdmadapter.dll"; |
329 #else // !defined(OS_WIN) | 332 #else // !defined(OS_WIN) |
330 #if defined(OS_MACOSX) | 333 #if defined(OS_MACOSX) |
331 const char kLibraryName[] = "clearkeycdmadapter.plugin"; | 334 const char kClearKeyCdmAdapterFileName[] = "clearkeycdmadapter.plugin"; |
332 #elif defined(OS_POSIX) | 335 #elif defined(OS_POSIX) |
333 const char kLibraryName[] = "libclearkeycdmadapter.so"; | 336 const char kClearKeyCdmAdapterFileName[] = "libclearkeycdmadapter.so"; |
334 #endif // defined(OS_MACOSX) | 337 #endif // defined(OS_MACOSX) |
335 #endif // defined(OS_WIN) | 338 #endif // defined(OS_WIN) |
336 | 339 |
337 // Append the switch to register the External Clear Key CDM. | 340 // Append the switch to register the External Clear Key CDM. |
338 base::FilePath::StringType pepper_plugins = BuildPepperPluginRegistration( | 341 base::FilePath::StringType pepper_plugins = BuildPepperPluginRegistration( |
339 kLibraryName, "Clear Key CDM", kExternalClearKeyMimeType); | 342 kClearKeyCdmBaseDirectory, kClearKeyCdmAdapterFileName, "Clear Key CDM", |
| 343 kExternalClearKeyMimeType); |
340 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 344 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
341 // The CDM must be registered when it is a component. | 345 // The CDM must be registered when it is a component. |
342 pepper_plugins.append(FILE_PATH_LITERAL(",")); | 346 pepper_plugins.append(FILE_PATH_LITERAL(",")); |
343 pepper_plugins.append( | 347 pepper_plugins.append(BuildPepperPluginRegistration( |
344 BuildPepperPluginRegistration(kWidevineCdmAdapterFileName, | 348 kWidevineCdmBaseDirectory, kWidevineCdmAdapterFileName, |
345 kWidevineCdmDisplayName, | 349 kWidevineCdmDisplayName, kWidevineCdmPluginMimeType)); |
346 kWidevineCdmPluginMimeType)); | |
347 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 350 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
348 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, | 351 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, |
349 pepper_plugins); | 352 pepper_plugins); |
350 #endif // defined(ENABLE_PEPPER_CDMS) | 353 #endif // defined(ENABLE_PEPPER_CDMS) |
351 | 354 |
352 #if !defined(DISABLE_NACL) | 355 #if !defined(DISABLE_NACL) |
353 // Ensure NaCl can run. | 356 // Ensure NaCl can run. |
354 command_line->AppendSwitch(switches::kEnableNaCl); | 357 command_line->AppendSwitch(switches::kEnableNaCl); |
355 #endif | 358 #endif |
356 } | 359 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 EXPECT_EQ(expect_is_javascript_content_blocked, | 431 EXPECT_EQ(expect_is_javascript_content_blocked, |
429 tab_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_JAVASCRIPT)); | 432 tab_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_JAVASCRIPT)); |
430 EXPECT_FALSE(tab_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_PLUGINS)); | 433 EXPECT_FALSE(tab_settings->IsContentBlocked(CONTENT_SETTINGS_TYPE_PLUGINS)); |
431 } | 434 } |
432 | 435 |
433 private: | 436 private: |
434 // Builds the string to pass to kRegisterPepperPlugins for a single | 437 // Builds the string to pass to kRegisterPepperPlugins for a single |
435 // plugin using the provided parameters and a dummy version. | 438 // plugin using the provided parameters and a dummy version. |
436 // Multiple results may be passed to kRegisterPepperPlugins, separated by ",". | 439 // Multiple results may be passed to kRegisterPepperPlugins, separated by ",". |
437 base::FilePath::StringType BuildPepperPluginRegistration( | 440 base::FilePath::StringType BuildPepperPluginRegistration( |
| 441 const char* library_path, |
438 const char* library_name, | 442 const char* library_name, |
439 const char* display_name, | 443 const char* display_name, |
440 const char* mime_type) { | 444 const char* mime_type) { |
441 base::FilePath plugin_dir; | 445 base::FilePath plugin_dir; |
442 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir)); | 446 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir)); |
| 447 plugin_dir = plugin_dir.AppendASCII(library_path); |
443 | 448 |
444 base::FilePath plugin_lib = plugin_dir.AppendASCII(library_name); | 449 base::FilePath plugin_lib = plugin_dir.AppendASCII(library_name); |
445 EXPECT_TRUE(base::PathExists(plugin_lib)); | 450 EXPECT_TRUE(base::PathExists(plugin_lib)); |
446 | 451 |
447 base::FilePath::StringType pepper_plugin = plugin_lib.value(); | 452 base::FilePath::StringType pepper_plugin = plugin_lib.value(); |
448 std::string string_to_append = "#"; | 453 std::string string_to_append = "#"; |
449 string_to_append.append(display_name); | 454 string_to_append.append(display_name); |
450 string_to_append.append("#A CDM#0.1.0.0;"); | 455 string_to_append.append("#A CDM#0.1.0.0;"); |
451 string_to_append.append(mime_type); | 456 string_to_append.append(mime_type); |
452 | 457 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 592 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
588 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 593 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
589 switches::kAshBrowserTests)) | 594 switches::kAshBrowserTests)) |
590 return; | 595 return; |
591 #endif | 596 #endif |
592 RunJavaScriptBlockedTest("load_nacl_no_js.html", true); | 597 RunJavaScriptBlockedTest("load_nacl_no_js.html", true); |
593 } | 598 } |
594 #endif // !defined(DISABLE_NACL) | 599 #endif // !defined(DISABLE_NACL) |
595 | 600 |
596 #endif // defined(ENABLE_PLUGINS) | 601 #endif // defined(ENABLE_PLUGINS) |
OLD | NEW |