| 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) && \ | |
| 544 defined(DISABLE_WIDEVINE_CDM_CANPLAYTYPE) | |
| 545 EXPECT_TRUE(IsSupportedKeySystem(WebString::fromUTF8(kWidevineAlpha))); | |
| 546 #else | |
| 547 EXPECT_WV(IsSupportedKeySystem(WebString::fromUTF8(kWidevineAlpha))); | 543 EXPECT_WV(IsSupportedKeySystem(WebString::fromUTF8(kWidevineAlpha))); |
| 548 #endif | |
| 549 | |
| 550 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType( | 544 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType( |
| 551 "video/webm", no_codecs(), kWidevineAlpha)); | 545 "video/webm", no_codecs(), kWidevineAlpha)); |
| 552 | 546 |
| 553 #if defined(WIDEVINE_CDM_AVAILABLE) | 547 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 554 const char* const kWidevineUmaName = "Widevine"; | 548 const char* const kWidevineUmaName = "Widevine"; |
| 555 #else | 549 #else |
| 556 const char* const kWidevineUmaName = "Unknown"; | 550 const char* const kWidevineUmaName = "Unknown"; |
| 557 #endif | 551 #endif |
| 558 EXPECT_STREQ( | 552 EXPECT_STREQ( |
| 559 kWidevineUmaName, | 553 kWidevineUmaName, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 570 #else | 564 #else |
| 571 EXPECT_TRUE(GetPepperType(kWidevineAlpha).empty()); | 565 EXPECT_TRUE(GetPepperType(kWidevineAlpha).empty()); |
| 572 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 566 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
| 573 #endif // defined(ENABLE_PEPPER_CDMS) | 567 #endif // defined(ENABLE_PEPPER_CDMS) |
| 574 | 568 |
| 575 } | 569 } |
| 576 | 570 |
| 577 TEST_F(KeySystemsTest, Widevine_Parent) { | 571 TEST_F(KeySystemsTest, Widevine_Parent) { |
| 578 const char* const kWidevineParent = kWidevine; | 572 const char* const kWidevineParent = kWidevine; |
| 579 | 573 |
| 580 #if defined(WIDEVINE_CDM_AVAILABLE) && \ | |
| 581 defined(DISABLE_WIDEVINE_CDM_CANPLAYTYPE) | |
| 582 EXPECT_TRUE(IsSupportedKeySystem(WebString::fromUTF8(kWidevineParent))); | |
| 583 #else | |
| 584 EXPECT_WV(IsSupportedKeySystem(WebString::fromUTF8(kWidevineParent))); | 574 EXPECT_WV(IsSupportedKeySystem(WebString::fromUTF8(kWidevineParent))); |
| 585 #endif | |
| 586 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType( | 575 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType( |
| 587 "video/webm", no_codecs(), kWidevineParent)); | 576 "video/webm", no_codecs(), kWidevineParent)); |
| 588 | 577 |
| 589 // The parent is not supported for most things. | 578 // The parent is not supported for most things. |
| 590 EXPECT_STREQ("Unknown", | 579 EXPECT_STREQ("Unknown", |
| 591 KeySystemNameForUMA(std::string(kWidevineParent)).c_str()); | 580 KeySystemNameForUMA(std::string(kWidevineParent)).c_str()); |
| 592 EXPECT_STREQ("Unknown", | 581 EXPECT_STREQ("Unknown", |
| 593 KeySystemNameForUMA(WebString::fromUTF8(kWidevineParent)).c_str()); | 582 KeySystemNameForUMA(WebString::fromUTF8(kWidevineParent)).c_str()); |
| 594 EXPECT_FALSE(CanUseAesDecryptor(kWidevineParent)); | 583 EXPECT_FALSE(CanUseAesDecryptor(kWidevineParent)); |
| 595 #if defined(ENABLE_PEPPER_CDMS) | 584 #if defined(ENABLE_PEPPER_CDMS) |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 } | 765 } |
| 777 | 766 |
| 778 TEST_F(KeySystemsTest, GetUUID_Unrecognized) { | 767 TEST_F(KeySystemsTest, GetUUID_Unrecognized) { |
| 779 EXPECT_TRUE(GetUUID(kWidevine).empty()); | 768 EXPECT_TRUE(GetUUID(kWidevine).empty()); |
| 780 EXPECT_TRUE(GetUUID(kClearKey).empty()); | 769 EXPECT_TRUE(GetUUID(kClearKey).empty()); |
| 781 EXPECT_TRUE(GetUUID("").empty()); | 770 EXPECT_TRUE(GetUUID("").empty()); |
| 782 } | 771 } |
| 783 #endif // defined(OS_ANDROID) | 772 #endif // defined(OS_ANDROID) |
| 784 | 773 |
| 785 } // namespace webkit_media | 774 } // namespace webkit_media |
| OLD | NEW |