Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
| 10 #include "chrome/browser/media/media_browsertest.h" | 10 #include "chrome/browser/media/media_browsertest.h" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 #elif defined(OS_WIN) | 28 #elif defined(OS_WIN) |
| 29 "clearkeycdmadapter.dll"; | 29 "clearkeycdmadapter.dll"; |
| 30 #elif defined(OS_POSIX) | 30 #elif defined(OS_POSIX) |
| 31 "libclearkeycdmadapter.so"; | 31 "libclearkeycdmadapter.so"; |
| 32 #endif | 32 #endif |
| 33 | 33 |
| 34 const char kClearKeyCdmPluginMimeType[] = "application/x-ppapi-clearkey-cdm"; | 34 const char kClearKeyCdmPluginMimeType[] = "application/x-ppapi-clearkey-cdm"; |
| 35 #endif // defined(ENABLE_PEPPER_CDMS) | 35 #endif // defined(ENABLE_PEPPER_CDMS) |
| 36 | 36 |
| 37 // Available key systems. | 37 // Available key systems. |
| 38 const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey"; | 38 const char kClearKeyKeySystem[] = "org.w3.clearkey"; |
| 39 const char kPrefixedClearKeyKeySystem[] = "webkit-org.w3.clearkey"; | |
| 39 const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; | 40 const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; |
| 40 const char kExternalClearKeyDecryptOnlyKeySystem[] = | 41 const char kExternalClearKeyDecryptOnlyKeySystem[] = |
| 41 "org.chromium.externalclearkey.decryptonly"; | 42 "org.chromium.externalclearkey.decryptonly"; |
| 42 const char kExternalClearKeyFileIOTestKeySystem[] = | 43 const char kExternalClearKeyFileIOTestKeySystem[] = |
| 43 "org.chromium.externalclearkey.fileiotest"; | 44 "org.chromium.externalclearkey.fileiotest"; |
| 44 const char kExternalClearKeyInitializeFailKeySystem[] = | 45 const char kExternalClearKeyInitializeFailKeySystem[] = |
| 45 "org.chromium.externalclearkey.initializefail"; | 46 "org.chromium.externalclearkey.initializefail"; |
| 46 const char kExternalClearKeyCrashKeySystem[] = | 47 const char kExternalClearKeyCrashKeySystem[] = |
| 47 "org.chromium.externalclearkey.crash"; | 48 "org.chromium.externalclearkey.crash"; |
| 48 | 49 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 64 const char kEmeKeyError[] = "KEYERROR"; | 65 const char kEmeKeyError[] = "KEYERROR"; |
| 65 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR"; | 66 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR"; |
| 66 const char kFileIOTestSuccess[] = "FILEIOTESTSUCCESS"; | 67 const char kFileIOTestSuccess[] = "FILEIOTESTSUCCESS"; |
| 67 | 68 |
| 68 // The type of video src used to load media. | 69 // The type of video src used to load media. |
| 69 enum SrcType { | 70 enum SrcType { |
| 70 SRC, | 71 SRC, |
| 71 MSE | 72 MSE |
| 72 }; | 73 }; |
| 73 | 74 |
| 75 // Whether to use prefixed or unprefixed EME. | |
| 76 enum EMEVersion { | |
| 77 Prefixed, | |
| 78 Unprefixed | |
| 79 }; | |
| 80 | |
| 74 // MSE is available on all desktop platforms and on Android 4.1 and later. | 81 // MSE is available on all desktop platforms and on Android 4.1 and later. |
| 75 static bool IsMSESupported() { | 82 static bool IsMSESupported() { |
| 76 #if defined(OS_ANDROID) | 83 #if defined(OS_ANDROID) |
| 77 if (base::android::BuildInfo::GetInstance()->sdk_int() < 16) { | 84 if (base::android::BuildInfo::GetInstance()->sdk_int() < 16) { |
| 78 VLOG(0) << "MSE is only supported in Android 4.1 and later."; | 85 VLOG(0) << "MSE is only supported in Android 4.1 and later."; |
| 79 return false; | 86 return false; |
| 80 } | 87 } |
| 81 #endif // defined(OS_ANDROID) | 88 #endif // defined(OS_ANDROID) |
| 82 return true; | 89 return true; |
| 83 } | 90 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 // and trying to update it with licenses. | 125 // and trying to update it with licenses. |
| 119 // When |force_invalid_response| is true, the test will provide invalid | 126 // When |force_invalid_response| is true, the test will provide invalid |
| 120 // responses, which should trigger errors. | 127 // responses, which should trigger errors. |
| 121 // TODO(xhwang): Find an easier way to pass multiple configuration test | 128 // TODO(xhwang): Find an easier way to pass multiple configuration test |
| 122 // options. | 129 // options. |
| 123 void RunEncryptedMediaTest(const std::string& html_page, | 130 void RunEncryptedMediaTest(const std::string& html_page, |
| 124 const std::string& media_file, | 131 const std::string& media_file, |
| 125 const std::string& media_type, | 132 const std::string& media_type, |
| 126 const std::string& key_system, | 133 const std::string& key_system, |
| 127 SrcType src_type, | 134 SrcType src_type, |
| 135 EMEVersion eme_version, | |
| 128 const std::string& session_to_load, | 136 const std::string& session_to_load, |
| 129 bool force_invalid_response, | 137 bool force_invalid_response, |
| 130 const std::string& expected_title) { | 138 const std::string& expected_title) { |
| 131 if (src_type == MSE && !IsMSESupported()) { | 139 if (src_type == MSE && !IsMSESupported()) { |
| 132 VLOG(0) << "Skipping test - MSE not supported."; | 140 VLOG(0) << "Skipping test - MSE not supported."; |
| 133 return; | 141 return; |
| 134 } | 142 } |
| 135 std::vector<StringPair> query_params; | 143 std::vector<StringPair> query_params; |
| 136 query_params.push_back(std::make_pair("mediaFile", media_file)); | 144 query_params.push_back(std::make_pair("mediaFile", media_file)); |
| 137 query_params.push_back(std::make_pair("mediaType", media_type)); | 145 query_params.push_back(std::make_pair("mediaType", media_type)); |
| 138 query_params.push_back(std::make_pair("keySystem", key_system)); | 146 query_params.push_back(std::make_pair("keySystem", key_system)); |
| 139 if (src_type == MSE) | 147 if (src_type == MSE) |
| 140 query_params.push_back(std::make_pair("useMSE", "1")); | 148 query_params.push_back(std::make_pair("useMSE", "1")); |
| 149 if (eme_version == Prefixed) | |
| 150 query_params.push_back(std::make_pair("usePrefixedEME", "1")); | |
| 141 if (force_invalid_response) | 151 if (force_invalid_response) |
| 142 query_params.push_back(std::make_pair("forceInvalidResponse", "1")); | 152 query_params.push_back(std::make_pair("forceInvalidResponse", "1")); |
| 143 if (!session_to_load.empty()) | 153 if (!session_to_load.empty()) |
| 144 query_params.push_back(std::make_pair("sessionToLoad", session_to_load)); | 154 query_params.push_back(std::make_pair("sessionToLoad", session_to_load)); |
| 145 RunEncryptedMediaTestPage(html_page, key_system, &query_params, | 155 RunEncryptedMediaTestPage(html_page, key_system, &query_params, |
| 146 expected_title); | 156 expected_title); |
| 147 } | 157 } |
| 148 | 158 |
| 149 void RunSimpleEncryptedMediaTest(const std::string& media_file, | 159 void RunSimpleEncryptedMediaTest(const std::string& media_file, |
| 150 const std::string& media_type, | 160 const std::string& media_type, |
| 151 const std::string& key_system, | 161 const std::string& key_system, |
| 152 SrcType src_type) { | 162 SrcType src_type, |
| 163 EMEVersion eme_version) { | |
| 153 std::string expected_title = kEnded; | 164 std::string expected_title = kEnded; |
| 154 if (!IsPlayBackPossible(key_system)) | 165 if (!IsPlayBackPossible(key_system)) |
| 155 expected_title = kEmeKeyError; | 166 expected_title = kEmeKeyError; |
| 156 | 167 |
| 157 RunEncryptedMediaTest("encrypted_media_player.html", media_file, media_type, | 168 RunEncryptedMediaTest("encrypted_media_player.html", |
| 158 key_system, src_type, kNoSessionToLoad, false, | 169 media_file, |
| 170 media_type, | |
| 171 key_system, | |
| 172 src_type, | |
| 173 eme_version, | |
| 174 kNoSessionToLoad, | |
| 175 false, | |
| 159 expected_title); | 176 expected_title); |
| 160 // Check KeyMessage received for all key systems. | 177 // Check KeyMessage received for all key systems. |
| 161 bool receivedKeyMessage = false; | 178 bool receivedKeyMessage = false; |
| 162 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 179 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
| 163 browser()->tab_strip_model()->GetActiveWebContents(), | 180 browser()->tab_strip_model()->GetActiveWebContents(), |
| 164 "window.domAutomationController.send(video.receivedKeyMessage);", | 181 "window.domAutomationController.send(video.receivedKeyMessage);", |
| 165 &receivedKeyMessage)); | 182 &receivedKeyMessage)); |
| 166 EXPECT_TRUE(receivedKeyMessage); | 183 EXPECT_TRUE(receivedKeyMessage); |
| 167 } | 184 } |
| 168 | 185 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 203 scoped_ptr<TestLicenseServer> license_server_; | 220 scoped_ptr<TestLicenseServer> license_server_; |
| 204 | 221 |
| 205 // We want to fail quickly when a test fails because an error is encountered. | 222 // We want to fail quickly when a test fails because an error is encountered. |
| 206 virtual void AddWaitForTitles(content::TitleWatcher* title_watcher) OVERRIDE { | 223 virtual void AddWaitForTitles(content::TitleWatcher* title_watcher) OVERRIDE { |
| 207 MediaBrowserTest::AddWaitForTitles(title_watcher); | 224 MediaBrowserTest::AddWaitForTitles(title_watcher); |
| 208 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeNotSupportedError)); | 225 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeNotSupportedError)); |
| 209 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeKeyError)); | 226 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeKeyError)); |
| 210 } | 227 } |
| 211 | 228 |
| 212 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 229 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 230 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
| |
| 213 #if defined(OS_ANDROID) | 231 #if defined(OS_ANDROID) |
| 214 command_line->AppendSwitch( | 232 command_line->AppendSwitch( |
| 215 switches::kDisableGestureRequirementForMediaPlayback); | 233 switches::kDisableGestureRequirementForMediaPlayback); |
| 216 #endif // defined(OS_ANDROID) | 234 #endif // defined(OS_ANDROID) |
| 217 } | 235 } |
| 218 | 236 |
| 219 void SetUpCommandLineForKeySystem(const std::string& key_system, | 237 void SetUpCommandLineForKeySystem(const std::string& key_system, |
| 220 CommandLine* command_line) { | 238 CommandLine* command_line) { |
| 221 if (GetServerConfig(key_system)) | 239 if (GetServerConfig(key_system)) |
| 222 // Since the web and license servers listen on different ports, we need to | 240 // Since the web and license servers listen on different ports, we need to |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 // kExternalClearKeyFileIOTestKeySystem is used to test file IO. | 305 // kExternalClearKeyFileIOTestKeySystem is used to test file IO. |
| 288 void TestNonPlaybackCases(const std::string& key_system, | 306 void TestNonPlaybackCases(const std::string& key_system, |
| 289 const std::string& expected_title) { | 307 const std::string& expected_title) { |
| 290 // Since we do not test playback, arbitrarily choose a test file and source | 308 // Since we do not test playback, arbitrarily choose a test file and source |
| 291 // type. | 309 // type. |
| 292 RunEncryptedMediaTest("encrypted_media_player.html", | 310 RunEncryptedMediaTest("encrypted_media_player.html", |
| 293 "bear-a-enc_a.webm", | 311 "bear-a-enc_a.webm", |
| 294 kWebMAudioOnly, | 312 kWebMAudioOnly, |
| 295 key_system, | 313 key_system, |
| 296 SRC, | 314 SRC, |
| 315 Prefixed, | |
| 297 kNoSessionToLoad, | 316 kNoSessionToLoad, |
| 298 false, | 317 false, |
| 299 expected_title); | 318 expected_title); |
| 300 } | 319 } |
| 301 | 320 |
| 302 protected: | 321 protected: |
| 303 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 322 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 304 EncryptedMediaTestBase::SetUpCommandLine(command_line); | 323 EncryptedMediaTestBase::SetUpCommandLine(command_line); |
| 305 SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, command_line); | 324 SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, command_line); |
| 306 } | 325 } |
| 307 }; | 326 }; |
| 308 | 327 |
| 309 #if defined(WIDEVINE_CDM_AVAILABLE) | 328 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 310 // Tests encrypted media playback using Widevine key system. | 329 // Tests encrypted media playback using Widevine key system. |
| 311 class WVEncryptedMediaTest : public EncryptedMediaTestBase { | 330 class WVEncryptedMediaTest : public EncryptedMediaTestBase { |
| 312 protected: | 331 protected: |
| 313 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 332 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 314 EncryptedMediaTestBase::SetUpCommandLine(command_line); | 333 EncryptedMediaTestBase::SetUpCommandLine(command_line); |
| 315 SetUpCommandLineForKeySystem(kWidevineKeySystem, command_line); | 334 SetUpCommandLineForKeySystem(kWidevineKeySystem, command_line); |
| 316 } | 335 } |
| 317 }; | 336 }; |
| 318 | 337 |
| 319 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 338 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
| 320 #endif // defined(ENABLE_PEPPER_CDMS) | 339 #endif // defined(ENABLE_PEPPER_CDMS) |
| 321 | 340 |
| 322 // Tests encrypted media playback with a combination of parameters: | 341 // Tests encrypted media playback with a combination of parameters: |
| 323 // - char*: Key system name. | 342 // - char*: Key system name. |
| 324 // - bool: True to load media using MSE, otherwise use src. | 343 // - bool: True to load media using MSE, otherwise use src. |
| 344 // - bool: True to use unprefixed EME, otherwise use prefixed EME. | |
| 325 // | 345 // |
| 326 // Note: Only parameterized (*_P) tests can be used. Non-parameterized (*_F) | 346 // Note: Only parameterized (*_P) tests can be used. Non-parameterized (*_F) |
| 327 // tests will crash at GetParam(). To add non-parameterized tests, use | 347 // tests will crash at GetParam(). To add non-parameterized tests, use |
| 328 // EncryptedMediaTestBase or one of its subclasses (e.g. WVEncryptedMediaTest). | 348 // EncryptedMediaTestBase or one of its subclasses (e.g. WVEncryptedMediaTest). |
| 329 class EncryptedMediaTest : public EncryptedMediaTestBase, | 349 class EncryptedMediaTest |
| 330 public testing::WithParamInterface<std::tr1::tuple<const char*, SrcType> > { | 350 : public EncryptedMediaTestBase, |
| 351 public testing::WithParamInterface< | |
| 352 std::tr1::tuple<const char*, SrcType, EMEVersion> > { | |
| 331 public: | 353 public: |
| 332 std::string CurrentKeySystem() { | 354 std::string CurrentKeySystem() { |
| 333 return std::tr1::get<0>(GetParam()); | 355 return std::tr1::get<0>(GetParam()); |
| 334 } | 356 } |
| 335 | 357 |
| 336 SrcType CurrentSourceType() { | 358 SrcType CurrentSourceType() { |
| 337 return std::tr1::get<1>(GetParam()); | 359 return std::tr1::get<1>(GetParam()); |
| 338 } | 360 } |
| 339 | 361 |
| 362 EMEVersion CurrentEMEVersion() { | |
| 363 return std::tr1::get<2>(GetParam()); | |
| 364 } | |
| 365 | |
| 340 void TestSimplePlayback(const std::string& encrypted_media, | 366 void TestSimplePlayback(const std::string& encrypted_media, |
| 341 const std::string& media_type) { | 367 const std::string& media_type) { |
| 342 RunSimpleEncryptedMediaTest( | 368 RunSimpleEncryptedMediaTest(encrypted_media, |
| 343 encrypted_media, media_type, CurrentKeySystem(), CurrentSourceType()); | 369 media_type, |
| 370 CurrentKeySystem(), | |
| 371 CurrentSourceType(), | |
| 372 CurrentEMEVersion()); | |
| 344 } | 373 } |
| 345 | 374 |
| 346 void RunInvalidResponseTest() { | 375 void RunInvalidResponseTest() { |
| 347 RunEncryptedMediaTest("encrypted_media_player.html", | 376 RunEncryptedMediaTest("encrypted_media_player.html", |
| 348 "bear-320x240-av-enc_av.webm", | 377 "bear-320x240-av-enc_av.webm", |
| 349 kWebMAudioVideo, | 378 kWebMAudioVideo, |
| 350 CurrentKeySystem(), | 379 CurrentKeySystem(), |
| 351 CurrentSourceType(), | 380 CurrentSourceType(), |
| 381 CurrentEMEVersion(), | |
| 352 kNoSessionToLoad, | 382 kNoSessionToLoad, |
| 353 true, | 383 true, |
| 354 kEmeKeyError); | 384 kEmeKeyError); |
| 355 } | 385 } |
| 356 | 386 |
| 357 void TestFrameSizeChange() { | 387 void TestFrameSizeChange() { |
| 358 RunEncryptedMediaTest("encrypted_frame_size_change.html", | 388 RunEncryptedMediaTest("encrypted_frame_size_change.html", |
| 359 "frame_size_change-av-enc-v.webm", | 389 "frame_size_change-av-enc-v.webm", |
| 360 kWebMAudioVideo, | 390 kWebMAudioVideo, |
| 361 CurrentKeySystem(), | 391 CurrentKeySystem(), |
| 362 CurrentSourceType(), | 392 CurrentSourceType(), |
| 393 CurrentEMEVersion(), | |
| 363 kNoSessionToLoad, | 394 kNoSessionToLoad, |
| 364 false, | 395 false, |
| 365 kEnded); | 396 kEnded); |
| 366 } | 397 } |
| 367 | 398 |
| 368 void TestConfigChange() { | 399 void TestConfigChange() { |
| 369 DCHECK(IsMSESupported()); | 400 DCHECK(IsMSESupported()); |
| 370 std::vector<StringPair> query_params; | 401 std::vector<StringPair> query_params; |
| 371 query_params.push_back(std::make_pair("keySystem", CurrentKeySystem())); | 402 query_params.push_back(std::make_pair("keySystem", CurrentKeySystem())); |
| 372 query_params.push_back(std::make_pair("runEncrypted", "1")); | 403 query_params.push_back(std::make_pair("runEncrypted", "1")); |
| 404 if (CurrentEMEVersion() == Prefixed) | |
| 405 query_params.push_back(std::make_pair("usePrefixedEME", "1")); | |
| 373 RunEncryptedMediaTestPage("mse_config_change.html", | 406 RunEncryptedMediaTestPage("mse_config_change.html", |
| 374 CurrentKeySystem(), | 407 CurrentKeySystem(), |
| 375 &query_params, | 408 &query_params, |
| 376 kEnded); | 409 kEnded); |
| 377 } | 410 } |
| 378 | 411 |
| 379 protected: | 412 protected: |
| 380 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 413 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 381 EncryptedMediaTestBase::SetUpCommandLine(command_line); | 414 EncryptedMediaTestBase::SetUpCommandLine(command_line); |
| 382 SetUpCommandLineForKeySystem(CurrentKeySystem(), command_line); | 415 SetUpCommandLineForKeySystem(CurrentKeySystem(), command_line); |
| 383 } | 416 } |
| 384 }; | 417 }; |
| 385 | 418 |
| 386 using ::testing::Combine; | 419 using ::testing::Combine; |
| 387 using ::testing::Values; | 420 using ::testing::Values; |
| 388 | 421 |
| 389 #if !defined(OS_ANDROID) | 422 #if !defined(OS_ANDROID) |
| 390 INSTANTIATE_TEST_CASE_P(SRC_ClearKey, EncryptedMediaTest, | 423 INSTANTIATE_TEST_CASE_P(SRC_ClearKey_Prefixed, |
| 391 Combine(Values(kClearKeyKeySystem), Values(SRC))); | 424 EncryptedMediaTest, |
| 425 Combine(Values(kPrefixedClearKeyKeySystem), | |
| 426 Values(SRC), | |
| 427 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.
| |
| 392 #endif // !defined(OS_ANDROID) | 428 #endif // !defined(OS_ANDROID) |
| 393 | 429 |
| 394 INSTANTIATE_TEST_CASE_P(MSE_ClearKey, EncryptedMediaTest, | 430 INSTANTIATE_TEST_CASE_P(MSE_ClearKey_Prefixed, |
| 395 Combine(Values(kClearKeyKeySystem), Values(MSE))); | 431 EncryptedMediaTest, |
| 432 Combine(Values(kPrefixedClearKeyKeySystem), | |
| 433 Values(MSE), | |
| 434 Values(Prefixed))); | |
| 435 INSTANTIATE_TEST_CASE_P(MSE_ClearKey, | |
| 436 EncryptedMediaTest, | |
| 437 Combine(Values(kClearKeyKeySystem), | |
| 438 Values(MSE), | |
| 439 Values(Unprefixed))); | |
| 396 | 440 |
| 397 // External Clear Key is currently only used on platforms that use Pepper CDMs. | 441 // External Clear Key is currently only used on platforms that use Pepper CDMs. |
| 398 #if defined(ENABLE_PEPPER_CDMS) | 442 #if defined(ENABLE_PEPPER_CDMS) |
| 399 INSTANTIATE_TEST_CASE_P(SRC_ExternalClearKey, EncryptedMediaTest, | 443 INSTANTIATE_TEST_CASE_P(SRC_ExternalClearKey, |
| 400 Combine(Values(kExternalClearKeyKeySystem), Values(SRC))); | 444 EncryptedMediaTest, |
| 401 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey, EncryptedMediaTest, | 445 Combine(Values(kExternalClearKeyKeySystem), |
| 402 Combine(Values(kExternalClearKeyKeySystem), Values(MSE))); | 446 Values(SRC), |
| 447 Values(Prefixed))); | |
| 448 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey, | |
| 449 EncryptedMediaTest, | |
| 450 Combine(Values(kExternalClearKeyKeySystem), | |
| 451 Values(MSE), | |
| 452 Values(Prefixed))); | |
| 403 // To reduce test time, only run ExternalClearKeyDecryptOnly with MSE. | 453 // To reduce test time, only run ExternalClearKeyDecryptOnly with MSE. |
| 404 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKeyDecryptOnly, EncryptedMediaTest, | 454 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKeyDecryptOnly, |
| 405 Combine(Values(kExternalClearKeyDecryptOnlyKeySystem), Values(MSE))); | 455 EncryptedMediaTest, |
| 456 Combine(Values(kExternalClearKeyDecryptOnlyKeySystem), | |
| 457 Values(MSE), | |
| 458 Values(Prefixed))); | |
| 406 #endif // defined(ENABLE_PEPPER_CDMS) | 459 #endif // defined(ENABLE_PEPPER_CDMS) |
| 407 | 460 |
| 408 #if defined(WIDEVINE_CDM_AVAILABLE) | 461 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 409 // This test doesn't fully test playback with Widevine. So we only run Widevine | 462 // This test doesn't fully test playback with Widevine. So we only run Widevine |
| 410 // test with MSE (no SRC) to reduce test time. Also, on Android EME only works | 463 // test with MSE (no SRC) to reduce test time. Also, on Android EME only works |
| 411 // with MSE and we cannot run this test with SRC. | 464 // with MSE and we cannot run this test with SRC. |
| 412 INSTANTIATE_TEST_CASE_P(MSE_Widevine, EncryptedMediaTest, | 465 INSTANTIATE_TEST_CASE_P(MSE_Widevine, |
| 413 Combine(Values(kWidevineKeySystem), Values(MSE))); | 466 EncryptedMediaTest, |
| 467 Combine(Values(kWidevineKeySystem), | |
| 468 Values(MSE), | |
| 469 Values(Prefixed))); | |
| 414 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 470 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
| 415 | 471 |
| 416 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) { | 472 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) { |
| 417 TestSimplePlayback("bear-a-enc_a.webm", kWebMAudioOnly); | 473 TestSimplePlayback("bear-a-enc_a.webm", kWebMAudioOnly); |
| 418 } | 474 } |
| 419 | 475 |
| 420 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioClearVideo_WebM) { | 476 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioClearVideo_WebM) { |
| 421 TestSimplePlayback("bear-320x240-av-enc_a.webm", kWebMAudioVideo); | 477 TestSimplePlayback("bear-320x240-av-enc_a.webm", kWebMAudioVideo); |
| 422 } | 478 } |
| 423 | 479 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 477 if (CurrentSourceType() != MSE) { | 533 if (CurrentSourceType() != MSE) { |
| 478 VLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; | 534 VLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; |
| 479 return; | 535 return; |
| 480 } | 536 } |
| 481 TestSimplePlayback("bear-640x360-a_frag-cenc.mp4", kMP4AudioOnly); | 537 TestSimplePlayback("bear-640x360-a_frag-cenc.mp4", kMP4AudioOnly); |
| 482 } | 538 } |
| 483 #endif // defined(USE_PROPRIETARY_CODECS) | 539 #endif // defined(USE_PROPRIETARY_CODECS) |
| 484 | 540 |
| 485 #if defined(WIDEVINE_CDM_AVAILABLE) | 541 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 486 // The parent key system cannot be used in generateKeyRequest. | 542 // The parent key system cannot be used in generateKeyRequest. |
| 487 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException) { | 543 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsExceptionPrefixed) { |
|
ddorwin
2014/03/05 19:04:36
_Prefixed
jrummell
2014/03/05 23:13:23
Done.
| |
| 488 RunEncryptedMediaTest("encrypted_media_player.html", | 544 RunEncryptedMediaTest("encrypted_media_player.html", |
| 489 "bear-a-enc_a.webm", | 545 "bear-a-enc_a.webm", |
| 490 kWebMAudioOnly, | 546 kWebMAudioOnly, |
| 491 "com.widevine", | 547 "com.widevine", |
| 492 MSE, | 548 MSE, |
| 549 Prefixed, | |
| 493 kNoSessionToLoad, | 550 kNoSessionToLoad, |
| 494 false, | 551 false, |
| 495 kEmeNotSupportedError); | 552 kEmeNotSupportedError); |
| 496 } | 553 } |
| 554 | |
| 555 // The parent key system cannot be used when creating MediaKeys. | |
| 556 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException) { | |
| 557 // 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.
| |
| 558 // RunEncryptedMediaTest("encrypted_media_player.html", | |
| 559 // "bear-a-enc_a.webm", | |
| 560 // kWebMAudioOnly, | |
| 561 // "com.widevine", | |
| 562 // MSE, | |
| 563 // Unprefixed, | |
| 564 // kNoSessionToLoad, | |
| 565 // false, | |
| 566 // kEmeNotSupportedError); | |
| 567 } | |
| 497 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 568 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
| 498 | 569 |
| 499 #if defined(ENABLE_PEPPER_CDMS) | 570 #if defined(ENABLE_PEPPER_CDMS) |
| 500 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, InitializeCDMFail) { | 571 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, InitializeCDMFail) { |
| 501 TestNonPlaybackCases(kExternalClearKeyInitializeFailKeySystem, kEmeKeyError); | 572 TestNonPlaybackCases(kExternalClearKeyInitializeFailKeySystem, kEmeKeyError); |
| 502 } | 573 } |
| 503 | 574 |
| 504 // When CDM crashes, we should still get a decode error. | 575 // When CDM crashes, we should still get a decode error. |
| 505 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, CDMCrashDuringDecode) { | 576 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, CDMCrashDuringDecode) { |
| 506 TestNonPlaybackCases(kExternalClearKeyCrashKeySystem, kError); | 577 TestNonPlaybackCases(kExternalClearKeyCrashKeySystem, kError); |
| 507 } | 578 } |
| 508 | 579 |
| 509 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, FileIOTest) { | 580 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, FileIOTest) { |
| 510 TestNonPlaybackCases(kExternalClearKeyFileIOTestKeySystem, | 581 TestNonPlaybackCases(kExternalClearKeyFileIOTestKeySystem, |
| 511 kFileIOTestSuccess); | 582 kFileIOTestSuccess); |
| 512 } | 583 } |
| 513 | 584 |
| 514 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { | 585 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { |
| 515 RunEncryptedMediaTest("encrypted_media_player.html", | 586 RunEncryptedMediaTest("encrypted_media_player.html", |
| 516 "bear-320x240-v-enc_v.webm", | 587 "bear-320x240-v-enc_v.webm", |
| 517 kWebMVideoOnly, | 588 kWebMVideoOnly, |
| 518 kExternalClearKeyKeySystem, | 589 kExternalClearKeyKeySystem, |
| 519 SRC, | 590 SRC, |
| 591 Prefixed, | |
| 520 kLoadableSession, | 592 kLoadableSession, |
| 521 false, | 593 false, |
| 522 kEnded); | 594 kEnded); |
| 523 } | 595 } |
| 524 | 596 |
| 525 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { | 597 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { |
| 526 // TODO(xhwang): Add a specific error for this failure, e.g. kSessionNotFound. | 598 // TODO(xhwang): Add a specific error for this failure, e.g. kSessionNotFound. |
| 527 RunEncryptedMediaTest("encrypted_media_player.html", | 599 RunEncryptedMediaTest("encrypted_media_player.html", |
| 528 "bear-320x240-v-enc_v.webm", | 600 "bear-320x240-v-enc_v.webm", |
| 529 kWebMVideoOnly, | 601 kWebMVideoOnly, |
| 530 kExternalClearKeyKeySystem, | 602 kExternalClearKeyKeySystem, |
| 531 SRC, | 603 SRC, |
| 604 Prefixed, | |
| 532 kUnknownSession, | 605 kUnknownSession, |
| 533 false, | 606 false, |
| 534 kEmeKeyError); | 607 kEmeKeyError); |
| 535 } | 608 } |
| 536 #endif // defined(ENABLE_PEPPER_CDMS) | 609 #endif // defined(ENABLE_PEPPER_CDMS) |
| OLD | NEW |