Chromium Code Reviews| Index: chrome/browser/media/encrypted_media_browsertest.cc |
| diff --git a/chrome/browser/media/encrypted_media_browsertest.cc b/chrome/browser/media/encrypted_media_browsertest.cc |
| index ffcf3679b38704a526f169b07a87a241f5ba05c3..9b8345e4be5745c8554db441640f35cea6fb2638 100644 |
| --- a/chrome/browser/media/encrypted_media_browsertest.cc |
| +++ b/chrome/browser/media/encrypted_media_browsertest.cc |
| @@ -26,7 +26,10 @@ |
| #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
| #if defined(ENABLE_PEPPER_CDMS) |
| -// Platform-specific filename relative to the chrome executable. |
| +// Base path for Clear Key CDM (relative to the chrome executable). |
| +const char kClearKeyCdmBaseDirectory[] = "ClearKeyCdm"; |
| + |
| +// Platform-specific filename relative to kClearKeyCdmBaseDirectory. |
| const char kClearKeyCdmAdapterFileName[] = |
| #if defined(OS_MACOSX) |
| "clearkeycdmadapter.plugin"; |
| @@ -261,11 +264,13 @@ class EncryptedMediaTestBase : public MediaBrowserTest { |
| #if defined(ENABLE_PEPPER_CDMS) |
| if (IsExternalClearKey(key_system)) { |
| - RegisterPepperCdm(command_line, kClearKeyCdmAdapterFileName, key_system); |
| + RegisterPepperCdm(command_line, kClearKeyCdmBaseDirectory, |
| + kClearKeyCdmAdapterFileName, key_system); |
| } |
| #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
| else if (IsWidevine(key_system)) { // NOLINT |
| - RegisterPepperCdm(command_line, kWidevineCdmAdapterFileName, key_system); |
| + RegisterPepperCdm(command_line, kWidevineCdmBaseDirectory, |
| + kWidevineCdmAdapterFileName, key_system); |
| } |
| #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
| #endif // defined(ENABLE_PEPPER_CDMS) |
| @@ -273,18 +278,26 @@ class EncryptedMediaTestBase : public MediaBrowserTest { |
| private: |
| #if defined(ENABLE_PEPPER_CDMS) |
| + // The CDM adatper should be located in |adapter_base_dir| in DIR_MODULE. If |
|
Lei Zhang
2016/05/12 17:22:02
typo
xhwang
2016/05/13 16:44:12
Done.
|
| + // |adapter_base_dir| is empty, then the adapter should be located in |
|
Lei Zhang
2016/05/12 17:22:02
Does the |adapter_base_dir| case still apply?
xhwang
2016/05/13 16:44:12
Removed.
|
| + // DIR_MODULE directly. |
| void RegisterPepperCdm(base::CommandLine* command_line, |
| + const std::string& adapter_base_dir, |
| const std::string& adapter_name, |
| const std::string& key_system) { |
| DCHECK(!is_pepper_cdm_registered_) |
| << "RegisterPepperCdm() can only be called once."; |
| is_pepper_cdm_registered_ = true; |
| - // Append the switch to register the Clear Key CDM Adapter. |
| + // Build the CDM adapter path. |
| base::FilePath plugin_dir; |
| EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir)); |
| + plugin_dir = plugin_dir.AppendASCII(adapter_base_dir); |
| + |
| base::FilePath plugin_lib = plugin_dir.AppendASCII(adapter_name); |
| EXPECT_TRUE(base::PathExists(plugin_lib)) << plugin_lib.value(); |
| + |
| + // Build pepper plugin registration switch. |
| base::FilePath::StringType pepper_plugin = plugin_lib.value(); |
| pepper_plugin.append(FILE_PATH_LITERAL("#CDM#0.1.0.0;")); |
| #if defined(OS_WIN) |
| @@ -292,6 +305,8 @@ class EncryptedMediaTestBase : public MediaBrowserTest { |
| #else |
| pepper_plugin.append(GetPepperType(key_system)); |
| #endif |
| + |
| + // Append the switch to register the CDM Adapter. |
| command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, |
| pepper_plugin); |
| } |