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..08942b4ba6440c8ce21978b5aef5eb957bc7ed6a 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; |
@@ -210,6 +227,7 @@ class EncryptedMediaTestBase : public MediaBrowserTest { |
} |
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
+ command_line->AppendSwitch(switches::kEnableEncryptedMedia); |
ddorwin
2014/03/05 19:04:36
Why does this no longer check the EME version? We
jrummell
2014/03/05 23:13:23
WVEncryptedMediaTest isn't parameterized, so can't
|
#if defined(OS_ANDROID) |
command_line->AppendSwitch( |
switches::kDisableGestureRequirementForMediaPlayback); |
@@ -294,6 +312,7 @@ class ECKEncryptedMediaTest : public EncryptedMediaTestBase { |
kWebMAudioOnly, |
key_system, |
SRC, |
+ Prefixed, |
kNoSessionToLoad, |
false, |
expected_title); |
@@ -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, |
@@ -387,30 +420,53 @@ 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))); |
ddorwin
2014/03/05 19:04:36
Maybe we should have a TODO to add Unprefixed late
jrummell
2014/03/05 23:13:23
Done as TODO.
|
#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))); |
+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))); |
#endif // defined(WIDEVINE_CDM_AVAILABLE) |
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) { |
@@ -484,16 +540,31 @@ 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, ParentThrowsExceptionPrefixed) { |
ddorwin
2014/03/05 19:04:36
_Prefixed
jrummell
2014/03/05 23:13:23
Done.
|
RunEncryptedMediaTest("encrypted_media_player.html", |
"bear-a-enc_a.webm", |
kWebMAudioOnly, |
"com.widevine", |
MSE, |
+ Prefixed, |
kNoSessionToLoad, |
false, |
kEmeNotSupportedError); |
} |
+ |
+// The parent key system cannot be used when creating MediaKeys. |
+IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException) { |
+ // FIXME(jrummell): http://crbug.com/349181 |
ddorwin
2014/03/05 19:04:36
Move this to above line 555 and add DISABLED_ to t
jrummell
2014/03/05 23:13:23
Done.
|
+ // RunEncryptedMediaTest("encrypted_media_player.html", |
+ // "bear-a-enc_a.webm", |
+ // kWebMAudioOnly, |
+ // "com.widevine", |
+ // MSE, |
+ // Unprefixed, |
+ // kNoSessionToLoad, |
+ // false, |
+ // kEmeNotSupportedError); |
+} |
#endif // defined(WIDEVINE_CDM_AVAILABLE) |
#if defined(ENABLE_PEPPER_CDMS) |
@@ -517,6 +588,7 @@ IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { |
kWebMVideoOnly, |
kExternalClearKeyKeySystem, |
SRC, |
+ Prefixed, |
kLoadableSession, |
false, |
kEnded); |
@@ -529,6 +601,7 @@ IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { |
kWebMVideoOnly, |
kExternalClearKeyKeySystem, |
SRC, |
+ Prefixed, |
kUnknownSession, |
false, |
kEmeKeyError); |