Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6117)

Unified Diff: chrome/browser/media/encrypted_media_supported_types_browsertest.cc

Issue 1983563002: media: Add helper function to register pepper CDMs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/media/encrypted_media_browsertest.cc ('k') | chrome/browser/media/pepper_cdm_test_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media/encrypted_media_supported_types_browsertest.cc
diff --git a/chrome/browser/media/encrypted_media_supported_types_browsertest.cc b/chrome/browser/media/encrypted_media_supported_types_browsertest.cc
index d59b992c287152badac32325c56cfa9350521b7c..974c341d4c2aeff55bed2d7404596c537dc67dc4 100644
--- a/chrome/browser/media/encrypted_media_supported_types_browsertest.cc
+++ b/chrome/browser/media/encrypted_media_supported_types_browsertest.cc
@@ -27,12 +27,16 @@
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "url/gurl.h"
-#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
+#if defined(ENABLE_PEPPER_CDMS)
+#include "chrome/browser/media/pepper_cdm_test_helper.h"
+#endif
#if defined(OS_ANDROID)
#error This file needs to be updated to run on Android.
#endif
+#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
+
namespace chrome {
namespace {
@@ -83,8 +87,8 @@ const char kUnexpectedResult[] = "unexpected result";
// Expectations for Widevine.
// Note: Widevine is not available on platforms using components because
// RegisterPepperCdm() cannot set the codecs.
-// TODO(ddorwin): Enable these tests after we have the ability to use the CUS
-// in these tests. See http://crbug.com/356833.
+// TODO(xhwang): Enable these tests after we have the ability to use the
+// manifest in these tests. See http://crbug.com/586634
#if defined(WIDEVINE_CDM_AVAILABLE) && !defined(WIDEVINE_CDM_IS_COMPONENT)
#define EXPECT_WV_SUCCESS EXPECT_SUCCESS
#define EXPECT_WV_PROPRIETARY EXPECT_PROPRIETARY
@@ -100,7 +104,7 @@ const char kUnexpectedResult[] = "unexpected result";
class EncryptedMediaSupportedTypesTest : public InProcessBrowserTest {
protected:
- EncryptedMediaSupportedTypesTest() : is_pepper_cdm_registered_(false) {
+ EncryptedMediaSupportedTypesTest() {
audio_webm_codecs_.push_back("opus");
audio_webm_codecs_.push_back("vorbis");
@@ -147,32 +151,6 @@ class EncryptedMediaSupportedTypesTest : public InProcessBrowserTest {
}
const CodecVector& invalid_codecs() const { return invalid_codecs_; }
- // Update the command line to load |adapter_name| for
- // |pepper_type_for_key_system|.
- void RegisterPepperCdm(base::CommandLine* command_line,
- const std::string& adapter_name,
- const std::string& pepper_type_for_key_system,
- bool expect_adapter_exists = true) {
- DCHECK(!is_pepper_cdm_registered_)
- << "RegisterPepperCdm() can only be called once.";
- is_pepper_cdm_registered_ = true;
-
- // Append the switch to register the appropriate adapter.
- base::FilePath plugin_dir;
- EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir));
- base::FilePath plugin_lib = plugin_dir.AppendASCII(adapter_name);
- EXPECT_EQ(expect_adapter_exists, base::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(base::ASCIIToUTF16(pepper_type_for_key_system));
-#else
- pepper_plugin.append(pepper_type_for_key_system);
-#endif
- command_line->AppendSwitchNative(switches::kRegisterPepperPlugins,
- pepper_plugin);
- }
-
void SetUpOnMainThread() override {
InProcessBrowserTest::SetUpOnMainThread();
@@ -266,8 +244,6 @@ class EncryptedMediaSupportedTypesTest : public InProcessBrowserTest {
CodecVector video_mp4_codecs_;
CodecVector video_mp4_hi10p_codecs_;
CodecVector invalid_codecs_;
-
- bool is_pepper_cdm_registered_;
};
// For ClearKey, nothing additional is required.
@@ -282,19 +258,8 @@ class EncryptedMediaSupportedTypesExternalClearKeyTest
protected:
void SetUpCommandLine(base::CommandLine* command_line) override {
EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line);
-
- // Platform-specific filename relative to the chrome executable.
- const char adapter_file_name[] =
-#if defined(OS_MACOSX)
- "clearkeycdmadapter.plugin";
-#elif defined(OS_WIN)
- "clearkeycdmadapter.dll";
-#elif defined(OS_POSIX)
- "libclearkeycdmadapter.so";
-#endif
-
- const std::string pepper_name("application/x-ppapi-clearkey-cdm");
- RegisterPepperCdm(command_line, adapter_file_name, pepper_name);
+ RegisterPepperCdm(command_line, kClearKeyCdmAdapterFileName,
+ kClearKeyCdmPepperMimeType);
}
#endif // defined(ENABLE_PEPPER_CDMS)
};
@@ -313,10 +278,8 @@ class EncryptedMediaSupportedTypesClearKeyCDMRegisteredWithWrongPathTest
protected:
void SetUpCommandLine(base::CommandLine* command_line) override {
EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line);
- RegisterPepperCdm(command_line,
- "clearkeycdmadapterwrongname.dll",
- "application/x-ppapi-clearkey-cdm",
- false);
+ RegisterPepperCdm(command_line, "clearkeycdmadapterwrongname.dll",
+ kClearKeyCdmPepperMimeType, false);
}
};
@@ -326,10 +289,8 @@ class EncryptedMediaSupportedTypesWidevineCDMRegisteredWithWrongPathTest
protected:
void SetUpCommandLine(base::CommandLine* command_line) override {
EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line);
- RegisterPepperCdm(command_line,
- "widevinecdmadapterwrongname.dll",
- "application/x-ppapi-widevine-cdm",
- false);
+ RegisterPepperCdm(command_line, "widevinecdmadapterwrongname.dll",
+ "application/x-ppapi-widevine-cdm", false);
}
};
#endif // defined(ENABLE_PEPPER_CDMS)
« no previous file with comments | « chrome/browser/media/encrypted_media_browsertest.cc ('k') | chrome/browser/media/pepper_cdm_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698