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..e5bf9f635471648abec0ced1993333a8cfe8a3ad 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 EME or EME WD. |
ddorwin
2014/03/04 21:18:48
Let's keep it simple: prefixed vs. unprefixed.
jrummell
2014/03/04 23:55:49
Done.
|
+enum EMEType { |
ddorwin
2014/03/04 21:18:48
EmeVersion?
jrummell
2014/03/04 23:55:49
Done.
|
+ Prefixed, |
+ WD |
+}; |
+ |
// 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, |
+ EMEType eme_type, |
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")); |
ddorwin
2014/03/04 21:18:48
Not sure about JS style, but these might be incorr
jrummell
2014/03/04 23:55:49
I just followed what the existing code did. I can'
|
+ if (eme_type == 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, |
+ EMEType eme_type) { |
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_type, |
+ 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); |
@@ -322,12 +340,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 EME WD, otherwise use prefixed EME. |
ddorwin
2014/03/04 21:18:48
ditto
jrummell
2014/03/04 23:55:49
Done.
|
// |
// 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, EMEType> > { |
public: |
std::string CurrentKeySystem() { |
return std::tr1::get<0>(GetParam()); |
@@ -337,10 +358,17 @@ class EncryptedMediaTest : public EncryptedMediaTestBase, |
return std::tr1::get<1>(GetParam()); |
} |
+ EMEType CurrentEMEType() { |
+ 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(), |
+ CurrentEMEType()); |
} |
void RunInvalidResponseTest() { |
@@ -349,6 +377,7 @@ class EncryptedMediaTest : public EncryptedMediaTestBase, |
kWebMAudioVideo, |
CurrentKeySystem(), |
CurrentSourceType(), |
+ CurrentEMEType(), |
kNoSessionToLoad, |
true, |
kEmeKeyError); |
@@ -360,6 +389,7 @@ class EncryptedMediaTest : public EncryptedMediaTestBase, |
kWebMAudioVideo, |
CurrentKeySystem(), |
CurrentSourceType(), |
+ CurrentEMEType(), |
kNoSessionToLoad, |
false, |
kEnded); |
@@ -370,6 +400,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 (CurrentEMEType() == Prefixed) |
+ query_params.push_back(std::make_pair("usePrefixedEME", "1")); |
RunEncryptedMediaTestPage("mse_config_change.html", |
CurrentKeySystem(), |
&query_params, |
@@ -380,6 +412,9 @@ class EncryptedMediaTest : public EncryptedMediaTestBase, |
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
EncryptedMediaTestBase::SetUpCommandLine(command_line); |
SetUpCommandLineForKeySystem(CurrentKeySystem(), command_line); |
+ |
+ if (CurrentEMEType() == WD) |
+ command_line->AppendSwitch(switches::kEnableEncryptedMedia); |
} |
}; |
@@ -387,30 +422,58 @@ using ::testing::Combine; |
using ::testing::Values; |
ddorwin
2014/03/04 21:18:48
This is a lot of tests, each of which takes severa
jrummell
2014/03/04 23:55:49
Done.
|
#if !defined(OS_ANDROID) |
-INSTANTIATE_TEST_CASE_P(SRC_ClearKey, EncryptedMediaTest, |
- Combine(Values(kClearKeyKeySystem), Values(SRC))); |
+INSTANTIATE_TEST_CASE_P(SRC_ClearKey, |
+ EncryptedMediaTest, |
+ Combine(Values(kPrefixedClearKeyKeySystem), |
+ Values(SRC), |
+ Values(Prefixed))); |
+INSTANTIATE_TEST_CASE_P(SRC_ClearKey_WD, |
ddorwin
2014/03/04 21:18:48
ditto here and below. Also, I would instead name t
jrummell
2014/03/04 23:55:49
Done. I didn't want to change the names of the exi
|
+ EncryptedMediaTest, |
+ Combine(Values(kClearKeyKeySystem), |
+ Values(SRC), |
+ Values(WD))); |
#endif // !defined(OS_ANDROID) |
-INSTANTIATE_TEST_CASE_P(MSE_ClearKey, EncryptedMediaTest, |
- Combine(Values(kClearKeyKeySystem), Values(MSE))); |
+INSTANTIATE_TEST_CASE_P(MSE_ClearKey, |
+ EncryptedMediaTest, |
+ Combine(Values(kPrefixedClearKeyKeySystem), |
+ Values(MSE), |
+ Values(Prefixed))); |
+INSTANTIATE_TEST_CASE_P(MSE_ClearKey_WD, |
+ EncryptedMediaTest, |
+ Combine(Values(kClearKeyKeySystem), |
+ Values(MSE), |
+ Values(WD))); |
// 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))); |
#endif // defined(WIDEVINE_CDM_AVAILABLE) |
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) { |
@@ -490,6 +553,7 @@ IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException) { |
kWebMAudioOnly, |
"com.widevine", |
MSE, |
+ Prefixed, |
ddorwin
2014/03/04 21:18:48
We should be able to test this with unprefixed too
jrummell
2014/03/04 23:55:49
Added, but fails due to FATAL error. Opened http:/
|
kNoSessionToLoad, |
false, |
kEmeNotSupportedError); |
@@ -517,6 +581,7 @@ IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { |
kWebMVideoOnly, |
kExternalClearKeyKeySystem, |
SRC, |
+ Prefixed, |
kLoadableSession, |
false, |
kEnded); |
@@ -529,6 +594,7 @@ IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { |
kWebMVideoOnly, |
kExternalClearKeyKeySystem, |
SRC, |
+ Prefixed, |
kUnknownSession, |
false, |
kEmeKeyError); |