| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 // kExternalClearKeyFileIOTestKeySystem is used to test file IO. | 304 // kExternalClearKeyFileIOTestKeySystem is used to test file IO. |
| 288 void TestNonPlaybackCases(const std::string& key_system, | 305 void TestNonPlaybackCases(const std::string& key_system, |
| 289 const std::string& expected_title) { | 306 const std::string& expected_title) { |
| 290 // Since we do not test playback, arbitrarily choose a test file and source | 307 // Since we do not test playback, arbitrarily choose a test file and source |
| 291 // type. | 308 // type. |
| 292 RunEncryptedMediaTest("encrypted_media_player.html", | 309 RunEncryptedMediaTest("encrypted_media_player.html", |
| 293 "bear-a-enc_a.webm", | 310 "bear-a-enc_a.webm", |
| 294 kWebMAudioOnly, | 311 kWebMAudioOnly, |
| 295 key_system, | 312 key_system, |
| 296 SRC, | 313 SRC, |
| 314 PREFIXED, |
| 297 kNoSessionToLoad, | 315 kNoSessionToLoad, |
| 298 false, | 316 false, |
| 299 expected_title); | 317 expected_title); |
| 300 } | 318 } |
| 301 | 319 |
| 302 protected: | 320 protected: |
| 303 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 321 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 304 EncryptedMediaTestBase::SetUpCommandLine(command_line); | 322 EncryptedMediaTestBase::SetUpCommandLine(command_line); |
| 305 SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, command_line); | 323 SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, command_line); |
| 306 } | 324 } |
| 307 }; | 325 }; |
| 308 | 326 |
| 309 #if defined(WIDEVINE_CDM_AVAILABLE) | 327 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 310 // Tests encrypted media playback using Widevine key system. | 328 // Tests encrypted media playback using Widevine key system. |
| 311 class WVEncryptedMediaTest : public EncryptedMediaTestBase { | 329 class WVEncryptedMediaTest : public EncryptedMediaTestBase { |
| 312 protected: | 330 protected: |
| 313 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 331 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 314 EncryptedMediaTestBase::SetUpCommandLine(command_line); | 332 EncryptedMediaTestBase::SetUpCommandLine(command_line); |
| 333 command_line->AppendSwitch(switches::kEnableEncryptedMedia); |
| 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); |
| 416 |
| 417 if (CurrentEmeVersion() == UNPREFIXED) |
| 418 command_line->AppendSwitch(switches::kEnableEncryptedMedia); |
| 383 } | 419 } |
| 384 }; | 420 }; |
| 385 | 421 |
| 386 using ::testing::Combine; | 422 using ::testing::Combine; |
| 387 using ::testing::Values; | 423 using ::testing::Values; |
| 388 | 424 |
| 389 #if !defined(OS_ANDROID) | 425 #if !defined(OS_ANDROID) |
| 390 INSTANTIATE_TEST_CASE_P(SRC_ClearKey, EncryptedMediaTest, | 426 INSTANTIATE_TEST_CASE_P(SRC_ClearKey_Prefixed, |
| 391 Combine(Values(kClearKeyKeySystem), Values(SRC))); | 427 EncryptedMediaTest, |
| 428 Combine(Values(kPrefixedClearKeyKeySystem), |
| 429 Values(SRC), |
| 430 Values(PREFIXED))); |
| 431 |
| 432 // TODO(jrummell): Enable unprefixed tests before shipping unprefixed EME. |
| 433 // Disabled now as they don't provide much additional coverage, but do take a |
| 434 // bit of time to execute. |
| 435 INSTANTIATE_TEST_CASE_P(DISABLED_SRC_ClearKey, |
| 436 EncryptedMediaTest, |
| 437 Combine(Values(kClearKeyKeySystem), |
| 438 Values(SRC), |
| 439 Values(UNPREFIXED))); |
| 392 #endif // !defined(OS_ANDROID) | 440 #endif // !defined(OS_ANDROID) |
| 393 | 441 |
| 394 INSTANTIATE_TEST_CASE_P(MSE_ClearKey, EncryptedMediaTest, | 442 INSTANTIATE_TEST_CASE_P(MSE_ClearKey_Prefixed, |
| 395 Combine(Values(kClearKeyKeySystem), Values(MSE))); | 443 EncryptedMediaTest, |
| 444 Combine(Values(kPrefixedClearKeyKeySystem), |
| 445 Values(MSE), |
| 446 Values(PREFIXED))); |
| 447 INSTANTIATE_TEST_CASE_P(MSE_ClearKey, |
| 448 EncryptedMediaTest, |
| 449 Combine(Values(kClearKeyKeySystem), |
| 450 Values(MSE), |
| 451 Values(UNPREFIXED))); |
| 396 | 452 |
| 397 // External Clear Key is currently only used on platforms that use Pepper CDMs. | 453 // External Clear Key is currently only used on platforms that use Pepper CDMs. |
| 398 #if defined(ENABLE_PEPPER_CDMS) | 454 #if defined(ENABLE_PEPPER_CDMS) |
| 399 INSTANTIATE_TEST_CASE_P(SRC_ExternalClearKey, EncryptedMediaTest, | 455 INSTANTIATE_TEST_CASE_P(SRC_ExternalClearKey_Prefixed, |
| 400 Combine(Values(kExternalClearKeyKeySystem), Values(SRC))); | 456 EncryptedMediaTest, |
| 401 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey, EncryptedMediaTest, | 457 Combine(Values(kExternalClearKeyKeySystem), |
| 402 Combine(Values(kExternalClearKeyKeySystem), Values(MSE))); | 458 Values(SRC), |
| 459 Values(PREFIXED))); |
| 460 // TODO(jrummell): Enable unprefixed tests once the CDM can be loaded using |
| 461 // MediaKeys. |
| 462 INSTANTIATE_TEST_CASE_P(DISABLED_SRC_ExternalClearKey, |
| 463 EncryptedMediaTest, |
| 464 Combine(Values(kExternalClearKeyKeySystem), |
| 465 Values(SRC), |
| 466 Values(UNPREFIXED))); |
| 467 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey_Prefixed, |
| 468 EncryptedMediaTest, |
| 469 Combine(Values(kExternalClearKeyKeySystem), |
| 470 Values(MSE), |
| 471 Values(PREFIXED))); |
| 472 // TODO(jrummell): Enable unprefixed tests once the CDM can be loaded using |
| 473 // MediaKeys. |
| 474 INSTANTIATE_TEST_CASE_P(DISABLED_MSE_ExternalClearKey, |
| 475 EncryptedMediaTest, |
| 476 Combine(Values(kExternalClearKeyKeySystem), |
| 477 Values(MSE), |
| 478 Values(UNPREFIXED))); |
| 403 // To reduce test time, only run ExternalClearKeyDecryptOnly with MSE. | 479 // To reduce test time, only run ExternalClearKeyDecryptOnly with MSE. |
| 404 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKeyDecryptOnly, EncryptedMediaTest, | 480 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKeyDecryptOnly_Prefixed, |
| 405 Combine(Values(kExternalClearKeyDecryptOnlyKeySystem), Values(MSE))); | 481 EncryptedMediaTest, |
| 482 Combine(Values(kExternalClearKeyDecryptOnlyKeySystem), |
| 483 Values(MSE), |
| 484 Values(PREFIXED))); |
| 485 // TODO(jrummell): Enable unprefixed tests once the CDM can be loaded using |
| 486 // MediaKeys. |
| 487 INSTANTIATE_TEST_CASE_P(DISABLED_MSE_ExternalClearKeyDecryptOnly, |
| 488 EncryptedMediaTest, |
| 489 Combine(Values(kExternalClearKeyDecryptOnlyKeySystem), |
| 490 Values(MSE), |
| 491 Values(UNPREFIXED))); |
| 406 #endif // defined(ENABLE_PEPPER_CDMS) | 492 #endif // defined(ENABLE_PEPPER_CDMS) |
| 407 | 493 |
| 408 #if defined(WIDEVINE_CDM_AVAILABLE) | 494 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 409 // This test doesn't fully test playback with Widevine. So we only run Widevine | 495 // 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 | 496 // 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. | 497 // with MSE and we cannot run this test with SRC. |
| 412 INSTANTIATE_TEST_CASE_P(MSE_Widevine, EncryptedMediaTest, | 498 INSTANTIATE_TEST_CASE_P(MSE_Widevine_Prefixed, |
| 413 Combine(Values(kWidevineKeySystem), Values(MSE))); | 499 EncryptedMediaTest, |
| 500 Combine(Values(kWidevineKeySystem), |
| 501 Values(MSE), |
| 502 Values(PREFIXED))); |
| 503 // TODO(jrummell): Enable unprefixed tests once the CDM can be loaded using |
| 504 // MediaKeys. |
| 505 INSTANTIATE_TEST_CASE_P(DISABLED_MSE_Widevine, |
| 506 EncryptedMediaTest, |
| 507 Combine(Values(kWidevineKeySystem), |
| 508 Values(MSE), |
| 509 Values(UNPREFIXED))); |
| 414 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 510 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
| 415 | 511 |
| 416 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) { | 512 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) { |
| 417 #if defined(WIDEVINE_CDM_AVAILABLE) | 513 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 418 if (IsWidevine(CurrentKeySystem())) { | 514 if (IsWidevine(CurrentKeySystem())) { |
| 419 VLOG(0) << "Test disabled on Widevine key system, crbug.com/349526."; | 515 VLOG(0) << "Test disabled on Widevine key system, crbug.com/349526."; |
| 420 return; | 516 return; |
| 421 } | 517 } |
| 422 #endif | 518 #endif |
| 423 TestSimplePlayback("bear-a-enc_a.webm", kWebMAudioOnly); | 519 TestSimplePlayback("bear-a-enc_a.webm", kWebMAudioOnly); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 if (CurrentSourceType() != MSE) { | 585 if (CurrentSourceType() != MSE) { |
| 490 VLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; | 586 VLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; |
| 491 return; | 587 return; |
| 492 } | 588 } |
| 493 TestSimplePlayback("bear-640x360-a_frag-cenc.mp4", kMP4AudioOnly); | 589 TestSimplePlayback("bear-640x360-a_frag-cenc.mp4", kMP4AudioOnly); |
| 494 } | 590 } |
| 495 #endif // defined(USE_PROPRIETARY_CODECS) | 591 #endif // defined(USE_PROPRIETARY_CODECS) |
| 496 | 592 |
| 497 #if defined(WIDEVINE_CDM_AVAILABLE) | 593 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 498 // The parent key system cannot be used in generateKeyRequest. | 594 // The parent key system cannot be used in generateKeyRequest. |
| 499 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException) { | 595 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException_Prefixed) { |
| 500 RunEncryptedMediaTest("encrypted_media_player.html", | 596 RunEncryptedMediaTest("encrypted_media_player.html", |
| 501 "bear-a-enc_a.webm", | 597 "bear-a-enc_a.webm", |
| 502 kWebMAudioOnly, | 598 kWebMAudioOnly, |
| 503 "com.widevine", | 599 "com.widevine", |
| 504 MSE, | 600 MSE, |
| 601 PREFIXED, |
| 505 kNoSessionToLoad, | 602 kNoSessionToLoad, |
| 506 false, | 603 false, |
| 507 kEmeNotSupportedError); | 604 kEmeNotSupportedError); |
| 605 } |
| 606 |
| 607 // TODO(jrummell): http://crbug.com/349181 |
| 608 // The parent key system cannot be used when creating MediaKeys. |
| 609 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, DISABLED_ParentThrowsException) { |
| 610 RunEncryptedMediaTest("encrypted_media_player.html", |
| 611 "bear-a-enc_a.webm", |
| 612 kWebMAudioOnly, |
| 613 "com.widevine", |
| 614 MSE, |
| 615 UNPREFIXED, |
| 616 kNoSessionToLoad, |
| 617 false, |
| 618 kEmeNotSupportedError); |
| 508 } | 619 } |
| 509 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 620 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
| 510 | 621 |
| 511 #if defined(ENABLE_PEPPER_CDMS) | 622 #if defined(ENABLE_PEPPER_CDMS) |
| 512 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, InitializeCDMFail) { | 623 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, InitializeCDMFail) { |
| 513 TestNonPlaybackCases(kExternalClearKeyInitializeFailKeySystem, kEmeKeyError); | 624 TestNonPlaybackCases(kExternalClearKeyInitializeFailKeySystem, kEmeKeyError); |
| 514 } | 625 } |
| 515 | 626 |
| 516 // When CDM crashes, we should still get a decode error. | 627 // When CDM crashes, we should still get a decode error. |
| 517 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, CDMCrashDuringDecode) { | 628 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, CDMCrashDuringDecode) { |
| 518 TestNonPlaybackCases(kExternalClearKeyCrashKeySystem, kError); | 629 TestNonPlaybackCases(kExternalClearKeyCrashKeySystem, kError); |
| 519 } | 630 } |
| 520 | 631 |
| 521 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, FileIOTest) { | 632 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, FileIOTest) { |
| 522 TestNonPlaybackCases(kExternalClearKeyFileIOTestKeySystem, | 633 TestNonPlaybackCases(kExternalClearKeyFileIOTestKeySystem, |
| 523 kFileIOTestSuccess); | 634 kFileIOTestSuccess); |
| 524 } | 635 } |
| 525 | 636 |
| 526 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { | 637 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { |
| 527 RunEncryptedMediaTest("encrypted_media_player.html", | 638 RunEncryptedMediaTest("encrypted_media_player.html", |
| 528 "bear-320x240-v-enc_v.webm", | 639 "bear-320x240-v-enc_v.webm", |
| 529 kWebMVideoOnly, | 640 kWebMVideoOnly, |
| 530 kExternalClearKeyKeySystem, | 641 kExternalClearKeyKeySystem, |
| 531 SRC, | 642 SRC, |
| 643 PREFIXED, |
| 532 kLoadableSession, | 644 kLoadableSession, |
| 533 false, | 645 false, |
| 534 kEnded); | 646 kEnded); |
| 535 } | 647 } |
| 536 | 648 |
| 537 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { | 649 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { |
| 538 // TODO(xhwang): Add a specific error for this failure, e.g. kSessionNotFound. | 650 // TODO(xhwang): Add a specific error for this failure, e.g. kSessionNotFound. |
| 539 RunEncryptedMediaTest("encrypted_media_player.html", | 651 RunEncryptedMediaTest("encrypted_media_player.html", |
| 540 "bear-320x240-v-enc_v.webm", | 652 "bear-320x240-v-enc_v.webm", |
| 541 kWebMVideoOnly, | 653 kWebMVideoOnly, |
| 542 kExternalClearKeyKeySystem, | 654 kExternalClearKeyKeySystem, |
| 543 SRC, | 655 SRC, |
| 656 PREFIXED, |
| 544 kUnknownSession, | 657 kUnknownSession, |
| 545 false, | 658 false, |
| 546 kEmeKeyError); | 659 kEmeKeyError); |
| 547 } | 660 } |
| 548 #endif // defined(ENABLE_PEPPER_CDMS) | 661 #endif // defined(ENABLE_PEPPER_CDMS) |
| OLD | NEW |