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

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

Issue 182113005: Update EME browser tests to include EME WD (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes + shadi's fix Created 6 years, 10 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
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 a28267183cb86d25da930a0b904642afaf52ec98..8e89e3401e97653f00d646a2fc7142732bf14307 100644
--- a/chrome/browser/media/encrypted_media_browsertest.cc
+++ b/chrome/browser/media/encrypted_media_browsertest.cc
@@ -35,7 +35,8 @@ const char kClearKeyCdmPluginMimeType[] = "application/x-ppapi-clearkey-cdm";
#endif // defined(ENABLE_PEPPER_CDMS)
// Available key systems.
-const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey";
+const char kClearKeyKeySystem[] = "org.w3.clearkey";
+const char kPrefixedClearKeyKeySystem[] = "webkit-org.w3.clearkey";
const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey";
const char kExternalClearKeyDecryptOnlyKeySystem[] =
"org.chromium.externalclearkey.decryptonly";
@@ -71,6 +72,12 @@ enum SrcType {
MSE
};
+// Whether to use prefixed or unprefixed EME.
+enum EMEVersion {
+ Prefixed,
+ Unprefixed
+};
+
// MSE is available on all desktop platforms and on Android 4.1 and later.
static bool IsMSESupported() {
#if defined(OS_ANDROID)
@@ -125,6 +132,7 @@ class EncryptedMediaTestBase : public MediaBrowserTest {
const std::string& media_type,
const std::string& key_system,
SrcType src_type,
+ EMEVersion eme_version,
const std::string& session_to_load,
bool force_invalid_response,
const std::string& expected_title) {
@@ -138,6 +146,8 @@ class EncryptedMediaTestBase : public MediaBrowserTest {
query_params.push_back(std::make_pair("keySystem", key_system));
if (src_type == MSE)
query_params.push_back(std::make_pair("useMSE", "1"));
+ if (eme_version == Prefixed)
+ query_params.push_back(std::make_pair("usePrefixedEME", "1"));
if (force_invalid_response)
query_params.push_back(std::make_pair("forceInvalidResponse", "1"));
if (!session_to_load.empty())
@@ -149,13 +159,20 @@ class EncryptedMediaTestBase : public MediaBrowserTest {
void RunSimpleEncryptedMediaTest(const std::string& media_file,
const std::string& media_type,
const std::string& key_system,
- SrcType src_type) {
+ SrcType src_type,
+ EMEVersion eme_version) {
std::string expected_title = kEnded;
if (!IsPlayBackPossible(key_system))
expected_title = kEmeKeyError;
- RunEncryptedMediaTest("encrypted_media_player.html", media_file, media_type,
- key_system, src_type, kNoSessionToLoad, false,
+ RunEncryptedMediaTest("encrypted_media_player.html",
+ media_file,
+ media_type,
+ key_system,
+ src_type,
+ eme_version,
+ kNoSessionToLoad,
+ false,
expected_title);
// Check KeyMessage received for all key systems.
bool receivedKeyMessage = false;
@@ -294,6 +311,7 @@ class ECKEncryptedMediaTest : public EncryptedMediaTestBase {
kWebMAudioOnly,
key_system,
SRC,
+ Prefixed,
kNoSessionToLoad,
false,
expected_title);
@@ -312,6 +330,7 @@ class WVEncryptedMediaTest : public EncryptedMediaTestBase {
protected:
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
EncryptedMediaTestBase::SetUpCommandLine(command_line);
+ command_line->AppendSwitch(switches::kEnableEncryptedMedia);
shadi1 2014/03/06 01:16:21 Is it safe to add this for both versions (prefixed
jrummell 2014/03/06 01:55:07 Should be fine. Events generated have different na
SetUpCommandLineForKeySystem(kWidevineKeySystem, command_line);
}
};
@@ -322,12 +341,15 @@ class WVEncryptedMediaTest : public EncryptedMediaTestBase {
// Tests encrypted media playback with a combination of parameters:
// - char*: Key system name.
// - bool: True to load media using MSE, otherwise use src.
+// - bool: True to use unprefixed EME, otherwise use prefixed EME.
//
// Note: Only parameterized (*_P) tests can be used. Non-parameterized (*_F)
// tests will crash at GetParam(). To add non-parameterized tests, use
// EncryptedMediaTestBase or one of its subclasses (e.g. WVEncryptedMediaTest).
-class EncryptedMediaTest : public EncryptedMediaTestBase,
- public testing::WithParamInterface<std::tr1::tuple<const char*, SrcType> > {
+class EncryptedMediaTest
+ : public EncryptedMediaTestBase,
+ public testing::WithParamInterface<
+ std::tr1::tuple<const char*, SrcType, EMEVersion> > {
public:
std::string CurrentKeySystem() {
return std::tr1::get<0>(GetParam());
@@ -337,10 +359,17 @@ class EncryptedMediaTest : public EncryptedMediaTestBase,
return std::tr1::get<1>(GetParam());
}
+ EMEVersion CurrentEMEVersion() {
+ return std::tr1::get<2>(GetParam());
+ }
+
void TestSimplePlayback(const std::string& encrypted_media,
const std::string& media_type) {
- RunSimpleEncryptedMediaTest(
- encrypted_media, media_type, CurrentKeySystem(), CurrentSourceType());
+ RunSimpleEncryptedMediaTest(encrypted_media,
+ media_type,
+ CurrentKeySystem(),
+ CurrentSourceType(),
+ CurrentEMEVersion());
}
void RunInvalidResponseTest() {
@@ -349,6 +378,7 @@ class EncryptedMediaTest : public EncryptedMediaTestBase,
kWebMAudioVideo,
CurrentKeySystem(),
CurrentSourceType(),
+ CurrentEMEVersion(),
kNoSessionToLoad,
true,
kEmeKeyError);
@@ -360,6 +390,7 @@ class EncryptedMediaTest : public EncryptedMediaTestBase,
kWebMAudioVideo,
CurrentKeySystem(),
CurrentSourceType(),
+ CurrentEMEVersion(),
kNoSessionToLoad,
false,
kEnded);
@@ -370,6 +401,8 @@ class EncryptedMediaTest : public EncryptedMediaTestBase,
std::vector<StringPair> query_params;
query_params.push_back(std::make_pair("keySystem", CurrentKeySystem()));
query_params.push_back(std::make_pair("runEncrypted", "1"));
+ if (CurrentEMEVersion() == Prefixed)
+ query_params.push_back(std::make_pair("usePrefixedEME", "1"));
RunEncryptedMediaTestPage("mse_config_change.html",
CurrentKeySystem(),
&query_params,
@@ -380,6 +413,9 @@ class EncryptedMediaTest : public EncryptedMediaTestBase,
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
EncryptedMediaTestBase::SetUpCommandLine(command_line);
SetUpCommandLineForKeySystem(CurrentKeySystem(), command_line);
+
+ if (CurrentEMEVersion() == Unprefixed)
+ command_line->AppendSwitch(switches::kEnableEncryptedMedia);
}
};
@@ -387,37 +423,81 @@ using ::testing::Combine;
using ::testing::Values;
#if !defined(OS_ANDROID)
-INSTANTIATE_TEST_CASE_P(SRC_ClearKey, EncryptedMediaTest,
- Combine(Values(kClearKeyKeySystem), Values(SRC)));
+INSTANTIATE_TEST_CASE_P(SRC_ClearKey_Prefixed,
+ EncryptedMediaTest,
+ Combine(Values(kPrefixedClearKeyKeySystem),
+ Values(SRC),
+ Values(Prefixed)));
+
+// TODO: Enable unprefixed tests when prefixed EME goes away. Disabled now
ddorwin 2014/03/05 23:57:48 ...before shipping unprefixed EME.
jrummell 2014/03/06 01:55:07 Done.
+// as they don't provide much additional coverage, but do take a bit of time
+// to execute.
+// INSTANTIATE_TEST_CASE_P(SRC_ClearKey,
ddorwin 2014/03/05 23:57:48 use #if 0 rather than comments.
shadi1 2014/03/06 01:16:21 Another way is to name it DISABLED_SRC_Clearkey.
jrummell 2014/03/06 01:55:07 Done.
jrummell 2014/03/06 01:55:07 Done.
+// EncryptedMediaTest,
+// Combine(Values(kClearKeyKeySystem),
+// Values(SRC),
+// Values(Unprefixed)));
#endif // !defined(OS_ANDROID)
-INSTANTIATE_TEST_CASE_P(MSE_ClearKey, EncryptedMediaTest,
- Combine(Values(kClearKeyKeySystem), Values(MSE)));
+INSTANTIATE_TEST_CASE_P(MSE_ClearKey_Prefixed,
+ EncryptedMediaTest,
+ Combine(Values(kPrefixedClearKeyKeySystem),
+ Values(MSE),
+ Values(Prefixed)));
shadi1 2014/03/06 01:16:21 For the other prefixed tests there is no _Prefixed
jrummell 2014/03/06 01:55:07 In the long run the prefixed ones will go away, so
+INSTANTIATE_TEST_CASE_P(MSE_ClearKey,
+ EncryptedMediaTest,
+ Combine(Values(kClearKeyKeySystem),
+ Values(MSE),
+ Values(Unprefixed)));
// External Clear Key is currently only used on platforms that use Pepper CDMs.
#if defined(ENABLE_PEPPER_CDMS)
-INSTANTIATE_TEST_CASE_P(SRC_ExternalClearKey, EncryptedMediaTest,
- Combine(Values(kExternalClearKeyKeySystem), Values(SRC)));
-INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey, EncryptedMediaTest,
- Combine(Values(kExternalClearKeyKeySystem), Values(MSE)));
+INSTANTIATE_TEST_CASE_P(SRC_ExternalClearKey,
+ EncryptedMediaTest,
+ Combine(Values(kExternalClearKeyKeySystem),
+ Values(SRC),
+ Values(Prefixed)));
+INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey,
+ EncryptedMediaTest,
+ Combine(Values(kExternalClearKeyKeySystem),
+ Values(MSE),
+ Values(Prefixed)));
// To reduce test time, only run ExternalClearKeyDecryptOnly with MSE.
-INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKeyDecryptOnly, EncryptedMediaTest,
- Combine(Values(kExternalClearKeyDecryptOnlyKeySystem), Values(MSE)));
+INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKeyDecryptOnly,
+ EncryptedMediaTest,
+ Combine(Values(kExternalClearKeyDecryptOnlyKeySystem),
+ Values(MSE),
+ Values(Prefixed)));
#endif // defined(ENABLE_PEPPER_CDMS)
#if defined(WIDEVINE_CDM_AVAILABLE)
// This test doesn't fully test playback with Widevine. So we only run Widevine
// test with MSE (no SRC) to reduce test time. Also, on Android EME only works
// with MSE and we cannot run this test with SRC.
-INSTANTIATE_TEST_CASE_P(MSE_Widevine, EncryptedMediaTest,
- Combine(Values(kWidevineKeySystem), Values(MSE)));
+INSTANTIATE_TEST_CASE_P(MSE_Widevine,
+ EncryptedMediaTest,
+ Combine(Values(kWidevineKeySystem),
+ Values(MSE),
+ Values(Prefixed)));
shadi1 2014/03/06 01:16:21 I might be reading the parametrized tests wrong, d
jrummell 2014/03/06 01:55:07 Correct (for now, until unprefixed WV loads).
#endif // defined(WIDEVINE_CDM_AVAILABLE)
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) {
+#if defined(WIDEVINE_CDM_AVAILABLE)
+ if (IsWidevine(CurrentKeySystem())) {
+ VLOG(0) << "Test disabled on Widevine key system, crbug.com/349526.";
+ return;
+ }
+#endif
TestSimplePlayback("bear-a-enc_a.webm", kWebMAudioOnly);
}
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioClearVideo_WebM) {
+#if defined(WIDEVINE_CDM_AVAILABLE)
+ if (IsWidevine(CurrentKeySystem())) {
+ VLOG(0) << "Test disabled on Widevine key system, crbug.com/349526.";
+ return;
+ }
+#endif
TestSimplePlayback("bear-320x240-av-enc_a.webm", kWebMAudioVideo);
}
@@ -484,12 +564,27 @@ IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_MP4) {
#if defined(WIDEVINE_CDM_AVAILABLE)
// The parent key system cannot be used in generateKeyRequest.
-IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException) {
+IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException_Prefixed) {
+ RunEncryptedMediaTest("encrypted_media_player.html",
+ "bear-a-enc_a.webm",
+ kWebMAudioOnly,
+ "com.widevine",
+ MSE,
+ Prefixed,
+ kNoSessionToLoad,
+ false,
+ kEmeNotSupportedError);
+}
+
+// FIXME(jrummell): http://crbug.com/349181
+// The parent key system cannot be used when creating MediaKeys.
+IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, DISABLED_ParentThrowsException) {
RunEncryptedMediaTest("encrypted_media_player.html",
"bear-a-enc_a.webm",
kWebMAudioOnly,
"com.widevine",
MSE,
+ Unprefixed,
kNoSessionToLoad,
false,
kEmeNotSupportedError);
@@ -517,6 +612,7 @@ IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) {
kWebMVideoOnly,
kExternalClearKeyKeySystem,
SRC,
+ Prefixed,
kLoadableSession,
false,
kEnded);
@@ -529,6 +625,7 @@ IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) {
kWebMVideoOnly,
kExternalClearKeyKeySystem,
SRC,
+ Prefixed,
kUnknownSession,
false,
kEmeKeyError);
« no previous file with comments | « no previous file | chrome/test/data/media/encrypted_media_player.html » ('j') | chrome/test/data/media/encrypted_media_player.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698