Chromium Code Reviews| 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/stringprintf.h" | 7 #include "base/stringprintf.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/content_settings/cookie_settings.h" | 9 #include "chrome/browser/content_settings/cookie_settings.h" |
| 10 #include "chrome/browser/content_settings/host_content_settings_map.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 472 // Registers any CDM plugins not registered by default. | 472 // Registers any CDM plugins not registered by default. |
| 473 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 473 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 474 // Platform-specific filename relative to the chrome executable. | 474 // Platform-specific filename relative to the chrome executable. |
| 475 #if defined(OS_WIN) | 475 #if defined(OS_WIN) |
| 476 const wchar_t kLibraryName[] = L"clearkeycdmadapter.dll"; | 476 const wchar_t kLibraryName[] = L"clearkeycdmadapter.dll"; |
| 477 const std::wstring external_clear_key_mime_type = | 477 const std::wstring external_clear_key_mime_type = |
| 478 ASCIIToWide(kExternalClearKeyMimeType); | 478 ASCIIToWide(kExternalClearKeyMimeType); |
| 479 #else // !defined(OS_WIN) | 479 #else // !defined(OS_WIN) |
| 480 const char* external_clear_key_mime_type = kExternalClearKeyMimeType; | 480 const char* external_clear_key_mime_type = kExternalClearKeyMimeType; |
| 481 #if defined(OS_MACOSX) | 481 #if defined(OS_MACOSX) |
| 482 const char kLibraryName[] = "clearkeycdmadapter.plugin"; | 482 const char kLibraryName[] = "clearkeycdmadapter.plugin"; |
|
xhwang
2013/05/10 00:26:44
Just double check: on systems that don't have ENAB
ddorwin
2013/05/14 00:17:10
Done. I moved the ifdef up. Yes, plugin (ppapi & n
| |
| 483 #elif defined(OS_POSIX) | 483 #elif defined(OS_POSIX) |
| 484 const char kLibraryName[] = "libclearkeycdmadapter.so"; | 484 const char kLibraryName[] = "libclearkeycdmadapter.so"; |
| 485 #endif | 485 #endif |
| 486 #endif // defined(OS_WIN) | 486 #endif // defined(OS_WIN) |
| 487 | 487 |
| 488 #if defined(ENABLE_PEPPER_CDMS) | |
| 488 // Append the switch to register the External Clear Key CDM. | 489 // Append the switch to register the External Clear Key CDM. |
| 489 base::FilePath plugin_dir; | 490 base::FilePath plugin_dir; |
| 490 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir)); | 491 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir)); |
| 491 base::FilePath plugin_lib = plugin_dir.Append(kLibraryName); | 492 base::FilePath plugin_lib = plugin_dir.Append(kLibraryName); |
| 492 EXPECT_TRUE(file_util::PathExists(plugin_lib)); | 493 EXPECT_TRUE(file_util::PathExists(plugin_lib)); |
| 493 base::FilePath::StringType pepper_plugin = plugin_lib.value(); | 494 base::FilePath::StringType pepper_plugin = plugin_lib.value(); |
| 494 pepper_plugin.append(FILE_PATH_LITERAL( | 495 pepper_plugin.append(FILE_PATH_LITERAL( |
| 495 "#Clear Key CDM#Clear Key CDM 0.1.0.0#0.1.0.0;")); | 496 "#Clear Key CDM#Clear Key CDM 0.1.0.0#0.1.0.0;")); |
| 496 pepper_plugin.append(external_clear_key_mime_type); | 497 pepper_plugin.append(external_clear_key_mime_type); |
| 497 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, | 498 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, |
| 498 pepper_plugin); | 499 pepper_plugin); |
| 500 #endif // defined(ENABLE_PEPPER_CDMS) | |
| 499 #if !defined(DISABLE_NACL) | 501 #if !defined(DISABLE_NACL) |
| 500 // Ensure NaCl can run. | 502 // Ensure NaCl can run. |
| 501 command_line->AppendSwitch(switches::kEnableNaCl); | 503 command_line->AppendSwitch(switches::kEnableNaCl); |
| 502 #endif | 504 #endif |
| 503 } | 505 } |
| 504 | 506 |
| 505 void RunLoadPepperPluginTest(const char* mime_type, bool expect_loaded) { | 507 void RunLoadPepperPluginTest(const char* mime_type, bool expect_loaded) { |
|
xhwang
2013/05/10 00:26:44
What about this and line 582?
ddorwin
2013/05/14 00:17:10
It's used for a NaCl test. If NaCl and Pepper CDMs
| |
| 506 const char* expected_result = expect_loaded ? "Loaded" : "Not Loaded"; | 508 const char* expected_result = expect_loaded ? "Loaded" : "Not Loaded"; |
| 507 content::WebContents* web_contents = | 509 content::WebContents* web_contents = |
| 508 browser()->tab_strip_model()->GetActiveWebContents(); | 510 browser()->tab_strip_model()->GetActiveWebContents(); |
| 509 | 511 |
| 510 string16 expected_title(ASCIIToUTF16(expected_result)); | 512 string16 expected_title(ASCIIToUTF16(expected_result)); |
| 511 content::TitleWatcher title_watcher(web_contents, expected_title); | 513 content::TitleWatcher title_watcher(web_contents, expected_title); |
| 512 | 514 |
| 513 // GetTestUrl assumes paths, so we must append query parameters to result. | 515 // GetTestUrl assumes paths, so we must append query parameters to result. |
| 514 GURL file_url = ui_test_utils::GetTestUrl( | 516 GURL file_url = ui_test_utils::GetTestUrl( |
| 515 base::FilePath(), | 517 base::FilePath(), |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 553 | 555 |
| 554 // Tests Pepper plugins that use JavaScript instead of Plug-ins settings. | 556 // Tests Pepper plugins that use JavaScript instead of Plug-ins settings. |
| 555 IN_PROC_BROWSER_TEST_F(PepperContentSettingsTest, PluginSpecialCases) { | 557 IN_PROC_BROWSER_TEST_F(PepperContentSettingsTest, PluginSpecialCases) { |
| 556 HostContentSettingsMap* content_settings = | 558 HostContentSettingsMap* content_settings = |
| 557 browser()->profile()->GetHostContentSettingsMap(); | 559 browser()->profile()->GetHostContentSettingsMap(); |
| 558 | 560 |
| 559 // First, verify that this plugin can be loaded. | 561 // First, verify that this plugin can be loaded. |
| 560 content_settings->SetDefaultContentSetting( | 562 content_settings->SetDefaultContentSetting( |
| 561 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_ALLOW); | 563 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_ALLOW); |
| 562 | 564 |
| 565 #if defined(ENABLE_PEPPER_CDMS) | |
| 563 RunLoadPepperPluginTest(kExternalClearKeyMimeType, true); | 566 RunLoadPepperPluginTest(kExternalClearKeyMimeType, true); |
| 567 #endif | |
| 564 | 568 |
| 565 // Next, test behavior when plug-ins are blocked. | 569 // Next, test behavior when plug-ins are blocked. |
| 566 content_settings->SetDefaultContentSetting( | 570 content_settings->SetDefaultContentSetting( |
| 567 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK); | 571 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK); |
| 568 | 572 |
| 573 #if defined(ENABLE_PEPPER_CDMS) | |
| 569 // The plugin we loaded above does not load now. | 574 // The plugin we loaded above does not load now. |
| 570 RunLoadPepperPluginTest(kExternalClearKeyMimeType, false); | 575 RunLoadPepperPluginTest(kExternalClearKeyMimeType, false); |
| 571 | 576 |
| 572 #if defined(WIDEVINE_CDM_AVAILABLE) | 577 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 573 RunLoadPepperPluginTest(kWidevineCdmPluginMimeType, true); | 578 RunLoadPepperPluginTest(kWidevineCdmPluginMimeType, true); |
| 574 #endif | 579 #endif |
| 580 #endif // defined(ENABLE_PEPPER_CDMS) | |
| 575 | 581 |
| 576 #if !defined(DISABLE_NACL) | 582 #if !defined(DISABLE_NACL) |
| 577 RunLoadPepperPluginTest("application/x-nacl", true); | 583 RunLoadPepperPluginTest("application/x-nacl", true); |
| 578 #endif | 584 #endif |
| 579 | 585 |
| 580 // Finally, test behavior when (just) JavaScript is blocked. | 586 // Finally, test behavior when (just) JavaScript is blocked. |
| 581 content_settings->SetDefaultContentSetting( | 587 content_settings->SetDefaultContentSetting( |
| 582 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_ALLOW); | 588 CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_ALLOW); |
| 583 content_settings->SetDefaultContentSetting( | 589 content_settings->SetDefaultContentSetting( |
| 584 CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK); | 590 CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK); |
| 585 | 591 |
| 592 #if defined(ENABLE_PEPPER_CDMS) | |
| 586 // This plugin has no special behavior and does not require JavaScript. | 593 // This plugin has no special behavior and does not require JavaScript. |
| 587 RunJavaScriptBlockedTest("load_clearkey_no_js.html", false); | 594 RunJavaScriptBlockedTest("load_clearkey_no_js.html", false); |
| 588 | 595 |
| 589 #if defined(WIDEVINE_CDM_AVAILABLE) | 596 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 590 RunJavaScriptBlockedTest("load_widevine_no_js.html", true); | 597 RunJavaScriptBlockedTest("load_widevine_no_js.html", true); |
| 591 #endif | 598 #endif |
| 599 #endif // defined(ENABLE_PEPPER_CDMS) | |
| 592 | 600 |
| 593 #if !defined(DISABLE_NACL) | 601 #if !defined(DISABLE_NACL) |
| 594 RunJavaScriptBlockedTest("load_nacl_no_js.html", true); | 602 RunJavaScriptBlockedTest("load_nacl_no_js.html", true); |
| 595 #endif | 603 #endif |
| 596 } | 604 } |
| 597 | 605 |
| 598 #endif // defined(ENABLE_PLUGINS) | 606 #endif // defined(ENABLE_PLUGINS) |
| OLD | NEW |