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 <utility> | 5 #include <utility> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 23 matching lines...) Expand all Loading... | |
34 "clearkeycdmadapter.dll"; | 34 "clearkeycdmadapter.dll"; |
35 #elif defined(OS_POSIX) | 35 #elif defined(OS_POSIX) |
36 "libclearkeycdmadapter.so"; | 36 "libclearkeycdmadapter.so"; |
37 #endif | 37 #endif |
38 | 38 |
39 const char kClearKeyCdmPluginMimeType[] = "application/x-ppapi-clearkey-cdm"; | 39 const char kClearKeyCdmPluginMimeType[] = "application/x-ppapi-clearkey-cdm"; |
40 #endif // defined(ENABLE_PEPPER_CDMS) | 40 #endif // defined(ENABLE_PEPPER_CDMS) |
41 | 41 |
42 // Available key systems. | 42 // Available key systems. |
43 const char kClearKeyKeySystem[] = "org.w3.clearkey"; | 43 const char kClearKeyKeySystem[] = "org.w3.clearkey"; |
44 const char kPrefixedClearKeyKeySystem[] = "webkit-org.w3.clearkey"; | |
45 const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; | 44 const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; |
46 const char kExternalClearKeyFileIOTestKeySystem[] = | 45 const char kExternalClearKeyFileIOTestKeySystem[] = |
47 "org.chromium.externalclearkey.fileiotest"; | 46 "org.chromium.externalclearkey.fileiotest"; |
48 const char kExternalClearKeyInitializeFailKeySystem[] = | 47 const char kExternalClearKeyInitializeFailKeySystem[] = |
49 "org.chromium.externalclearkey.initializefail"; | 48 "org.chromium.externalclearkey.initializefail"; |
50 const char kExternalClearKeyCrashKeySystem[] = | 49 const char kExternalClearKeyCrashKeySystem[] = |
51 "org.chromium.externalclearkey.crash"; | 50 "org.chromium.externalclearkey.crash"; |
52 | 51 |
53 // Supported media types. | 52 // Supported media types. |
54 const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\""; | 53 const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\""; |
(...skipping 12 matching lines...) Expand all Loading... | |
67 | 66 |
68 // EME-specific test results and errors. | 67 // EME-specific test results and errors. |
69 const char kFileIOTestSuccess[] = "FILE_IO_TEST_SUCCESS"; | 68 const char kFileIOTestSuccess[] = "FILE_IO_TEST_SUCCESS"; |
70 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR"; | 69 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR"; |
71 const char kEmeGenerateRequestFailed[] = "EME_GENERATEREQUEST_FAILED"; | 70 const char kEmeGenerateRequestFailed[] = "EME_GENERATEREQUEST_FAILED"; |
72 const char kEmeSessionNotFound[] = "EME_SESSION_NOT_FOUND"; | 71 const char kEmeSessionNotFound[] = "EME_SESSION_NOT_FOUND"; |
73 const char kEmeLoadFailed[] = "EME_LOAD_FAILED"; | 72 const char kEmeLoadFailed[] = "EME_LOAD_FAILED"; |
74 const char kEmeUpdateFailed[] = "EME_UPDATE_FAILED"; | 73 const char kEmeUpdateFailed[] = "EME_UPDATE_FAILED"; |
75 const char kEmeErrorEvent[] = "EME_ERROR_EVENT"; | 74 const char kEmeErrorEvent[] = "EME_ERROR_EVENT"; |
76 const char kEmeMessageUnexpectedType[] = "EME_MESSAGE_UNEXPECTED_TYPE"; | 75 const char kEmeMessageUnexpectedType[] = "EME_MESSAGE_UNEXPECTED_TYPE"; |
77 const char kPrefixedEmeRenewalMissingHeader[] = | |
78 "PREFIXED_EME_RENEWAL_MISSING_HEADER"; | |
79 const char kPrefixedEmeErrorEvent[] = "PREFIXED_EME_ERROR_EVENT"; | |
80 | 76 |
81 const char kDefaultEmePlayer[] = "eme_player.html"; | 77 const char kDefaultEmePlayer[] = "eme_player.html"; |
82 | 78 |
83 // The type of video src used to load media. | 79 // The type of video src used to load media. |
84 enum SrcType { | 80 enum SrcType { |
85 SRC, | 81 SRC, |
86 MSE | 82 MSE |
87 }; | 83 }; |
88 | 84 |
85 // TODO(ddorwin): Remove this from the tests as well as PREFIXED_EME_ERROR_EVENT | |
86 // and PREFIXED_EME_RENEWAL_MISSING_HEADER from the tests. | |
89 // Whether to use prefixed or unprefixed EME. | 87 // Whether to use prefixed or unprefixed EME. |
90 enum EmeVersion { | 88 enum EmeVersion { |
91 PREFIXED, | 89 PREFIXED, |
92 UNPREFIXED | 90 UNPREFIXED |
93 }; | 91 }; |
94 | 92 |
95 // Whether the video should be played once or twice. | 93 // Whether the video should be played once or twice. |
96 enum class PlayTwice { NO, YES }; | 94 enum class PlayTwice { NO, YES }; |
97 | 95 |
98 // Format of a container when testing different streams. | 96 // Format of a container when testing different streams. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 expected_title); | 184 expected_title); |
187 } | 185 } |
188 | 186 |
189 void RunSimpleEncryptedMediaTest(const std::string& media_file, | 187 void RunSimpleEncryptedMediaTest(const std::string& media_file, |
190 const std::string& media_type, | 188 const std::string& media_type, |
191 const std::string& key_system, | 189 const std::string& key_system, |
192 SrcType src_type, | 190 SrcType src_type, |
193 EmeVersion eme_version) { | 191 EmeVersion eme_version) { |
194 std::string expected_title = kEnded; | 192 std::string expected_title = kEnded; |
195 if (!IsPlayBackPossible(key_system)) { | 193 if (!IsPlayBackPossible(key_system)) { |
196 expected_title = (eme_version == EmeVersion::UNPREFIXED) | 194 expected_title = kEmeUpdateFailed; |
197 ? kEmeUpdateFailed | |
198 : kPrefixedEmeErrorEvent; | |
199 } | 195 } |
200 | 196 |
201 RunEncryptedMediaTest(kDefaultEmePlayer, media_file, media_type, key_system, | 197 RunEncryptedMediaTest(kDefaultEmePlayer, media_file, media_type, key_system, |
202 src_type, eme_version, kNoSessionToLoad, false, | 198 src_type, eme_version, kNoSessionToLoad, false, |
203 PlayTwice::NO, expected_title); | 199 PlayTwice::NO, expected_title); |
204 // Check KeyMessage received for all key systems. | 200 // Check KeyMessage received for all key systems. |
205 bool receivedKeyMessage = false; | 201 bool receivedKeyMessage = false; |
206 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 202 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
207 browser()->tab_strip_model()->GetActiveWebContents(), | 203 browser()->tab_strip_model()->GetActiveWebContents(), |
208 "window.domAutomationController.send(" | 204 "window.domAutomationController.send(" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
252 MediaBrowserTest::AddWaitForTitles(title_watcher); | 248 MediaBrowserTest::AddWaitForTitles(title_watcher); |
253 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeNotSupportedError)); | 249 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeNotSupportedError)); |
254 title_watcher->AlsoWaitForTitle( | 250 title_watcher->AlsoWaitForTitle( |
255 base::ASCIIToUTF16(kEmeGenerateRequestFailed)); | 251 base::ASCIIToUTF16(kEmeGenerateRequestFailed)); |
256 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeSessionNotFound)); | 252 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeSessionNotFound)); |
257 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeLoadFailed)); | 253 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeLoadFailed)); |
258 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeUpdateFailed)); | 254 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeUpdateFailed)); |
259 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeErrorEvent)); | 255 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeErrorEvent)); |
260 title_watcher->AlsoWaitForTitle( | 256 title_watcher->AlsoWaitForTitle( |
261 base::ASCIIToUTF16(kEmeMessageUnexpectedType)); | 257 base::ASCIIToUTF16(kEmeMessageUnexpectedType)); |
262 title_watcher->AlsoWaitForTitle( | |
263 base::ASCIIToUTF16(kPrefixedEmeRenewalMissingHeader)); | |
264 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kPrefixedEmeErrorEvent)); | |
265 } | 258 } |
266 | 259 |
267 void SetUpCommandLine(base::CommandLine* command_line) override { | 260 void SetUpCommandLine(base::CommandLine* command_line) override { |
268 command_line->AppendSwitch( | 261 command_line->AppendSwitch( |
269 switches::kDisableGestureRequirementForMediaPlayback); | 262 switches::kDisableGestureRequirementForMediaPlayback); |
270 // For simplicity with respect to parameterized tests, enable for all tests. | |
271 command_line->AppendSwitch(switches::kEnablePrefixedEncryptedMedia); | |
272 } | 263 } |
273 | 264 |
274 void SetUpCommandLineForKeySystem(const std::string& key_system, | 265 void SetUpCommandLineForKeySystem(const std::string& key_system, |
275 base::CommandLine* command_line) { | 266 base::CommandLine* command_line) { |
276 if (GetServerConfig(key_system)) | 267 if (GetServerConfig(key_system)) |
277 // Since the web and license servers listen on different ports, we need to | 268 // Since the web and license servers listen on different ports, we need to |
278 // disable web-security to send license requests to the license server. | 269 // disable web-security to send license requests to the license server. |
279 // TODO(shadi): Add port forwarding to the test web server configuration. | 270 // TODO(shadi): Add port forwarding to the test web server configuration. |
280 command_line->AppendSwitch(switches::kDisableWebSecurity); | 271 command_line->AppendSwitch(switches::kDisableWebSecurity); |
281 | 272 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
357 expected_title); | 348 expected_title); |
358 } | 349 } |
359 | 350 |
360 protected: | 351 protected: |
361 void SetUpCommandLine(base::CommandLine* command_line) override { | 352 void SetUpCommandLine(base::CommandLine* command_line) override { |
362 EncryptedMediaTestBase::SetUpCommandLine(command_line); | 353 EncryptedMediaTestBase::SetUpCommandLine(command_line); |
363 SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, command_line); | 354 SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, command_line); |
364 } | 355 } |
365 }; | 356 }; |
366 | 357 |
367 // Tests encrypted media playback using ExternalClearKey key system in | |
368 // decrypt-and-decode mode for prefixed EME. | |
369 class ECKPrefixedEncryptedMediaTest : public EncryptedMediaTestBase { | |
370 public: | |
371 // We use special |key_system| names to do non-playback related tests, e.g. | |
372 // kExternalClearKeyFileIOTestKeySystem is used to test file IO. | |
373 void TestNonPlaybackCases(const std::string& key_system, | |
374 const std::string& expected_title) { | |
375 // Since we do not test playback, arbitrarily choose a test file and source | |
376 // type. | |
377 RunEncryptedMediaTest( | |
378 kDefaultEmePlayer, "bear-a_enc-a.webm", kWebMAudioOnly, key_system, SRC, | |
379 PREFIXED, kNoSessionToLoad, false, PlayTwice::NO, expected_title); | |
380 } | |
381 | |
382 void TestPlaybackCase(const std::string& session_to_load, | |
383 const std::string& expected_title) { | |
384 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-320x240-v_enc-v.webm", | |
385 kWebMVideoOnly, kExternalClearKeyKeySystem, SRC, | |
386 PREFIXED, session_to_load, false, PlayTwice::NO, | |
387 expected_title); | |
388 } | |
389 | |
390 protected: | |
391 void SetUpCommandLine(base::CommandLine* command_line) override { | |
392 EncryptedMediaTestBase::SetUpCommandLine(command_line); | |
393 SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, command_line); | |
394 } | |
395 }; | |
396 | |
397 #if defined(WIDEVINE_CDM_AVAILABLE) | 358 #if defined(WIDEVINE_CDM_AVAILABLE) |
398 // Tests encrypted media playback using Widevine key system. | 359 // Tests encrypted media playback using Widevine key system. |
399 class WVEncryptedMediaTest : public EncryptedMediaTestBase { | 360 class WVEncryptedMediaTest : public EncryptedMediaTestBase { |
400 protected: | 361 protected: |
401 void SetUpCommandLine(base::CommandLine* command_line) override { | 362 void SetUpCommandLine(base::CommandLine* command_line) override { |
402 EncryptedMediaTestBase::SetUpCommandLine(command_line); | 363 EncryptedMediaTestBase::SetUpCommandLine(command_line); |
403 SetUpCommandLineForKeySystem(kWidevineKeySystem, command_line); | 364 SetUpCommandLineForKeySystem(kWidevineKeySystem, command_line); |
404 } | 365 } |
405 }; | 366 }; |
406 | 367 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
444 void TestMultiplePlayback(const std::string& encrypted_media, | 405 void TestMultiplePlayback(const std::string& encrypted_media, |
445 const std::string& media_type) { | 406 const std::string& media_type) { |
446 DCHECK(IsPlayBackPossible(CurrentKeySystem())); | 407 DCHECK(IsPlayBackPossible(CurrentKeySystem())); |
447 RunEncryptedMediaTest(kDefaultEmePlayer, encrypted_media, media_type, | 408 RunEncryptedMediaTest(kDefaultEmePlayer, encrypted_media, media_type, |
448 CurrentKeySystem(), CurrentSourceType(), | 409 CurrentKeySystem(), CurrentSourceType(), |
449 CurrentEmeVersion(), kNoSessionToLoad, false, | 410 CurrentEmeVersion(), kNoSessionToLoad, false, |
450 PlayTwice::YES, kEnded); | 411 PlayTwice::YES, kEnded); |
451 } | 412 } |
452 | 413 |
453 void RunInvalidResponseTest() { | 414 void RunInvalidResponseTest() { |
454 std::string expected_response = | |
455 (CurrentEmeVersion() == EmeVersion::UNPREFIXED) | |
456 ? kEmeUpdateFailed | |
457 : kPrefixedEmeErrorEvent; | |
458 RunEncryptedMediaTest( | 415 RunEncryptedMediaTest( |
459 kDefaultEmePlayer, "bear-320x240-av_enc-av.webm", kWebMAudioVideo, | 416 kDefaultEmePlayer, "bear-320x240-av_enc-av.webm", kWebMAudioVideo, |
460 CurrentKeySystem(), CurrentSourceType(), CurrentEmeVersion(), | 417 CurrentKeySystem(), CurrentSourceType(), CurrentEmeVersion(), |
461 kNoSessionToLoad, true, PlayTwice::NO, expected_response); | 418 kNoSessionToLoad, true, PlayTwice::NO, kEmeUpdateFailed); |
462 } | 419 } |
463 | 420 |
464 void TestFrameSizeChange() { | 421 void TestFrameSizeChange() { |
465 RunEncryptedMediaTest( | 422 RunEncryptedMediaTest( |
466 "encrypted_frame_size_change.html", "frame_size_change-av_enc-v.webm", | 423 "encrypted_frame_size_change.html", "frame_size_change-av_enc-v.webm", |
467 kWebMAudioVideo, CurrentKeySystem(), CurrentSourceType(), | 424 kWebMAudioVideo, CurrentKeySystem(), CurrentSourceType(), |
468 CurrentEmeVersion(), kNoSessionToLoad, false, PlayTwice::NO, kEnded); | 425 CurrentEmeVersion(), kNoSessionToLoad, false, PlayTwice::NO, kEnded); |
469 } | 426 } |
470 | 427 |
471 void TestConfigChange() { | 428 void TestConfigChange() { |
472 DCHECK(IsMSESupported()); | 429 DCHECK(IsMSESupported()); |
473 base::StringPairs query_params; | 430 base::StringPairs query_params; |
474 query_params.push_back(std::make_pair("keySystem", CurrentKeySystem())); | 431 query_params.push_back(std::make_pair("keySystem", CurrentKeySystem())); |
475 query_params.push_back(std::make_pair("runEncrypted", "1")); | 432 query_params.push_back(std::make_pair("runEncrypted", "1")); |
476 if (CurrentEmeVersion() == PREFIXED) | 433 if (CurrentEmeVersion() == PREFIXED) |
477 query_params.push_back(std::make_pair("usePrefixedEME", "1")); | 434 query_params.push_back(std::make_pair("usePrefixedEME", "1")); |
xhwang
2016/02/19 23:39:14
Can you fix this as well so that we can drop PREFI
ddorwin
2016/02/20 01:04:46
Done. Removed both.
| |
478 RunEncryptedMediaTestPage("mse_config_change.html", | 435 RunEncryptedMediaTestPage("mse_config_change.html", |
479 CurrentKeySystem(), | 436 CurrentKeySystem(), |
480 query_params, | 437 query_params, |
481 kEnded); | 438 kEnded); |
482 } | 439 } |
483 | 440 |
484 std::string ConvertContainerFormat(EncryptedContainer format) { | 441 std::string ConvertContainerFormat(EncryptedContainer format) { |
485 switch (format) { | 442 switch (format) { |
486 case EncryptedContainer::CLEAR_MP4: | 443 case EncryptedContainer::CLEAR_MP4: |
487 return "CLEAR_MP4"; | 444 return "CLEAR_MP4"; |
488 case EncryptedContainer::CLEAR_WEBM: | 445 case EncryptedContainer::CLEAR_WEBM: |
489 return "CLEAR_WEBM"; | 446 return "CLEAR_WEBM"; |
490 case EncryptedContainer::ENCRYPTED_MP4: | 447 case EncryptedContainer::ENCRYPTED_MP4: |
491 return "ENCRYPTED_MP4"; | 448 return "ENCRYPTED_MP4"; |
492 case EncryptedContainer::ENCRYPTED_WEBM: | 449 case EncryptedContainer::ENCRYPTED_WEBM: |
493 return "ENCRYPTED_WEBM"; | 450 return "ENCRYPTED_WEBM"; |
494 } | 451 } |
495 NOTREACHED(); | 452 NOTREACHED(); |
496 return "UNKNOWN"; | 453 return "UNKNOWN"; |
497 } | 454 } |
498 | 455 |
499 void TestDifferentContainers(EncryptedContainer video_format, | 456 void TestDifferentContainers(EncryptedContainer video_format, |
500 EncryptedContainer audio_format) { | 457 EncryptedContainer audio_format) { |
501 DCHECK(IsMSESupported()); | 458 DCHECK(IsMSESupported()); |
502 DCHECK_NE(CurrentEmeVersion(), PREFIXED); | 459 DCHECK_NE(CurrentEmeVersion(), PREFIXED); |
xhwang
2016/02/19 23:39:14
ditto
ddorwin
2016/02/20 01:04:46
Done.
| |
503 base::StringPairs query_params; | 460 base::StringPairs query_params; |
504 query_params.push_back(std::make_pair("keySystem", CurrentKeySystem())); | 461 query_params.push_back(std::make_pair("keySystem", CurrentKeySystem())); |
505 query_params.push_back(std::make_pair("runEncrypted", "1")); | 462 query_params.push_back(std::make_pair("runEncrypted", "1")); |
506 query_params.push_back( | 463 query_params.push_back( |
507 std::make_pair("videoFormat", ConvertContainerFormat(video_format))); | 464 std::make_pair("videoFormat", ConvertContainerFormat(video_format))); |
508 query_params.push_back( | 465 query_params.push_back( |
509 std::make_pair("audioFormat", ConvertContainerFormat(audio_format))); | 466 std::make_pair("audioFormat", ConvertContainerFormat(audio_format))); |
510 RunEncryptedMediaTestPage("mse_different_containers.html", | 467 RunEncryptedMediaTestPage("mse_different_containers.html", |
511 CurrentKeySystem(), query_params, kEnded); | 468 CurrentKeySystem(), query_params, kEnded); |
512 } | 469 } |
513 | 470 |
514 protected: | 471 protected: |
515 void SetUpCommandLine(base::CommandLine* command_line) override { | 472 void SetUpCommandLine(base::CommandLine* command_line) override { |
516 EncryptedMediaTestBase::SetUpCommandLine(command_line); | 473 EncryptedMediaTestBase::SetUpCommandLine(command_line); |
517 SetUpCommandLineForKeySystem(CurrentKeySystem(), command_line); | 474 SetUpCommandLineForKeySystem(CurrentKeySystem(), command_line); |
518 } | 475 } |
519 }; | 476 }; |
520 | 477 |
521 using ::testing::Combine; | 478 using ::testing::Combine; |
522 using ::testing::Values; | 479 using ::testing::Values; |
523 | 480 |
524 #if !defined(OS_ANDROID) | 481 #if !defined(OS_ANDROID) |
525 INSTANTIATE_TEST_CASE_P(SRC_ClearKey_Prefixed, | |
526 EncryptedMediaTest, | |
527 Combine(Values(kPrefixedClearKeyKeySystem), | |
528 Values(SRC), | |
529 Values(PREFIXED))); | |
530 | |
531 INSTANTIATE_TEST_CASE_P(SRC_ClearKey, | 482 INSTANTIATE_TEST_CASE_P(SRC_ClearKey, |
532 EncryptedMediaTest, | 483 EncryptedMediaTest, |
533 Combine(Values(kClearKeyKeySystem), | 484 Combine(Values(kClearKeyKeySystem), |
534 Values(SRC), | 485 Values(SRC), |
535 Values(UNPREFIXED))); | 486 Values(UNPREFIXED))); |
536 #endif // !defined(OS_ANDROID) | 487 #endif // !defined(OS_ANDROID) |
537 | 488 |
538 INSTANTIATE_TEST_CASE_P(MSE_ClearKey_Prefixed, | |
539 EncryptedMediaTest, | |
540 Combine(Values(kPrefixedClearKeyKeySystem), | |
541 Values(MSE), | |
542 Values(PREFIXED))); | |
543 INSTANTIATE_TEST_CASE_P(MSE_ClearKey, | 489 INSTANTIATE_TEST_CASE_P(MSE_ClearKey, |
544 EncryptedMediaTest, | 490 EncryptedMediaTest, |
545 Combine(Values(kClearKeyKeySystem), | 491 Combine(Values(kClearKeyKeySystem), |
546 Values(MSE), | 492 Values(MSE), |
547 Values(UNPREFIXED))); | 493 Values(UNPREFIXED))); |
548 | 494 |
549 // External Clear Key is currently only used on platforms that use Pepper CDMs. | 495 // External Clear Key is currently only used on platforms that use Pepper CDMs. |
550 #if defined(ENABLE_PEPPER_CDMS) | 496 #if defined(ENABLE_PEPPER_CDMS) |
551 INSTANTIATE_TEST_CASE_P(SRC_ExternalClearKey_Prefixed, | |
552 EncryptedMediaTest, | |
553 Combine(Values(kExternalClearKeyKeySystem), | |
554 Values(SRC), | |
555 Values(PREFIXED))); | |
556 INSTANTIATE_TEST_CASE_P(SRC_ExternalClearKey, | 497 INSTANTIATE_TEST_CASE_P(SRC_ExternalClearKey, |
557 EncryptedMediaTest, | 498 EncryptedMediaTest, |
558 Combine(Values(kExternalClearKeyKeySystem), | 499 Combine(Values(kExternalClearKeyKeySystem), |
559 Values(SRC), | 500 Values(SRC), |
560 Values(UNPREFIXED))); | 501 Values(UNPREFIXED))); |
561 | 502 |
562 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey_Prefixed, | |
563 EncryptedMediaTest, | |
564 Combine(Values(kExternalClearKeyKeySystem), | |
565 Values(MSE), | |
566 Values(PREFIXED))); | |
567 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey, | 503 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey, |
568 EncryptedMediaTest, | 504 EncryptedMediaTest, |
569 Combine(Values(kExternalClearKeyKeySystem), | 505 Combine(Values(kExternalClearKeyKeySystem), |
570 Values(MSE), | 506 Values(MSE), |
571 Values(UNPREFIXED))); | 507 Values(UNPREFIXED))); |
572 | 508 |
573 const char kExternalClearKeyDecryptOnlyKeySystem[] = | 509 const char kExternalClearKeyDecryptOnlyKeySystem[] = |
574 "org.chromium.externalclearkey.decryptonly"; | 510 "org.chromium.externalclearkey.decryptonly"; |
575 | 511 |
576 // To reduce test time, only run ExternalClearKeyDecryptOnly with MSE. | 512 // To reduce test time, only run ExternalClearKeyDecryptOnly with MSE. |
577 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKeyDecryptOnly_Prefixed, | |
578 EncryptedMediaTest, | |
579 Combine(Values(kExternalClearKeyDecryptOnlyKeySystem), | |
580 Values(MSE), | |
581 Values(PREFIXED))); | |
582 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKeyDecryptOnly, | 513 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKeyDecryptOnly, |
583 EncryptedMediaTest, | 514 EncryptedMediaTest, |
584 Combine(Values(kExternalClearKeyDecryptOnlyKeySystem), | 515 Combine(Values(kExternalClearKeyDecryptOnlyKeySystem), |
585 Values(MSE), | 516 Values(MSE), |
586 Values(UNPREFIXED))); | 517 Values(UNPREFIXED))); |
587 #endif // defined(ENABLE_PEPPER_CDMS) | 518 #endif // defined(ENABLE_PEPPER_CDMS) |
588 | 519 |
589 #if defined(WIDEVINE_CDM_AVAILABLE) | 520 #if defined(WIDEVINE_CDM_AVAILABLE) |
590 | |
591 // Prefixed Widevine tests fail in Chrome OS official builds due to the request | |
592 // for permissions. Since prefixed EME is deprecated and will be removed soon, | |
593 // don't run these tests. http://crbug.com/430711 | |
594 #if !(defined(OS_CHROMEOS) && defined(OFFICIAL_BUILD)) | |
595 | |
596 // This test doesn't fully test playback with Widevine. So we only run Widevine | |
597 // test with MSE (no SRC) to reduce test time. Also, on Android EME only works | |
598 // with MSE and we cannot run this test with SRC. | |
599 INSTANTIATE_TEST_CASE_P(MSE_Widevine_Prefixed, | |
600 EncryptedMediaTest, | |
601 Combine(Values(kWidevineKeySystem), | |
602 Values(MSE), | |
603 Values(PREFIXED))); | |
604 #endif // !(defined(OS_CHROMEOS) && defined(OFFICIAL_BUILD)) | |
605 | |
606 #if !defined(OS_CHROMEOS) | 521 #if !defined(OS_CHROMEOS) |
607 INSTANTIATE_TEST_CASE_P(MSE_Widevine, | 522 INSTANTIATE_TEST_CASE_P(MSE_Widevine, |
608 EncryptedMediaTest, | 523 EncryptedMediaTest, |
609 Combine(Values(kWidevineKeySystem), | 524 Combine(Values(kWidevineKeySystem), |
610 Values(MSE), | 525 Values(MSE), |
611 Values(UNPREFIXED))); | 526 Values(UNPREFIXED))); |
612 #endif // !defined(OS_CHROMEOS) | 527 #endif // !defined(OS_CHROMEOS) |
613 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 528 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
614 | 529 |
615 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) { | 530 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
756 if (!IsPlayBackPossible(CurrentKeySystem())) { | 671 if (!IsPlayBackPossible(CurrentKeySystem())) { |
757 DVLOG(0) << "Skipping test - Test requires video playback."; | 672 DVLOG(0) << "Skipping test - Test requires video playback."; |
758 return; | 673 return; |
759 } | 674 } |
760 TestDifferentContainers(EncryptedContainer::ENCRYPTED_WEBM, | 675 TestDifferentContainers(EncryptedContainer::ENCRYPTED_WEBM, |
761 EncryptedContainer::ENCRYPTED_MP4); | 676 EncryptedContainer::ENCRYPTED_MP4); |
762 } | 677 } |
763 #endif // defined(USE_PROPRIETARY_CODECS) | 678 #endif // defined(USE_PROPRIETARY_CODECS) |
764 | 679 |
765 #if defined(WIDEVINE_CDM_AVAILABLE) | 680 #if defined(WIDEVINE_CDM_AVAILABLE) |
766 // The parent key system cannot be used in generateKeyRequest. | |
767 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException_Prefixed) { | |
768 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm", kWebMAudioOnly, | |
769 "com.widevine", MSE, PREFIXED, kNoSessionToLoad, false, | |
770 PlayTwice::NO, kEmeNotSupportedError); | |
771 } | |
772 | |
773 // The parent key system cannot be used when creating MediaKeys. | 681 // The parent key system cannot be used when creating MediaKeys. |
774 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException) { | 682 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException) { |
775 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm", kWebMAudioOnly, | 683 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm", kWebMAudioOnly, |
776 "com.widevine", MSE, UNPREFIXED, kNoSessionToLoad, | 684 "com.widevine", MSE, UNPREFIXED, kNoSessionToLoad, |
777 false, PlayTwice::NO, kEmeNotSupportedError); | 685 false, PlayTwice::NO, kEmeNotSupportedError); |
778 } | 686 } |
779 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 687 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
780 | 688 |
781 #if defined(ENABLE_PEPPER_CDMS) | 689 #if defined(ENABLE_PEPPER_CDMS) |
782 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, InitializeCDMFail) { | 690 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, InitializeCDMFail) { |
(...skipping 23 matching lines...) Expand all Loading... | |
806 } | 714 } |
807 | 715 |
808 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { | 716 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { |
809 TestPlaybackCase(kLoadableSession, kEnded); | 717 TestPlaybackCase(kLoadableSession, kEnded); |
810 } | 718 } |
811 | 719 |
812 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { | 720 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { |
813 TestPlaybackCase(kUnknownSession, kEmeSessionNotFound); | 721 TestPlaybackCase(kUnknownSession, kEmeSessionNotFound); |
814 } | 722 } |
815 | 723 |
816 IN_PROC_BROWSER_TEST_F(ECKPrefixedEncryptedMediaTest, InitializeCDMFail) { | |
817 TestNonPlaybackCases(kExternalClearKeyInitializeFailKeySystem, | |
818 kPrefixedEmeErrorEvent); | |
819 } | |
820 | |
821 // When CDM crashes, we should still get a decode error. | |
822 // crbug.com/386657 | |
823 IN_PROC_BROWSER_TEST_F(ECKPrefixedEncryptedMediaTest, | |
824 DISABLED_CDMCrashDuringDecode) { | |
825 IgnorePluginCrash(); | |
826 TestNonPlaybackCases(kExternalClearKeyCrashKeySystem, kError); | |
827 } | |
828 | |
829 // Testing that the media browser test does fail on plugin crash. | |
830 // crbug.com/386657 | |
831 IN_PROC_BROWSER_TEST_F(ECKPrefixedEncryptedMediaTest, | |
832 DISABLED_CDMExpectedCrash) { | |
833 // Plugin crash is not ignored by default, the test is expected to fail. | |
834 EXPECT_NONFATAL_FAILURE( | |
835 TestNonPlaybackCases(kExternalClearKeyCrashKeySystem, kError), | |
836 "plugin crash"); | |
837 } | |
838 | |
839 IN_PROC_BROWSER_TEST_F(ECKPrefixedEncryptedMediaTest, FileIOTest) { | |
840 TestNonPlaybackCases(kExternalClearKeyFileIOTestKeySystem, | |
841 kFileIOTestSuccess); | |
842 } | |
843 | |
844 IN_PROC_BROWSER_TEST_F(ECKPrefixedEncryptedMediaTest, LoadLoadableSession) { | |
845 TestPlaybackCase(kLoadableSession, kEnded); | |
846 } | |
847 | |
848 IN_PROC_BROWSER_TEST_F(ECKPrefixedEncryptedMediaTest, LoadUnknownSession) { | |
849 TestPlaybackCase(kUnknownSession, kPrefixedEmeErrorEvent); | |
850 } | |
851 #endif // defined(ENABLE_PEPPER_CDMS) | 724 #endif // defined(ENABLE_PEPPER_CDMS) |
OLD | NEW |