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 af805b1f285391c51a141ed07514e0723472a11d..9ac3ffda09ee388b35d283bc0e30e5028315cc70 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"; |
| @@ -104,34 +104,31 @@ 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); |
|
Lei Zhang
2013/05/23 01:18:50
You can AppendASCII() and skip all the FILE_PATH_L
ddorwin
2013/05/23 01:47:31
Done. Thanks!
|
| 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) |
| }; |
| #if defined(WIDEVINE_CDM_AVAILABLE) |
| @@ -164,20 +161,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 |
| IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, InvalidKeySystem) { |
| const string16 kExpected = ASCIIToUTF16( |