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 // TODO(sandersd): Refactor to remove recomputed codec arrays, and generally | 5 // TODO(sandersd): Refactor to remove recomputed codec arrays, and generally |
| 6 // shorten and improve coverage. | 6 // shorten and improve coverage. |
| 7 // - http://crbug.com/417444 | 7 // - http://crbug.com/417444 |
| 8 // - http://crbug.com/457438 | 8 // - http://crbug.com/457438 |
| 9 // TODO(sandersd): Add tests to cover codec vectors with empty items. | 9 // TODO(sandersd): Add tests to cover codec vectors with empty items. |
| 10 // http://crbug.com/417461 | 10 // http://crbug.com/417461 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 // kUsesAes uses the AesDecryptor like Clear Key. | 25 // kUsesAes uses the AesDecryptor like Clear Key. |
| 26 // kExternal uses an external CDM, such as Pepper-based or Android platform CDM. | 26 // kExternal uses an external CDM, such as Pepper-based or Android platform CDM. |
| 27 const char kUsesAes[] = "x-org.example.clear"; | 27 const char kUsesAes[] = "x-org.example.clear"; |
| 28 const char kUsesAesParent[] = "x-org.example"; // Not registered. | 28 const char kUsesAesParent[] = "x-org.example"; // Not registered. |
| 29 const char kUseAesNameForUMA[] = "UseAes"; | 29 const char kUseAesNameForUMA[] = "UseAes"; |
| 30 const char kExternal[] = "x-com.example.test"; | 30 const char kExternal[] = "x-com.example.test"; |
| 31 const char kExternalParent[] = "x-com.example"; | 31 const char kExternalParent[] = "x-com.example"; |
| 32 const char kExternalNameForUMA[] = "External"; | 32 const char kExternalNameForUMA[] = "External"; |
| 33 | 33 |
| 34 const char kClearKey[] = "org.w3.clearkey"; | 34 const char kClearKey[] = "org.w3.clearkey"; |
| 35 const char kPrefixedClearKey[] = "webkit-org.w3.clearkey"; | |
| 36 const char kExternalClearKey[] = "org.chromium.externalclearkey"; | 35 const char kExternalClearKey[] = "org.chromium.externalclearkey"; |
| 37 | 36 |
| 38 const char kAudioWebM[] = "audio/webm"; | 37 const char kAudioWebM[] = "audio/webm"; |
| 39 const char kVideoWebM[] = "video/webm"; | 38 const char kVideoWebM[] = "video/webm"; |
| 40 const char kAudioFoo[] = "audio/foo"; | 39 const char kAudioFoo[] = "audio/foo"; |
| 41 const char kVideoFoo[] = "video/foo"; | 40 const char kVideoFoo[] = "video/foo"; |
| 42 | 41 |
| 43 // Pick some arbitrary bit fields as long as they are not in conflict with the | 42 // Pick some arbitrary bit fields as long as they are not in conflict with the |
| 44 // real ones. | 43 // real ones. |
| 45 enum TestCodec { | 44 enum TestCodec { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 TestMediaClient::TestMediaClient() | 135 TestMediaClient::TestMediaClient() |
| 137 : is_update_needed_(true), supports_external_key_system_(true) { | 136 : is_update_needed_(true), supports_external_key_system_(true) { |
| 138 } | 137 } |
| 139 | 138 |
| 140 TestMediaClient::~TestMediaClient() { | 139 TestMediaClient::~TestMediaClient() { |
| 141 } | 140 } |
| 142 | 141 |
| 143 void TestMediaClient::AddKeySystemsInfoForUMA( | 142 void TestMediaClient::AddKeySystemsInfoForUMA( |
| 144 std::vector<KeySystemInfoForUMA>* key_systems_info_for_uma) { | 143 std::vector<KeySystemInfoForUMA>* key_systems_info_for_uma) { |
| 145 key_systems_info_for_uma->push_back( | 144 key_systems_info_for_uma->push_back( |
| 146 media::KeySystemInfoForUMA(kUsesAes, kUseAesNameForUMA, false)); | 145 media::KeySystemInfoForUMA(kUsesAes, kUseAesNameForUMA)); |
| 147 key_systems_info_for_uma->push_back( | 146 key_systems_info_for_uma->push_back( |
| 148 media::KeySystemInfoForUMA(kExternal, kExternalNameForUMA, true)); | 147 media::KeySystemInfoForUMA(kExternal, kExternalNameForUMA)); |
| 149 } | 148 } |
| 150 | 149 |
| 151 bool TestMediaClient::IsKeySystemsUpdateNeeded() { | 150 bool TestMediaClient::IsKeySystemsUpdateNeeded() { |
| 152 return is_update_needed_; | 151 return is_update_needed_; |
| 153 } | 152 } |
| 154 | 153 |
| 155 void TestMediaClient::AddSupportedKeySystems( | 154 void TestMediaClient::AddSupportedKeySystems( |
| 156 std::vector<KeySystemInfo>* key_systems) { | 155 std::vector<KeySystemInfo>* key_systems) { |
| 157 DCHECK(is_update_needed_); | 156 DCHECK(is_update_needed_); |
| 158 | 157 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 360 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(std::string())); | 359 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(std::string())); |
| 361 } | 360 } |
| 362 | 361 |
| 363 // Clear Key is the only key system registered in content. | 362 // Clear Key is the only key system registered in content. |
| 364 TEST_F(KeySystemsTest, ClearKey) { | 363 TEST_F(KeySystemsTest, ClearKey) { |
| 365 EXPECT_TRUE(IsSupportedKeySystem(kClearKey)); | 364 EXPECT_TRUE(IsSupportedKeySystem(kClearKey)); |
| 366 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 365 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 367 kVideoWebM, no_codecs(), kClearKey)); | 366 kVideoWebM, no_codecs(), kClearKey)); |
| 368 | 367 |
| 369 EXPECT_EQ("ClearKey", GetKeySystemNameForUMA(kClearKey)); | 368 EXPECT_EQ("ClearKey", GetKeySystemNameForUMA(kClearKey)); |
| 370 | |
| 371 // Prefixed Clear Key is not supported internally. | |
| 372 EXPECT_FALSE(IsSupportedKeySystem(kPrefixedClearKey)); | |
| 373 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kPrefixedClearKey)); | |
| 374 } | 369 } |
| 375 | 370 |
| 376 TEST_F(KeySystemsTest, ClearKeyWithInitDataType) { | 371 TEST_F(KeySystemsTest, ClearKeyWithInitDataType) { |
| 377 EXPECT_TRUE(IsSupportedKeySystem(kClearKey)); | 372 EXPECT_TRUE(IsSupportedKeySystem(kClearKey)); |
| 378 EXPECT_TRUE( | 373 EXPECT_TRUE( |
| 379 IsSupportedKeySystemWithInitDataType(kClearKey, EmeInitDataType::WEBM)); | 374 IsSupportedKeySystemWithInitDataType(kClearKey, EmeInitDataType::WEBM)); |
| 380 EXPECT_TRUE( | 375 EXPECT_TRUE( |
| 381 IsSupportedKeySystemWithInitDataType(kClearKey, EmeInitDataType::KEYIDS)); | 376 IsSupportedKeySystemWithInitDataType(kClearKey, EmeInitDataType::KEYIDS)); |
| 382 | 377 |
| 383 // All other InitDataTypes are not supported. | 378 // All other InitDataTypes are not supported. |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 578 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 573 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 579 kVideoWebM, no_codecs(), kExternal)); | 574 kVideoWebM, no_codecs(), kExternal)); |
| 580 | 575 |
| 581 EXPECT_FALSE(CanUseAesDecryptor(kExternal)); | 576 EXPECT_FALSE(CanUseAesDecryptor(kExternal)); |
| 582 #if defined(ENABLE_PEPPER_CDMS) | 577 #if defined(ENABLE_PEPPER_CDMS) |
| 583 EXPECT_EQ("application/x-ppapi-external-cdm", GetPepperType(kExternal)); | 578 EXPECT_EQ("application/x-ppapi-external-cdm", GetPepperType(kExternal)); |
| 584 #endif // defined(ENABLE_PEPPER_CDMS) | 579 #endif // defined(ENABLE_PEPPER_CDMS) |
| 585 } | 580 } |
| 586 | 581 |
| 587 TEST_F(KeySystemsTest, Parent_ParentRegistered) { | 582 TEST_F(KeySystemsTest, Parent_ParentRegistered) { |
| 588 // Unprefixed has no parent key system support. | 583 // Unprefixed has no parent key system support. |
|
xhwang
2016/02/19 23:39:14
Now we only have one EME, we probably should stop
ddorwin
2016/02/20 01:04:46
We can fix that as we find it. For this one, the c
| |
| 589 EXPECT_FALSE(IsSupportedKeySystem(kExternalParent)); | 584 EXPECT_FALSE(IsSupportedKeySystem(kExternalParent)); |
| 590 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | |
| 591 kVideoWebM, no_codecs(), kExternalParent)); | |
| 592 | 585 |
| 593 // The parent is not supported for most things. | 586 // The parent is not supported for most things. |
| 594 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kExternalParent)); | 587 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kExternalParent)); |
| 595 EXPECT_FALSE(CanUseAesDecryptor(kExternalParent)); | 588 EXPECT_FALSE(CanUseAesDecryptor(kExternalParent)); |
| 596 | 589 |
| 597 #if defined(ENABLE_PEPPER_CDMS) | 590 #if defined(ENABLE_PEPPER_CDMS) |
| 598 std::string type; | 591 std::string type; |
| 599 EXPECT_DEBUG_DEATH(type = GetPepperType(kExternalParent), | 592 EXPECT_DEBUG_DEATH(type = GetPepperType(kExternalParent), |
| 600 "x-com.example is not a known concrete system"); | 593 "x-com.example is not a known concrete system"); |
| 601 EXPECT_TRUE(type.empty()); | 594 EXPECT_TRUE(type.empty()); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 618 kVideoWebM, vp90_codec(), kExternal)); | 611 kVideoWebM, vp90_codec(), kExternal)); |
| 619 | 612 |
| 620 // Audio in a video container. | 613 // Audio in a video container. |
| 621 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 614 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 622 kVideoWebM, vp8_and_vorbis_codecs(), kExternal)); | 615 kVideoWebM, vp8_and_vorbis_codecs(), kExternal)); |
| 623 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 616 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 624 kVideoWebM, vp9_and_vorbis_codecs(), kExternal)); | 617 kVideoWebM, vp9_and_vorbis_codecs(), kExternal)); |
| 625 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 618 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 626 kVideoWebM, vorbis_codec(), kExternal)); | 619 kVideoWebM, vorbis_codec(), kExternal)); |
| 627 | 620 |
| 628 // Valid video types - parent key system. | |
| 629 // Prefixed has parent key system support. | |
| 630 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | |
| 631 kVideoWebM, no_codecs(), kExternalParent)); | |
| 632 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | |
| 633 kVideoWebM, vp8_codec(), kExternalParent)); | |
| 634 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | |
| 635 kVideoWebM, vp80_codec(), kExternalParent)); | |
| 636 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | |
| 637 kVideoWebM, vp8_and_vorbis_codecs(), kExternalParent)); | |
| 638 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | |
| 639 kVideoWebM, vp9_codec(), kExternalParent)); | |
| 640 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | |
| 641 kVideoWebM, vp90_codec(), kExternalParent)); | |
| 642 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | |
| 643 kVideoWebM, vp9_and_vorbis_codecs(), kExternalParent)); | |
| 644 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | |
| 645 kVideoWebM, vorbis_codec(), kExternalParent)); | |
| 646 | |
| 647 // Non-Webm codecs. | 621 // Non-Webm codecs. |
| 648 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 622 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 649 kVideoWebM, foovideo_codec(), kExternal)); | 623 kVideoWebM, foovideo_codec(), kExternal)); |
| 650 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 624 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 651 kVideoWebM, unknown_codec(), kExternal)); | 625 kVideoWebM, unknown_codec(), kExternal)); |
| 652 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 626 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 653 kVideoWebM, mixed_codecs(), kExternal)); | 627 kVideoWebM, mixed_codecs(), kExternal)); |
| 654 | 628 |
| 655 // Valid audio types. | 629 // Valid audio types. |
| 656 EXPECT_TRUE(IsSupportedKeySystemWithAudioMimeType( | 630 EXPECT_TRUE(IsSupportedKeySystemWithAudioMimeType( |
| 657 kAudioWebM, no_codecs(), kExternal)); | 631 kAudioWebM, no_codecs(), kExternal)); |
| 658 EXPECT_TRUE(IsSupportedKeySystemWithAudioMimeType( | 632 EXPECT_TRUE(IsSupportedKeySystemWithAudioMimeType( |
| 659 kAudioWebM, vorbis_codec(), kExternal)); | 633 kAudioWebM, vorbis_codec(), kExternal)); |
| 660 | 634 |
| 661 // Valid audio types - parent key system. | |
| 662 // Prefixed has parent key system support. | |
| 663 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | |
| 664 kAudioWebM, no_codecs(), kExternalParent)); | |
| 665 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | |
| 666 kAudioWebM, vorbis_codec(), kExternalParent)); | |
| 667 | |
| 668 // Non-audio codecs. | 635 // Non-audio codecs. |
| 669 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( | 636 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( |
| 670 kAudioWebM, vp8_codec(), kExternal)); | 637 kAudioWebM, vp8_codec(), kExternal)); |
| 671 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( | 638 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( |
| 672 kAudioWebM, vp8_and_vorbis_codecs(), kExternal)); | 639 kAudioWebM, vp8_and_vorbis_codecs(), kExternal)); |
| 673 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( | 640 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( |
| 674 kAudioWebM, vp9_codec(), kExternal)); | 641 kAudioWebM, vp9_codec(), kExternal)); |
| 675 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( | 642 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( |
| 676 kAudioWebM, vp9_and_vorbis_codecs(), kExternal)); | 643 kAudioWebM, vp9_and_vorbis_codecs(), kExternal)); |
| 677 | 644 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 688 kVideoFoo, no_codecs(), kExternal)); | 655 kVideoFoo, no_codecs(), kExternal)); |
| 689 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 656 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 690 kVideoFoo, foovideo_codec(), kExternal)); | 657 kVideoFoo, foovideo_codec(), kExternal)); |
| 691 | 658 |
| 692 // Audio in a video container. | 659 // Audio in a video container. |
| 693 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 660 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 694 kVideoFoo, foovideo_and_fooaudio_codecs(), kExternal)); | 661 kVideoFoo, foovideo_and_fooaudio_codecs(), kExternal)); |
| 695 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 662 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 696 kVideoFoo, fooaudio_codec(), kExternal)); | 663 kVideoFoo, fooaudio_codec(), kExternal)); |
| 697 | 664 |
| 698 // Valid video types - parent key system. | |
| 699 // Prefixed has parent key system support. | |
| 700 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | |
| 701 kVideoFoo, no_codecs(), kExternalParent)); | |
| 702 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | |
| 703 kVideoFoo, foovideo_codec(), kExternalParent)); | |
| 704 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | |
| 705 kVideoFoo, foovideo_and_fooaudio_codecs(), kExternalParent)); | |
| 706 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | |
| 707 kVideoFoo, fooaudio_codec(), kExternalParent)); | |
| 708 | |
| 709 // Extended codecs fail because this is handled by SimpleWebMimeRegistryImpl. | 665 // Extended codecs fail because this is handled by SimpleWebMimeRegistryImpl. |
| 710 // They should really pass canPlayType(). | 666 // They should really pass canPlayType(). |
| 711 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 667 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 712 kVideoFoo, foovideo_extended_codec(), kExternal)); | 668 kVideoFoo, foovideo_extended_codec(), kExternal)); |
| 713 | 669 |
| 714 // Invalid codec format. | 670 // Invalid codec format. |
| 715 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 671 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 716 kVideoFoo, foovideo_dot_codec(), kExternal)); | 672 kVideoFoo, foovideo_dot_codec(), kExternal)); |
| 717 | 673 |
| 718 // Non-container2 codecs. | 674 // Non-container2 codecs. |
| 719 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 675 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 720 kVideoFoo, vp8_codec(), kExternal)); | 676 kVideoFoo, vp8_codec(), kExternal)); |
| 721 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 677 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 722 kVideoFoo, unknown_codec(), kExternal)); | 678 kVideoFoo, unknown_codec(), kExternal)); |
| 723 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 679 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 724 kVideoFoo, mixed_codecs(), kExternal)); | 680 kVideoFoo, mixed_codecs(), kExternal)); |
| 725 | 681 |
| 726 // Valid audio types. | 682 // Valid audio types. |
| 727 EXPECT_TRUE(IsSupportedKeySystemWithAudioMimeType( | 683 EXPECT_TRUE(IsSupportedKeySystemWithAudioMimeType( |
| 728 kAudioFoo, no_codecs(), kExternal)); | 684 kAudioFoo, no_codecs(), kExternal)); |
| 729 EXPECT_TRUE(IsSupportedKeySystemWithAudioMimeType( | 685 EXPECT_TRUE(IsSupportedKeySystemWithAudioMimeType( |
| 730 kAudioFoo, fooaudio_codec(), kExternal)); | 686 kAudioFoo, fooaudio_codec(), kExternal)); |
| 731 | 687 |
| 732 // Valid audio types - parent key system. | |
| 733 // Prefixed has parent key system support. | |
| 734 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | |
| 735 kAudioFoo, no_codecs(), kExternalParent)); | |
| 736 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | |
| 737 kAudioFoo, fooaudio_codec(), kExternalParent)); | |
| 738 | |
| 739 // Non-audio codecs. | 688 // Non-audio codecs. |
| 740 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( | 689 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( |
| 741 kAudioFoo, foovideo_codec(), kExternal)); | 690 kAudioFoo, foovideo_codec(), kExternal)); |
| 742 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( | 691 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( |
| 743 kAudioFoo, foovideo_and_fooaudio_codecs(), kExternal)); | 692 kAudioFoo, foovideo_and_fooaudio_codecs(), kExternal)); |
| 744 | 693 |
| 745 // Non-container2 codec. | 694 // Non-container2 codec. |
| 746 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( | 695 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( |
| 747 kAudioFoo, vorbis_codec(), kExternal)); | 696 kAudioFoo, vorbis_codec(), kExternal)); |
| 748 } | 697 } |
| 749 | 698 |
| 750 TEST_F(KeySystemsTest, KeySystemNameForUMA) { | 699 TEST_F(KeySystemsTest, KeySystemNameForUMA) { |
| 751 EXPECT_EQ("ClearKey", GetKeySystemNameForUMA(kClearKey)); | 700 EXPECT_EQ("ClearKey", GetKeySystemNameForUMA(kClearKey)); |
| 752 // Prefixed is not supported internally. | |
| 753 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kPrefixedClearKey)); | |
| 754 | 701 |
| 755 // External Clear Key never has a UMA name. | 702 // External Clear Key never has a UMA name. |
| 756 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kExternalClearKey)); | 703 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kExternalClearKey)); |
| 757 } | 704 } |
| 758 | 705 |
| 759 TEST_F(KeySystemsTest, KeySystemsUpdate) { | 706 TEST_F(KeySystemsTest, KeySystemsUpdate) { |
| 760 EXPECT_TRUE(IsSupportedKeySystem(kUsesAes)); | 707 EXPECT_TRUE(IsSupportedKeySystem(kUsesAes)); |
| 761 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 708 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 762 kVideoWebM, no_codecs(), kUsesAes)); | 709 kVideoWebM, no_codecs(), kUsesAes)); |
| 763 EXPECT_TRUE(IsSupportedKeySystem(kExternal)); | 710 EXPECT_TRUE(IsSupportedKeySystem(kExternal)); |
| 764 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 711 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 765 kVideoWebM, no_codecs(), kExternal)); | 712 kVideoWebM, no_codecs(), kExternal)); |
| 766 | 713 |
| 767 UpdateClientKeySystems(); | 714 UpdateClientKeySystems(); |
| 768 | 715 |
| 769 EXPECT_TRUE(IsSupportedKeySystem(kUsesAes)); | 716 EXPECT_TRUE(IsSupportedKeySystem(kUsesAes)); |
| 770 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 717 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 771 kVideoWebM, no_codecs(), kUsesAes)); | 718 kVideoWebM, no_codecs(), kUsesAes)); |
| 772 EXPECT_FALSE(IsSupportedKeySystem(kExternal)); | 719 EXPECT_FALSE(IsSupportedKeySystem(kExternal)); |
| 773 } | 720 } |
| 774 | 721 |
| 775 TEST_F(KeySystemsTest, PrefixedKeySystemsUpdate) { | |
| 776 EXPECT_TRUE(IsSupportedKeySystem(kUsesAes)); | |
| 777 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | |
| 778 kVideoWebM, no_codecs(), kUsesAes)); | |
| 779 EXPECT_TRUE(IsSupportedKeySystem(kExternal)); | |
| 780 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | |
| 781 kVideoWebM, no_codecs(), kExternal)); | |
| 782 | |
| 783 UpdateClientKeySystems(); | |
| 784 | |
| 785 EXPECT_TRUE(IsSupportedKeySystem(kUsesAes)); | |
| 786 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | |
| 787 kVideoWebM, no_codecs(), kUsesAes)); | |
| 788 EXPECT_FALSE(IsSupportedKeySystem(kExternal)); | |
| 789 EXPECT_FALSE(PrefixedIsSupportedKeySystemWithMediaMimeType( | |
| 790 kVideoWebM, no_codecs(), kExternal)); | |
| 791 } | |
| 792 | |
| 793 TEST_F(KeySystemsPotentiallySupportedNamesTest, PotentiallySupportedNames) { | 722 TEST_F(KeySystemsPotentiallySupportedNamesTest, PotentiallySupportedNames) { |
| 794 EXPECT_FALSE(IsSupportedKeySystem("org.w3")); | 723 EXPECT_FALSE(IsSupportedKeySystem("org.w3")); |
| 795 EXPECT_FALSE(IsSupportedKeySystem("org.w3.")); | 724 EXPECT_FALSE(IsSupportedKeySystem("org.w3.")); |
| 796 EXPECT_FALSE(IsSupportedKeySystem("org.w3.clearke")); | 725 EXPECT_FALSE(IsSupportedKeySystem("org.w3.clearke")); |
| 797 EXPECT_TRUE(IsSupportedKeySystem("org.w3.clearkey")); | 726 EXPECT_TRUE(IsSupportedKeySystem("org.w3.clearkey")); |
| 798 EXPECT_FALSE(IsSupportedKeySystem("org.w3.clearkeys")); | 727 EXPECT_FALSE(IsSupportedKeySystem("org.w3.clearkeys")); |
| 799 | 728 |
| 800 EXPECT_FALSE(IsSupportedKeySystem("com.widevine")); | 729 EXPECT_FALSE(IsSupportedKeySystem("com.widevine")); |
| 801 EXPECT_FALSE(IsSupportedKeySystem("com.widevine.")); | 730 EXPECT_FALSE(IsSupportedKeySystem("com.widevine.")); |
| 802 EXPECT_FALSE(IsSupportedKeySystem("com.widevine.alph")); | 731 EXPECT_FALSE(IsSupportedKeySystem("com.widevine.alph")); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 823 EXPECT_FALSE(IsSupportedKeySystem("com.chromecast.something.else")); | 752 EXPECT_FALSE(IsSupportedKeySystem("com.chromecast.something.else")); |
| 824 EXPECT_FALSE(IsSupportedKeySystem("com.chromecast.other")); | 753 EXPECT_FALSE(IsSupportedKeySystem("com.chromecast.other")); |
| 825 | 754 |
| 826 EXPECT_FALSE(IsSupportedKeySystem("x-")); | 755 EXPECT_FALSE(IsSupportedKeySystem("x-")); |
| 827 EXPECT_TRUE(IsSupportedKeySystem("x-something")); | 756 EXPECT_TRUE(IsSupportedKeySystem("x-something")); |
| 828 EXPECT_FALSE(IsSupportedKeySystem("x-something.else")); | 757 EXPECT_FALSE(IsSupportedKeySystem("x-something.else")); |
| 829 EXPECT_FALSE(IsSupportedKeySystem("x-other")); | 758 EXPECT_FALSE(IsSupportedKeySystem("x-other")); |
| 830 } | 759 } |
| 831 | 760 |
| 832 } // namespace media | 761 } // namespace media |
| OLD | NEW |