Chromium Code Reviews| Index: content/browser/media/encrypted_media_browsertest.cc |
| diff --git a/content/browser/media/encrypted_media_browsertest.cc b/content/browser/media/encrypted_media_browsertest.cc |
| index 34cbd65376b1e122f5db385776bbcfbaad111d1f..92cb538e21d791ebbe118c86d573d32e18f5856f 100644 |
| --- a/content/browser/media/encrypted_media_browsertest.cc |
| +++ b/content/browser/media/encrypted_media_browsertest.cc |
| @@ -27,17 +27,17 @@ |
| #include <gnu/libc-version.h> |
| #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(OS_LINUX) |
| +#if defined(ENABLE_PEPPER_CDMS) |
| // Platform-specific filename relative to the chrome executable. |
| -#if defined(OS_WIN) |
| -static const char kClearKeyLibraryName[] = "clearkeycdmadapter.dll"; |
| -static const char kWidevineLibraryName[] = "widevinecdmadapter.dll"; |
| -#elif defined(OS_MACOSX) |
| -static const char kClearKeyLibraryName[] = "clearkeycdmadapter.plugin"; |
| -static const char kWidevineLibraryName[] = "widevinecdmadapter.plugin"; |
| +static const base::FilePath::CharType kClearKeyCdmAdapterFileName[] = |
| +#if defined(OS_MACOSX) |
| + FILE_PATH_LITERAL("clearkeycdmadapter.plugin"); |
| +#elif defined(OS_WIN) |
| + FILE_PATH_LITERAL("clearkeycdmadapter.dll"); |
| #elif defined(OS_POSIX) |
| -static const char kClearKeyLibraryName[] = "libclearkeycdmadapter.so"; |
| -static const char kWidevineLibraryName[] = "libwidevinecdmadapter.so"; |
| + FILE_PATH_LITERAL("libclearkeycdmadapter.so"); |
| #endif |
| +#endif // defined(ENABLE_PEPPER_CDMS) |
| // Available key systems. |
| static const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey"; |
| @@ -105,33 +105,30 @@ class EncryptedMediaTest : public testing::WithParamInterface<const char*>, |
| } |
| protected: |
| - // Registers any CDM plugins not registered by default. |
| +#if defined(ENABLE_PEPPER_CDMS) |
| virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| - RegisterPepperPlugin(command_line, kClearKeyLibraryName, |
| - kExternalClearKeyKeySystem); |
| + RegisterPepperCdm(command_line, kClearKeyCdmAdapterFileName, |
| + kExternalClearKeyKeySystem); |
| } |
| - virtual void RegisterPepperPlugin(CommandLine* command_line, |
| - const std::string& library_name, |
| - const std::string& key_system) { |
| + virtual void RegisterPepperCdm(CommandLine* command_line, |
| + const base::FilePath::StringType& adapter_name, |
| + const std::string& key_system) { |
| // Append the switch to register the Clear Key CDM Adapter. |
| base::FilePath plugin_dir; |
| EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir)); |
| -#if defined(OS_WIN) |
| - base::FilePath plugin_lib = plugin_dir.Append(ASCIIToWide(library_name)); |
| -#else |
| - base::FilePath plugin_lib = plugin_dir.Append(library_name); |
| -#endif |
| + base::FilePath plugin_lib = plugin_dir.Append(adapter_name); |
| EXPECT_TRUE(file_util::PathExists(plugin_lib)); |
| base::FilePath::StringType pepper_plugin = plugin_lib.value(); |
| pepper_plugin.append(FILE_PATH_LITERAL("#CDM#0.1.0.0;")); |
| #if defined(OS_WIN) |
| - pepper_plugin.append(ASCIIToWide(webkit_media::GetPluginType(key_system))); |
| + pepper_plugin.append(ASCIIToWide(webkit_media::GetPepperType(key_system))); |
| #else |
| - pepper_plugin.append(webkit_media::GetPluginType(key_system)); |
| + pepper_plugin.append(webkit_media::GetPepperType(key_system)); |
| #endif |
| command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, |
| pepper_plugin); |
| +#endif // defined(ENABLE_PEPPER_CDMS) |
|
xhwang
2013/05/14 16:35:44
shouldn't this be after line 132?
ddorwin
2013/05/14 20:14:28
Done. Fixed in Patch 5.
|
| } |
| }; |
| @@ -165,20 +162,23 @@ class WVEncryptedMediaTest : public EncryptedMediaTest { |
| } |
| protected: |
| - // Registers any CDM plugins not registered by default. |
| +#if defined(ENABLE_PEPPER_CDMS) |
| virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| - command_line->AppendSwitch(switches::kAllowFileAccessFromFiles); |
| - RegisterPepperPlugin(command_line, kWidevineLibraryName, |
| - kWidevineKeySystem); |
| + RegisterPepperCdm(command_line, kWidevineCdmAdapterFileName, |
| + kWidevineKeySystem); |
| } |
| +#endif // defined(ENABLE_PEPPER_CDMS) |
| }; |
| #endif // defined(WIDEVINE_CDM_AVAILABLE) |
| INSTANTIATE_TEST_CASE_P(ClearKey, EncryptedMediaTest, |
| ::testing::Values(kClearKeyKeySystem)); |
| +// External Clear Key is currently only used on platforms that use Pepper CDMs. |
| +#if defined(ENABLE_PEPPER_CDMS) |
| INSTANTIATE_TEST_CASE_P(ExternalClearKey, EncryptedMediaTest, |
| ::testing::Values(kExternalClearKeyKeySystem)); |
| +#endif |
|
xhwang
2013/05/14 16:35:44
nit: #endif // defined(ENABLE_PEPPER_CDMS)
ddorwin
2013/05/14 20:14:28
I believe the general pattern is to add a comment
|
| IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, InvalidKeySystem) { |
| const string16 kExpected = ASCIIToUTF16( |