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

Unified Diff: content/browser/media/encrypted_media_browsertest.cc

Issue 2445433003: media: Enable encrypted media content browsertests when MojoCdm is used (Closed)
Patch Set: rebase only Created 4 years, 1 month 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 | « no previous file | content/shell/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 aec21653d945f463ac3ae2ccaa1bfe683afe3811..565bf29acc93fc3aedcc0bb668c90ea24761ca4a 100644
--- a/content/browser/media/encrypted_media_browsertest.cc
+++ b/content/browser/media/encrypted_media_browsertest.cc
@@ -10,34 +10,43 @@
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
#include "content/shell/browser/shell.h"
+#include "media/base/media.h"
+#include "media/base/media_switches.h"
#if defined(OS_ANDROID)
#include "base/android/build_info.h"
-#include "media/base/media.h"
-#include "media/base/media_switches.h"
#endif
-#if defined(ENABLE_MOJO_RENDERER)
-// TODO(xhwang): Enable tests by running AesDecryptor in remote mojo CDM and
-// using ExternalClearKey instead of ClearKey: crbug.com/641559
-#define DISABLE_ENCRYPTED_MEDIA_PLAYBACK_TESTS 1
+// MojoCdm supports Clear Key, but currently MojoRenderer cannot use it.
+// See http://crbug.com/441957 for details.
+#if !(defined(ENABLE_MOJO_CDM) && defined(ENABLE_MOJO_RENDERER))
+#define SUPPORTS_CLEAR_KEY_IN_CONTENT_SHELL
+#endif
+
+#if defined(ENABLE_MOJO_CDM)
+// When mojo CDM is enabled, External Clear Key is supported in //content/shell/
+// by using mojo CDM with AesDecryptor running in the remote (e.g. GPU or
+// Browser) process.
+// Note that External Clear Key is also supported in chrome/ when pepper CDM is
+// used, which is tested in browser_tests.
+#define SUPPORTS_EXTERNAL_CLEAR_KEY_IN_CONTENT_SHELL
#endif
// Available key systems.
+#if defined(SUPPORTS_CLEAR_KEY_IN_CONTENT_SHELL)
const char kClearKeyKeySystem[] = "org.w3.clearkey";
+#endif
-#if defined(OS_ANDROID)
+#if defined(SUPPORTS_EXTERNAL_CLEAR_KEY_IN_CONTENT_SHELL)
const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey";
#endif
// Supported media types.
const char kWebMVorbisAudioOnly[] = "audio/webm; codecs=\"vorbis\"";
-#if !defined(DISABLE_ENCRYPTED_MEDIA_PLAYBACK_TESTS)
const char kWebMOpusAudioOnly[] = "audio/webm; codecs=\"opus\"";
const char kWebMVP8VideoOnly[] = "video/webm; codecs=\"vp8\"";
const char kWebMVP9VideoOnly[] = "video/webm; codecs=\"vp9\"";
const char kWebMOpusAudioVP9Video[] = "video/webm; codecs=\"opus, vp9\"";
-#endif
const char kWebMVorbisAudioVP8Video[] = "video/webm; codecs=\"vorbis, vp8\"";
// EME-specific test results and errors.
@@ -130,7 +139,7 @@ class EncryptedMediaTest : public content::MediaBrowserTest,
void SetUpCommandLine(base::CommandLine* command_line) override {
command_line->AppendSwitch(
switches::kDisableGestureRequirementForMediaPlayback);
-#if defined(OS_ANDROID)
+#if defined(SUPPORTS_EXTERNAL_CLEAR_KEY_IN_CONTENT_SHELL)
command_line->AppendSwitchASCII(switches::kEnableFeatures,
media::kExternalClearKeyForTesting.name);
#endif
@@ -140,13 +149,26 @@ class EncryptedMediaTest : public content::MediaBrowserTest,
using ::testing::Combine;
using ::testing::Values;
+#if defined(SUPPORTS_CLEAR_KEY_IN_CONTENT_SHELL)
INSTANTIATE_TEST_CASE_P(SRC_ClearKey, EncryptedMediaTest,
Combine(Values(kClearKeyKeySystem), Values(SRC)));
INSTANTIATE_TEST_CASE_P(MSE_ClearKey, EncryptedMediaTest,
Combine(Values(kClearKeyKeySystem), Values(MSE)));
+#endif
+
+#if defined(SUPPORTS_EXTERNAL_CLEAR_KEY_IN_CONTENT_SHELL)
+INSTANTIATE_TEST_CASE_P(SRC_ExternalClearKey,
+ EncryptedMediaTest,
+ Combine(Values(kExternalClearKeyKeySystem),
+ Values(SRC)));
+
+INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey,
+ EncryptedMediaTest,
+ Combine(Values(kExternalClearKeyKeySystem),
+ Values(MSE)));
+#endif
-#if !defined(DISABLE_ENCRYPTED_MEDIA_PLAYBACK_TESTS)
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) {
TestSimplePlayback("bear-a_enc-a.webm", kWebMVorbisAudioOnly);
}
@@ -209,7 +231,6 @@ IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, ConfigChangeVideo) {
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, FrameSizeChangeVideo) {
TestFrameSizeChange();
}
-#endif // !defined(DISABLE_ENCRYPTED_MEDIA_PLAYBACK_TESTS)
IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, UnknownKeySystemThrowsException) {
RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm",
@@ -217,16 +238,4 @@ IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, UnknownKeySystemThrowsException) {
kEmeNotSupportedError);
}
-#if defined(OS_ANDROID)
-// On Android, External Clear Key is supported in //content/shell/ by using mojo
-// CDM with AesDecryptor running in the GPU process.
-// On other platforms, External Clear Key is supported in chrome/, so it is
-// tested in browser_tests.
-IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, ExternalClearKeyPlayback) {
- RunSimpleEncryptedMediaTest("bear-320x240-av_enc-av.webm",
- kWebMVorbisAudioVP8Video,
- kExternalClearKeyKeySystem, MSE);
-}
-#endif
-
} // namespace content
« no previous file with comments | « no previous file | content/shell/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698