OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/Source/Platform/chromium/public/WebString.h" | 9 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" |
10 #include "webkit/media/crypto/key_systems.h" | 10 #include "webkit/media/crypto/key_systems.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 226 |
227 // There are no child key systems for Clear Key. | 227 // There are no child key systems for Clear Key. |
228 EXPECT_FALSE(IsSupportedKeySystem("webkit-org.w3.clearkey.foo")); | 228 EXPECT_FALSE(IsSupportedKeySystem("webkit-org.w3.clearkey.foo")); |
229 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 229 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
230 "video/webm", no_codecs(), "webkit-org.w3.clearkey.foo")); | 230 "video/webm", no_codecs(), "webkit-org.w3.clearkey.foo")); |
231 } | 231 } |
232 | 232 |
233 TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_ClearKey_NoType) { | 233 TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_ClearKey_NoType) { |
234 // These two should be true. See http://crbug.com/164303. | 234 // These two should be true. See http://crbug.com/164303. |
235 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 235 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
236 "", no_codecs(), kClearKey)); | 236 std::string(), no_codecs(), kClearKey)); |
237 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 237 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
238 "", no_codecs(), "webkit-org.w3")); | 238 std::string(), no_codecs(), "webkit-org.w3")); |
239 | 239 |
240 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 240 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
241 "", no_codecs(), "webkit-org.w3.foo")); | 241 std::string(), no_codecs(), "webkit-org.w3.foo")); |
242 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 242 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
243 "", no_codecs(), "webkit-org.w3.clearkey.foo")); | 243 std::string(), no_codecs(), "webkit-org.w3.clearkey.foo")); |
244 } | 244 } |
245 | 245 |
246 TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_ClearKey_WebM) { | 246 TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_ClearKey_WebM) { |
247 // Valid video types. | 247 // Valid video types. |
248 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 248 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
249 "video/webm", no_codecs(), kClearKey)); | 249 "video/webm", no_codecs(), kClearKey)); |
250 // The parent should be supported but is not. See http://crbug.com/164303. | 250 // The parent should be supported but is not. See http://crbug.com/164303. |
251 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 251 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
252 "video/webm", no_codecs(), "webkit-org.w3")); | 252 "video/webm", no_codecs(), "webkit-org.w3")); |
253 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 253 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 EXPECT_FALSE(IsSupportedKeySystem("org.chromium.externalclearkey.foo")); | 412 EXPECT_FALSE(IsSupportedKeySystem("org.chromium.externalclearkey.foo")); |
413 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 413 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
414 "video/webm", no_codecs(), | 414 "video/webm", no_codecs(), |
415 "org.chromium.externalclearkey.foo")); | 415 "org.chromium.externalclearkey.foo")); |
416 } | 416 } |
417 | 417 |
418 TEST_F(KeySystemsTest, | 418 TEST_F(KeySystemsTest, |
419 IsSupportedKeySystemWithMediaMimeType_ExternalClearKey_NoType) { | 419 IsSupportedKeySystemWithMediaMimeType_ExternalClearKey_NoType) { |
420 // These two should be true. See http://crbug.com/164303. | 420 // These two should be true. See http://crbug.com/164303. |
421 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 421 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
422 "", no_codecs(), kExternalClearKey)); | 422 std::string(), no_codecs(), kExternalClearKey)); |
423 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 423 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
424 "", no_codecs(), "org.chromium")); | 424 std::string(), no_codecs(), "org.chromium")); |
425 | 425 |
426 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 426 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
427 "", no_codecs(), "org.chromium.foo")); | 427 std::string(), no_codecs(), "org.chromium.foo")); |
428 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 428 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
429 "", no_codecs(), "org.chromium.externalclearkey.foo")); | 429 std::string(), no_codecs(), "org.chromium.externalclearkey.foo")); |
430 } | 430 } |
431 | 431 |
432 TEST_F(KeySystemsTest, | 432 TEST_F(KeySystemsTest, |
433 IsSupportedKeySystemWithMediaMimeType_ExternalClearKey_WebM) { | 433 IsSupportedKeySystemWithMediaMimeType_ExternalClearKey_WebM) { |
434 // Valid video types. | 434 // Valid video types. |
435 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 435 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
436 "video/webm", no_codecs(), kExternalClearKey)); | 436 "video/webm", no_codecs(), kExternalClearKey)); |
437 // The parent should be supported but is not. See http://crbug.com/164303. | 437 // The parent should be supported but is not. See http://crbug.com/164303. |
438 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 438 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
439 "video/webm", no_codecs(), "org.chromium")); | 439 "video/webm", no_codecs(), "org.chromium")); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 | 599 |
600 // There are no child key systems for Widevine Alpha. | 600 // There are no child key systems for Widevine Alpha. |
601 EXPECT_FALSE(IsSupportedKeySystem("com.widevine.alpha.foo")); | 601 EXPECT_FALSE(IsSupportedKeySystem("com.widevine.alpha.foo")); |
602 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 602 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
603 "video/webm", no_codecs(), "com.widevine.alpha.foo")); | 603 "video/webm", no_codecs(), "com.widevine.alpha.foo")); |
604 } | 604 } |
605 | 605 |
606 TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_Widevine_NoType) { | 606 TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_Widevine_NoType) { |
607 // These two should be true. See http://crbug.com/164303. | 607 // These two should be true. See http://crbug.com/164303. |
608 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 608 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
609 "", no_codecs(), kWidevineAlpha)); | 609 std::string(), no_codecs(), kWidevineAlpha)); |
610 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 610 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
611 "", no_codecs(), kWidevine)); | 611 std::string(), no_codecs(), kWidevine)); |
612 | 612 |
613 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 613 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
614 "", no_codecs(), "com.widevine.foo")); | 614 std::string(), no_codecs(), "com.widevine.foo")); |
615 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 615 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
616 "", no_codecs(), "com.widevine.alpha.foo")); | 616 std::string(), no_codecs(), "com.widevine.alpha.foo")); |
617 } | 617 } |
618 | 618 |
619 TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_Widevine_WebM) { | 619 TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_Widevine_WebM) { |
620 // Valid video types. | 620 // Valid video types. |
621 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType( | 621 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType( |
622 "video/webm", no_codecs(), kWidevineAlpha)); | 622 "video/webm", no_codecs(), kWidevineAlpha)); |
623 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType( | 623 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType( |
624 "video/webm", vp8_codec(), kWidevineAlpha)); | 624 "video/webm", vp8_codec(), kWidevineAlpha)); |
625 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType( | 625 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType( |
626 "video/webm", vp80_codec(), kWidevineAlpha)); | 626 "video/webm", vp80_codec(), kWidevineAlpha)); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 "audio/mp4", avc1_codec(), kWidevineAlpha)); | 729 "audio/mp4", avc1_codec(), kWidevineAlpha)); |
730 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 730 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
731 "audio/mp4", avc1_and_aac_codecs(), kWidevineAlpha)); | 731 "audio/mp4", avc1_and_aac_codecs(), kWidevineAlpha)); |
732 | 732 |
733 // Non-MP4 codec. | 733 // Non-MP4 codec. |
734 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 734 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
735 "audio/mp4", vorbis_codec(), kWidevineAlpha)); | 735 "audio/mp4", vorbis_codec(), kWidevineAlpha)); |
736 } | 736 } |
737 | 737 |
738 } // namespace webkit_media | 738 } // namespace webkit_media |
OLD | NEW |