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 <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "third_party/WebKit/public/platform/WebString.h" | 9 #include "third_party/WebKit/public/platform/WebString.h" |
| 10 #include "webkit/renderer/media/crypto/key_systems.h" | 10 #include "webkit/renderer/media/crypto/key_systems.h" |
| (...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 533 // Non-MP4 codec. | 533 // Non-MP4 codec. |
| 534 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 534 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 535 "audio/mp4", vorbis_codec(), kExternalClearKey)); | 535 "audio/mp4", vorbis_codec(), kExternalClearKey)); |
| 536 } | 536 } |
| 537 | 537 |
| 538 // | 538 // |
| 539 // Widevine | 539 // Widevine |
| 540 // | 540 // |
| 541 | 541 |
| 542 TEST_F(KeySystemsTest, Widevine_Basic) { | 542 TEST_F(KeySystemsTest, Widevine_Basic) { |
| 543 #if defined(WIDEVINE_CDM_AVAILABLE) && \ | |
|
ddorwin
2013/06/22 04:44:35
This test was actually failing because it expected
| |
| 544 defined(DISABLE_WIDEVINE_CDM_CANPLAYTYPE) | |
| 545 EXPECT_TRUE(IsSupportedKeySystem(WebString::fromUTF8(kWidevineAlpha))); | |
| 546 #else | |
| 543 EXPECT_WV(IsSupportedKeySystem(WebString::fromUTF8(kWidevineAlpha))); | 547 EXPECT_WV(IsSupportedKeySystem(WebString::fromUTF8(kWidevineAlpha))); |
| 548 #endif | |
| 549 | |
| 544 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType( | 550 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType( |
| 545 "video/webm", no_codecs(), kWidevineAlpha)); | 551 "video/webm", no_codecs(), kWidevineAlpha)); |
| 546 | 552 |
| 547 #if defined(WIDEVINE_CDM_AVAILABLE) | 553 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 548 const char* const kWidevineUmaName = "Widevine"; | 554 const char* const kWidevineUmaName = "Widevine"; |
| 549 #else | 555 #else |
| 550 const char* const kWidevineUmaName = "Unknown"; | 556 const char* const kWidevineUmaName = "Unknown"; |
| 551 #endif | 557 #endif |
| 552 EXPECT_STREQ( | 558 EXPECT_STREQ( |
| 553 kWidevineUmaName, | 559 kWidevineUmaName, |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 564 #else | 570 #else |
| 565 EXPECT_TRUE(GetPepperType(kWidevineAlpha).empty()); | 571 EXPECT_TRUE(GetPepperType(kWidevineAlpha).empty()); |
| 566 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 572 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
| 567 #endif // defined(ENABLE_PEPPER_CDMS) | 573 #endif // defined(ENABLE_PEPPER_CDMS) |
| 568 | 574 |
| 569 } | 575 } |
| 570 | 576 |
| 571 TEST_F(KeySystemsTest, Widevine_Parent) { | 577 TEST_F(KeySystemsTest, Widevine_Parent) { |
| 572 const char* const kWidevineParent = kWidevine; | 578 const char* const kWidevineParent = kWidevine; |
| 573 | 579 |
| 580 #if defined(WIDEVINE_CDM_AVAILABLE) && \ | |
| 581 defined(DISABLE_WIDEVINE_CDM_CANPLAYTYPE) | |
| 582 EXPECT_TRUE(IsSupportedKeySystem(WebString::fromUTF8(kWidevineParent))); | |
|
ddorwin
2013/06/22 04:44:35
This one was false before because there was not a
| |
| 583 #else | |
| 574 EXPECT_WV(IsSupportedKeySystem(WebString::fromUTF8(kWidevineParent))); | 584 EXPECT_WV(IsSupportedKeySystem(WebString::fromUTF8(kWidevineParent))); |
| 585 #endif | |
| 575 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType( | 586 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType( |
| 576 "video/webm", no_codecs(), kWidevineParent)); | 587 "video/webm", no_codecs(), kWidevineParent)); |
| 577 | 588 |
| 578 // The parent is not supported for most things. | 589 // The parent is not supported for most things. |
| 579 EXPECT_STREQ("Unknown", | 590 EXPECT_STREQ("Unknown", |
| 580 KeySystemNameForUMA(std::string(kWidevineParent)).c_str()); | 591 KeySystemNameForUMA(std::string(kWidevineParent)).c_str()); |
| 581 EXPECT_STREQ("Unknown", | 592 EXPECT_STREQ("Unknown", |
| 582 KeySystemNameForUMA(WebString::fromUTF8(kWidevineParent)).c_str()); | 593 KeySystemNameForUMA(WebString::fromUTF8(kWidevineParent)).c_str()); |
| 583 EXPECT_FALSE(CanUseAesDecryptor(kWidevineParent)); | 594 EXPECT_FALSE(CanUseAesDecryptor(kWidevineParent)); |
| 584 #if defined(ENABLE_PEPPER_CDMS) | 595 #if defined(ENABLE_PEPPER_CDMS) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 616 "video/webm", no_codecs(), "com.widevine.alphab")); | 627 "video/webm", no_codecs(), "com.widevine.alphab")); |
| 617 | 628 |
| 618 // There are no child key systems for Widevine Alpha. | 629 // There are no child key systems for Widevine Alpha. |
| 619 EXPECT_FALSE(IsSupportedKeySystem("com.widevine.alpha.foo")); | 630 EXPECT_FALSE(IsSupportedKeySystem("com.widevine.alpha.foo")); |
| 620 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 631 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 621 "video/webm", no_codecs(), "com.widevine.alpha.foo")); | 632 "video/webm", no_codecs(), "com.widevine.alpha.foo")); |
| 622 } | 633 } |
| 623 | 634 |
| 624 TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_Widevine_NoType) { | 635 TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_Widevine_NoType) { |
| 625 // These two should be true. See http://crbug.com/164303. | 636 // These two should be true. See http://crbug.com/164303. |
| 626 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 637 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
|
ddorwin
2013/06/22 04:44:35
This test was failing because of the dummy entry i
| |
| 627 std::string(), no_codecs(), kWidevineAlpha)); | 638 std::string(), no_codecs(), kWidevineAlpha)); |
| 628 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 639 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 629 std::string(), no_codecs(), kWidevine)); | 640 std::string(), no_codecs(), kWidevine)); |
| 630 | 641 |
| 631 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 642 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 632 std::string(), no_codecs(), "com.widevine.foo")); | 643 std::string(), no_codecs(), "com.widevine.foo")); |
| 633 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 644 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 634 std::string(), no_codecs(), "com.widevine.alpha.foo")); | 645 std::string(), no_codecs(), "com.widevine.alpha.foo")); |
| 635 } | 646 } |
| 636 | 647 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 765 } | 776 } |
| 766 | 777 |
| 767 TEST_F(KeySystemsTest, GetUUID_Unrecognized) { | 778 TEST_F(KeySystemsTest, GetUUID_Unrecognized) { |
| 768 EXPECT_TRUE(GetUUID(kWidevine).empty()); | 779 EXPECT_TRUE(GetUUID(kWidevine).empty()); |
| 769 EXPECT_TRUE(GetUUID(kClearKey).empty()); | 780 EXPECT_TRUE(GetUUID(kClearKey).empty()); |
| 770 EXPECT_TRUE(GetUUID("").empty()); | 781 EXPECT_TRUE(GetUUID("").empty()); |
| 771 } | 782 } |
| 772 #endif // defined(OS_ANDROID) | 783 #endif // defined(OS_ANDROID) |
| 773 | 784 |
| 774 } // namespace webkit_media | 785 } // namespace webkit_media |
| OLD | NEW |