OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
ddorwin
2015/03/24 22:36:36
Do we have a test for an empty codec (417461)?
sandersd (OOO until July 31)
2015/03/24 23:26:36
No, I was planning to do that as part of an overal
ddorwin
2015/03/24 23:48:04
TODO along with a reference to the bug for context
sandersd (OOO until July 31)
2015/03/24 23:57:21
Done.
| |
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 "base/logging.h" | 8 #include "base/logging.h" |
9 #include "media/base/eme_constants.h" | 9 #include "media/base/eme_constants.h" |
10 #include "media/base/key_system_info.h" | 10 #include "media/base/key_system_info.h" |
11 #include "media/base/key_systems.h" | 11 #include "media/base/key_systems.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 TEST_CODEC_FOO_AUDIO = 1 << 10, // An audio codec for foo container. | 57 TEST_CODEC_FOO_AUDIO = 1 << 10, // An audio codec for foo container. |
58 TEST_CODEC_FOO_AUDIO_ALL = TEST_CODEC_FOO_AUDIO, | 58 TEST_CODEC_FOO_AUDIO_ALL = TEST_CODEC_FOO_AUDIO, |
59 TEST_CODEC_FOO_VIDEO = 1 << 11, // A video codec for foo container. | 59 TEST_CODEC_FOO_VIDEO = 1 << 11, // A video codec for foo container. |
60 TEST_CODEC_FOO_VIDEO_ALL = TEST_CODEC_FOO_VIDEO, | 60 TEST_CODEC_FOO_VIDEO_ALL = TEST_CODEC_FOO_VIDEO, |
61 TEST_CODEC_FOO_ALL = TEST_CODEC_FOO_AUDIO_ALL | TEST_CODEC_FOO_VIDEO_ALL | 61 TEST_CODEC_FOO_ALL = TEST_CODEC_FOO_AUDIO_ALL | TEST_CODEC_FOO_VIDEO_ALL |
62 }; | 62 }; |
63 | 63 |
64 static_assert((TEST_CODEC_FOO_ALL & EME_CODEC_ALL) == EME_CODEC_NONE, | 64 static_assert((TEST_CODEC_FOO_ALL & EME_CODEC_ALL) == EME_CODEC_NONE, |
65 "test codec masks should only use invalid codec masks"); | 65 "test codec masks should only use invalid codec masks"); |
66 | 66 |
67 // Adapt IsSupportedKeySystemWithMediaMimeType() to the new API, | |
68 // IsSupportedCodecCombination(). | |
69 static bool IsSupportedKeySystemWithMediaMimeType( | |
70 const std::string& mime_type, | |
71 const std::vector<std::string>& codecs, | |
72 const std::string& key_system) { | |
73 return KeySystems::GetInstance().IsSupportedCodecCombination( | |
74 key_system, EmeMediaType::VIDEO, mime_type, codecs); | |
75 } | |
76 | |
77 static bool IsSupportedKeySystemWithAudioMimeType( | |
78 const std::string& mime_type, | |
79 const std::vector<std::string>& codecs, | |
80 const std::string& key_system) { | |
81 return KeySystems::GetInstance().IsSupportedCodecCombination( | |
82 key_system, EmeMediaType::AUDIO, mime_type, codecs); | |
83 } | |
84 | |
67 // Adds test container and codec masks. | 85 // Adds test container and codec masks. |
68 // This function must be called after SetMediaClient() if a MediaClient will be | 86 // This function must be called after SetMediaClient() if a MediaClient will be |
69 // provided. | 87 // provided. |
70 // More details: AddXxxMask() will create KeySystems if it hasn't been created. | 88 // More details: AddXxxMask() will create KeySystems if it hasn't been created. |
71 // During KeySystems's construction GetMediaClient() will be used to add key | 89 // During KeySystems's construction GetMediaClient() will be used to add key |
72 // systems. In test code, the MediaClient is set by SetMediaClient(). | 90 // systems. In test code, the MediaClient is set by SetMediaClient(). |
73 // Therefore, SetMediaClient() must be called before this function to make sure | 91 // Therefore, SetMediaClient() must be called before this function to make sure |
74 // MediaClient in effect when constructing KeySystems. | 92 // MediaClient in effect when constructing KeySystems. |
75 static void AddContainerAndCodecMasksForTest() { | 93 static void AddContainerAndCodecMasksForTest() { |
76 // Since KeySystems is a singleton. Make sure we only add test container and | 94 // Since KeySystems is a singleton. Make sure we only add test container and |
77 // codec masks once per process. | 95 // codec masks once per process. |
78 static bool is_test_masks_added = false; | 96 static bool is_test_masks_added = false; |
79 | 97 |
80 if (is_test_masks_added) | 98 if (is_test_masks_added) |
81 return; | 99 return; |
82 | 100 |
83 AddContainerMask("audio/foo", TEST_CODEC_FOO_AUDIO_ALL); | 101 AddContainerMask("audio/foo", TEST_CODEC_FOO_AUDIO_ALL); |
84 AddContainerMask("video/foo", TEST_CODEC_FOO_ALL); | 102 AddContainerMask("video/foo", TEST_CODEC_FOO_ALL); |
85 AddCodecMask("fooaudio", TEST_CODEC_FOO_AUDIO); | 103 AddCodecMask(EmeMediaType::AUDIO, "fooaudio", TEST_CODEC_FOO_AUDIO); |
86 AddCodecMask("foovideo", TEST_CODEC_FOO_VIDEO); | 104 AddCodecMask(EmeMediaType::VIDEO, "foovideo", TEST_CODEC_FOO_VIDEO); |
87 | 105 |
88 is_test_masks_added = true; | 106 is_test_masks_added = true; |
89 } | 107 } |
90 | 108 |
91 class TestMediaClient : public MediaClient { | 109 class TestMediaClient : public MediaClient { |
92 public: | 110 public: |
93 TestMediaClient(); | 111 TestMediaClient(); |
94 ~TestMediaClient() override; | 112 ~TestMediaClient() override; |
95 | 113 |
96 // MediaClient implementation. | 114 // MediaClient implementation. |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
331 | 349 |
332 CodecVector mixed_codecs_; | 350 CodecVector mixed_codecs_; |
333 | 351 |
334 TestMediaClient test_media_client_; | 352 TestMediaClient test_media_client_; |
335 }; | 353 }; |
336 | 354 |
337 // TODO(ddorwin): Consider moving GetPepperType() calls out to their own test. | 355 // TODO(ddorwin): Consider moving GetPepperType() calls out to their own test. |
338 | 356 |
339 TEST_F(KeySystemsTest, EmptyKeySystem) { | 357 TEST_F(KeySystemsTest, EmptyKeySystem) { |
340 EXPECT_FALSE(IsSupportedKeySystem(std::string())); | 358 EXPECT_FALSE(IsSupportedKeySystem(std::string())); |
341 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
342 kVideoWebM, no_codecs(), std::string())); | |
343 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(std::string())); | 359 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(std::string())); |
ddorwin
2015/03/24 22:36:36
What was wrong with the removed line?
sandersd (OOO until July 31)
2015/03/24 23:26:36
IsSupportedCodecCombination() DCHECKs that |key_sy
| |
344 } | 360 } |
345 | 361 |
346 // Clear Key is the only key system registered in content. | 362 // Clear Key is the only key system registered in content. |
347 TEST_F(KeySystemsTest, ClearKey) { | 363 TEST_F(KeySystemsTest, ClearKey) { |
348 EXPECT_TRUE(IsSupportedKeySystem(kClearKey)); | 364 EXPECT_TRUE(IsSupportedKeySystem(kClearKey)); |
349 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 365 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
350 kVideoWebM, no_codecs(), kClearKey)); | 366 kVideoWebM, no_codecs(), kClearKey)); |
351 | 367 |
352 EXPECT_EQ("ClearKey", GetKeySystemNameForUMA(kClearKey)); | 368 EXPECT_EQ("ClearKey", GetKeySystemNameForUMA(kClearKey)); |
353 | 369 |
354 // Prefixed Clear Key is not supported internally. | 370 // Prefixed Clear Key is not supported internally. |
355 EXPECT_FALSE(IsSupportedKeySystem(kPrefixedClearKey)); | 371 EXPECT_FALSE(IsSupportedKeySystem(kPrefixedClearKey)); |
356 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
357 kVideoWebM, no_codecs(), kPrefixedClearKey)); | |
358 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kPrefixedClearKey)); | 372 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kPrefixedClearKey)); |
359 } | 373 } |
360 | 374 |
361 // The key system is not registered and therefore is unrecognized. | 375 // The key system is not registered and therefore is unrecognized. |
362 TEST_F(KeySystemsTest, Basic_UnrecognizedKeySystem) { | 376 TEST_F(KeySystemsTest, Basic_UnrecognizedKeySystem) { |
363 static const char* const kUnrecognized = "x-org.example.unrecognized"; | 377 static const char* const kUnrecognized = "x-org.example.unrecognized"; |
364 | 378 |
365 EXPECT_FALSE(IsSupportedKeySystem(kUnrecognized)); | 379 EXPECT_FALSE(IsSupportedKeySystem(kUnrecognized)); |
366 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
367 kVideoWebM, no_codecs(), kUnrecognized)); | |
368 | 380 |
ddorwin
2015/03/24 22:36:36
Ditto
| |
369 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kUnrecognized)); | 381 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kUnrecognized)); |
370 | 382 |
371 bool can_use = false; | 383 bool can_use = false; |
372 EXPECT_DEBUG_DEATH_PORTABLE( | 384 EXPECT_DEBUG_DEATH_PORTABLE( |
373 can_use = CanUseAesDecryptor(kUnrecognized), | 385 can_use = CanUseAesDecryptor(kUnrecognized), |
374 "x-org.example.unrecognized is not a known concrete system"); | 386 "x-org.example.unrecognized is not a known concrete system"); |
375 EXPECT_FALSE(can_use); | 387 EXPECT_FALSE(can_use); |
376 | 388 |
377 #if defined(ENABLE_PEPPER_CDMS) | 389 #if defined(ENABLE_PEPPER_CDMS) |
378 std::string type; | 390 std::string type; |
(...skipping 22 matching lines...) Expand all Loading... | |
401 } | 413 } |
402 | 414 |
403 TEST_F(KeySystemsTest, | 415 TEST_F(KeySystemsTest, |
404 IsSupportedKeySystemWithMediaMimeType_UsesAesDecryptor_TypesContainer1) { | 416 IsSupportedKeySystemWithMediaMimeType_UsesAesDecryptor_TypesContainer1) { |
405 // Valid video types. | 417 // Valid video types. |
406 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 418 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
407 kVideoWebM, vp8_codec(), kUsesAes)); | 419 kVideoWebM, vp8_codec(), kUsesAes)); |
408 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 420 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
409 kVideoWebM, vp80_codec(), kUsesAes)); | 421 kVideoWebM, vp80_codec(), kUsesAes)); |
410 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 422 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
411 kVideoWebM, vp8_and_vorbis_codecs(), kUsesAes)); | |
412 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | |
413 kVideoWebM, vp9_codec(), kUsesAes)); | 423 kVideoWebM, vp9_codec(), kUsesAes)); |
414 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 424 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
415 kVideoWebM, vp90_codec(), kUsesAes)); | 425 kVideoWebM, vp90_codec(), kUsesAes)); |
416 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 426 |
427 // Audio in a video container. | |
428 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
429 kVideoWebM, vp8_and_vorbis_codecs(), kUsesAes)); | |
430 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
417 kVideoWebM, vp9_and_vorbis_codecs(), kUsesAes)); | 431 kVideoWebM, vp9_and_vorbis_codecs(), kUsesAes)); |
418 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 432 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
419 kVideoWebM, vorbis_codec(), kUsesAes)); | 433 kVideoWebM, vorbis_codec(), kUsesAes)); |
420 | 434 |
421 // Non-Webm codecs. | 435 // Non-Webm codecs. |
422 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 436 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
423 kVideoWebM, foovideo_codec(), kUsesAes)); | 437 kVideoWebM, foovideo_codec(), kUsesAes)); |
424 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 438 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
425 kVideoWebM, unknown_codec(), kUsesAes)); | 439 kVideoWebM, unknown_codec(), kUsesAes)); |
426 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 440 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
427 kVideoWebM, mixed_codecs(), kUsesAes)); | 441 kVideoWebM, mixed_codecs(), kUsesAes)); |
428 | 442 |
429 // Valid audio types. | 443 // Valid audio types. |
430 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 444 EXPECT_TRUE(IsSupportedKeySystemWithAudioMimeType( |
431 kAudioWebM, no_codecs(), kUsesAes)); | 445 kAudioWebM, no_codecs(), kUsesAes)); |
432 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 446 EXPECT_TRUE(IsSupportedKeySystemWithAudioMimeType( |
433 kAudioWebM, vorbis_codec(), kUsesAes)); | 447 kAudioWebM, vorbis_codec(), kUsesAes)); |
434 | 448 |
435 // Non-audio codecs. | 449 // Non-audio codecs. |
436 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 450 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
437 kAudioWebM, vp8_codec(), kUsesAes)); | 451 kAudioWebM, vp8_codec(), kUsesAes)); |
438 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 452 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
439 kAudioWebM, vp8_and_vorbis_codecs(), kUsesAes)); | 453 kAudioWebM, vp8_and_vorbis_codecs(), kUsesAes)); |
440 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 454 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
441 kAudioWebM, vp9_codec(), kUsesAes)); | 455 kAudioWebM, vp9_codec(), kUsesAes)); |
442 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 456 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
443 kAudioWebM, vp9_and_vorbis_codecs(), kUsesAes)); | 457 kAudioWebM, vp9_and_vorbis_codecs(), kUsesAes)); |
444 | 458 |
445 // Non-Webm codec. | 459 // Non-Webm codec. |
446 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 460 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( |
447 kAudioWebM, fooaudio_codec(), kUsesAes)); | 461 kAudioWebM, fooaudio_codec(), kUsesAes)); |
448 } | 462 } |
449 | 463 |
450 // No parent is registered for UsesAes. | 464 // No parent is registered for UsesAes. |
451 TEST_F(KeySystemsTest, Parent_NoParentRegistered) { | 465 TEST_F(KeySystemsTest, Parent_NoParentRegistered) { |
452 EXPECT_FALSE(IsSupportedKeySystem(kUsesAesParent)); | 466 EXPECT_FALSE(IsSupportedKeySystem(kUsesAesParent)); |
453 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
454 kVideoWebM, no_codecs(), kUsesAesParent)); | |
455 | 467 |
456 // The parent is not supported for most things. | 468 // The parent is not supported for most things. |
457 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kUsesAesParent)); | 469 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kUsesAesParent)); |
458 bool result = false; | 470 bool result = false; |
459 EXPECT_DEBUG_DEATH_PORTABLE(result = CanUseAesDecryptor(kUsesAesParent), | 471 EXPECT_DEBUG_DEATH_PORTABLE(result = CanUseAesDecryptor(kUsesAesParent), |
460 "x-org.example is not a known concrete system"); | 472 "x-org.example is not a known concrete system"); |
461 EXPECT_FALSE(result); | 473 EXPECT_FALSE(result); |
462 #if defined(ENABLE_PEPPER_CDMS) | 474 #if defined(ENABLE_PEPPER_CDMS) |
463 std::string type; | 475 std::string type; |
464 EXPECT_DEBUG_DEATH(type = GetPepperType(kUsesAesParent), | 476 EXPECT_DEBUG_DEATH(type = GetPepperType(kUsesAesParent), |
465 "x-org.example is not a known concrete system"); | 477 "x-org.example is not a known concrete system"); |
466 EXPECT_TRUE(type.empty()); | 478 EXPECT_TRUE(type.empty()); |
467 #endif | 479 #endif |
468 } | 480 } |
469 | 481 |
470 TEST_F(KeySystemsTest, IsSupportedKeySystem_InvalidVariants) { | 482 TEST_F(KeySystemsTest, IsSupportedKeySystem_InvalidVariants) { |
471 // Case sensitive. | 483 // Case sensitive. |
472 EXPECT_FALSE(IsSupportedKeySystem("x-org.example.ClEaR")); | 484 EXPECT_FALSE(IsSupportedKeySystem("x-org.example.ClEaR")); |
473 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(kVideoWebM, no_codecs(), | |
474 "x-org.example.ClEaR")); | |
475 | 485 |
476 // TLDs are not allowed. | 486 // TLDs are not allowed. |
477 EXPECT_FALSE(IsSupportedKeySystem("org.")); | 487 EXPECT_FALSE(IsSupportedKeySystem("org.")); |
478 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
479 kVideoWebM, no_codecs(), "org.")); | |
480 EXPECT_FALSE(IsSupportedKeySystem("com")); | 488 EXPECT_FALSE(IsSupportedKeySystem("com")); |
481 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
482 kVideoWebM, no_codecs(), "com")); | |
483 | 489 |
484 // Extra period. | 490 // Extra period. |
485 EXPECT_FALSE(IsSupportedKeySystem("x-org.example.clear.")); | 491 EXPECT_FALSE(IsSupportedKeySystem("x-org.example.clear.")); |
486 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(kVideoWebM, no_codecs(), | |
487 "x-org.example.clear.")); | |
488 EXPECT_FALSE(IsSupportedKeySystem("x-org.example.")); | 492 EXPECT_FALSE(IsSupportedKeySystem("x-org.example.")); |
489 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(kVideoWebM, no_codecs(), | |
490 "x-org.example.")); | |
491 | 493 |
492 // Incomplete. | 494 // Incomplete. |
493 EXPECT_FALSE(IsSupportedKeySystem("x-org.example.clea")); | 495 EXPECT_FALSE(IsSupportedKeySystem("x-org.example.clea")); |
494 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(kVideoWebM, no_codecs(), | |
495 "x-org.example.clea")); | |
496 | 496 |
497 // Extra character. | 497 // Extra character. |
498 EXPECT_FALSE(IsSupportedKeySystem("x-org.example.clearz")); | 498 EXPECT_FALSE(IsSupportedKeySystem("x-org.example.clearz")); |
499 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(kVideoWebM, no_codecs(), | |
500 "x-org.example.clearz")); | |
501 | 499 |
502 // There are no child key systems for UsesAes. | 500 // There are no child key systems for UsesAes. |
503 EXPECT_FALSE(IsSupportedKeySystem("x-org.example.clear.foo")); | 501 EXPECT_FALSE(IsSupportedKeySystem("x-org.example.clear.foo")); |
504 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
505 kVideoWebM, no_codecs(), "x-org.example.clear.foo")); | |
506 } | 502 } |
507 | 503 |
508 TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_NoType) { | 504 TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_NoType) { |
509 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 505 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
510 std::string(), no_codecs(), kUsesAes)); | 506 std::string(), no_codecs(), kUsesAes)); |
511 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 507 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
512 std::string(), no_codecs(), kUsesAesParent)); | 508 std::string(), no_codecs(), kUsesAesParent)); |
513 | 509 |
514 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(std::string(), no_codecs(), | 510 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(std::string(), no_codecs(), |
515 "x-org.example.foo")); | 511 "x-org.example.foo")); |
516 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 512 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
517 std::string(), no_codecs(), "x-org.example.clear.foo")); | 513 std::string(), no_codecs(), "x-org.example.clear.foo")); |
518 } | 514 } |
519 | 515 |
520 // Tests the second registered container type. | 516 // Tests the second registered container type. |
521 // TODO(ddorwin): Combined with TypesContainer1 in a future CL. | 517 // TODO(ddorwin): Combined with TypesContainer1 in a future CL. |
522 TEST_F(KeySystemsTest, | 518 TEST_F(KeySystemsTest, |
523 IsSupportedKeySystemWithMediaMimeType_UsesAesDecryptor_TypesContainer2) { | 519 IsSupportedKeySystemWithMediaMimeType_UsesAesDecryptor_TypesContainer2) { |
524 // Valid video types. | 520 // Valid video types. |
521 EXPECT_TRUE(IsSupportedKeySystem(kUsesAes)); | |
ddorwin
2015/03/24 22:36:36
Already tested at 399 and 466 respectively. Also,
sandersd (OOO until July 31)
2015/03/24 23:26:36
Done.
| |
522 EXPECT_FALSE(IsSupportedKeySystem(kUsesAesParent)); | |
525 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 523 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
526 kVideoFoo, no_codecs(), kUsesAes)); | 524 kVideoFoo, no_codecs(), kUsesAes)); |
527 // The parent should be supported but is not. See http://crbug.com/164303. | |
528 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
529 kVideoFoo, no_codecs(), kUsesAesParent)); | |
530 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 525 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
531 kVideoFoo, foovideo_codec(), kUsesAes)); | 526 kVideoFoo, foovideo_codec(), kUsesAes)); |
532 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 527 |
528 // Audio in a video container. | |
529 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
533 kVideoFoo, foovideo_and_fooaudio_codecs(), kUsesAes)); | 530 kVideoFoo, foovideo_and_fooaudio_codecs(), kUsesAes)); |
534 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 531 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
535 kVideoFoo, fooaudio_codec(), kUsesAes)); | 532 kVideoFoo, fooaudio_codec(), kUsesAes)); |
536 | 533 |
537 // Extended codecs fail because this is handled by SimpleWebMimeRegistryImpl. | 534 // Extended codecs fail because this is handled by SimpleWebMimeRegistryImpl. |
538 // They should really pass canPlayType(). | 535 // They should really pass canPlayType(). |
539 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 536 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
540 kVideoFoo, foovideo_extended_codec(), kUsesAes)); | 537 kVideoFoo, foovideo_extended_codec(), kUsesAes)); |
541 | 538 |
542 // Invalid codec format. | 539 // Invalid codec format. |
543 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 540 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
544 kVideoFoo, foovideo_dot_codec(), kUsesAes)); | 541 kVideoFoo, foovideo_dot_codec(), kUsesAes)); |
545 | 542 |
546 // Non-container2 codec. | 543 // Non-container2 codec. |
547 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 544 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
548 kVideoFoo, vp8_codec(), kUsesAes)); | 545 kVideoFoo, vp8_codec(), kUsesAes)); |
549 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 546 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
550 kVideoFoo, unknown_codec(), kUsesAes)); | 547 kVideoFoo, unknown_codec(), kUsesAes)); |
551 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 548 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
552 kVideoFoo, mixed_codecs(), kUsesAes)); | 549 kVideoFoo, mixed_codecs(), kUsesAes)); |
553 | 550 |
554 // Valid audio types. | 551 // Valid audio types. |
555 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 552 EXPECT_TRUE(IsSupportedKeySystemWithAudioMimeType( |
556 kAudioFoo, no_codecs(), kUsesAes)); | 553 kAudioFoo, no_codecs(), kUsesAes)); |
557 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 554 EXPECT_TRUE(IsSupportedKeySystemWithAudioMimeType( |
558 kAudioFoo, fooaudio_codec(), kUsesAes)); | 555 kAudioFoo, fooaudio_codec(), kUsesAes)); |
559 | 556 |
560 // Non-audio codecs. | 557 // Non-audio codecs. |
561 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 558 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( |
562 kAudioFoo, foovideo_codec(), kUsesAes)); | 559 kAudioFoo, foovideo_codec(), kUsesAes)); |
563 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 560 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( |
564 kAudioFoo, foovideo_and_fooaudio_codecs(), kUsesAes)); | 561 kAudioFoo, foovideo_and_fooaudio_codecs(), kUsesAes)); |
565 | 562 |
566 // Non-container2 codec. | 563 // Non-container2 codec. |
567 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 564 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( |
568 kAudioFoo, vorbis_codec(), kUsesAes)); | 565 kAudioFoo, vorbis_codec(), kUsesAes)); |
569 } | 566 } |
570 | 567 |
571 // | 568 // |
572 // Non-AesDecryptor-based key system. | 569 // Non-AesDecryptor-based key system. |
573 // | 570 // |
574 | 571 |
575 TEST_F(KeySystemsTest, Basic_ExternalDecryptor) { | 572 TEST_F(KeySystemsTest, Basic_ExternalDecryptor) { |
576 EXPECT_TRUE(IsSupportedKeySystem(kExternal)); | 573 EXPECT_TRUE(IsSupportedKeySystem(kExternal)); |
577 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 574 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
578 kVideoWebM, no_codecs(), kExternal)); | 575 kVideoWebM, no_codecs(), kExternal)); |
579 | 576 |
580 EXPECT_FALSE(CanUseAesDecryptor(kExternal)); | 577 EXPECT_FALSE(CanUseAesDecryptor(kExternal)); |
581 #if defined(ENABLE_PEPPER_CDMS) | 578 #if defined(ENABLE_PEPPER_CDMS) |
582 EXPECT_EQ("application/x-ppapi-external-cdm", GetPepperType(kExternal)); | 579 EXPECT_EQ("application/x-ppapi-external-cdm", GetPepperType(kExternal)); |
583 #endif // defined(ENABLE_PEPPER_CDMS) | 580 #endif // defined(ENABLE_PEPPER_CDMS) |
584 } | 581 } |
585 | 582 |
586 TEST_F(KeySystemsTest, Parent_ParentRegistered) { | 583 TEST_F(KeySystemsTest, Parent_ParentRegistered) { |
587 // The parent system is not a concrete system but is supported. | 584 // The parent system is not a concrete system but is supported. |
ddorwin
2015/03/24 22:36:36
// Unprefixed has no parent key system support.
sandersd (OOO until July 31)
2015/03/24 23:26:36
Done.
| |
588 EXPECT_FALSE(IsSupportedKeySystem(kExternalParent)); | 585 EXPECT_FALSE(IsSupportedKeySystem(kExternalParent)); |
589 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
590 kVideoWebM, no_codecs(), kExternalParent)); | |
591 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | 586 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
592 kVideoWebM, no_codecs(), kExternalParent)); | 587 kVideoWebM, no_codecs(), kExternalParent)); |
593 | 588 |
594 // The parent is not supported for most things. | 589 // The parent is not supported for most things. |
595 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kExternalParent)); | 590 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kExternalParent)); |
596 bool result = false; | 591 bool result = false; |
597 EXPECT_DEBUG_DEATH_PORTABLE(result = CanUseAesDecryptor(kExternalParent), | 592 EXPECT_DEBUG_DEATH_PORTABLE(result = CanUseAesDecryptor(kExternalParent), |
598 "x-com.example is not a known concrete system"); | 593 "x-com.example is not a known concrete system"); |
599 EXPECT_FALSE(result); | 594 EXPECT_FALSE(result); |
600 #if defined(ENABLE_PEPPER_CDMS) | 595 #if defined(ENABLE_PEPPER_CDMS) |
601 std::string type; | 596 std::string type; |
602 EXPECT_DEBUG_DEATH(type = GetPepperType(kExternalParent), | 597 EXPECT_DEBUG_DEATH(type = GetPepperType(kExternalParent), |
603 "x-com.example is not a known concrete system"); | 598 "x-com.example is not a known concrete system"); |
604 EXPECT_TRUE(type.empty()); | 599 EXPECT_TRUE(type.empty()); |
605 #endif | 600 #endif |
606 } | 601 } |
607 | 602 |
608 TEST_F( | 603 TEST_F( |
609 KeySystemsTest, | 604 KeySystemsTest, |
610 IsSupportedKeySystemWithMediaMimeType_ExternalDecryptor_TypesContainer1) { | 605 IsSupportedKeySystemWithMediaMimeType_ExternalDecryptor_TypesContainer1) { |
611 // Valid video types. | 606 // Valid video types. |
607 EXPECT_TRUE(IsSupportedKeySystem(kExternal)); | |
ddorwin
2015/03/24 22:36:36
Already tested at 573. Also, not video.
sandersd (OOO until July 31)
2015/03/24 23:26:36
Done.
| |
612 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 608 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
613 kVideoWebM, no_codecs(), kExternal)); | 609 kVideoWebM, no_codecs(), kExternal)); |
614 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 610 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
615 kVideoWebM, vp8_codec(), kExternal)); | 611 kVideoWebM, vp8_codec(), kExternal)); |
616 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 612 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
617 kVideoWebM, vp80_codec(), kExternal)); | 613 kVideoWebM, vp80_codec(), kExternal)); |
618 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 614 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
619 kVideoWebM, vp8_and_vorbis_codecs(), kExternal)); | |
620 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | |
621 kVideoWebM, vp9_codec(), kExternal)); | 615 kVideoWebM, vp9_codec(), kExternal)); |
622 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 616 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
623 kVideoWebM, vp90_codec(), kExternal)); | 617 kVideoWebM, vp90_codec(), kExternal)); |
624 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 618 |
619 // Audio in a video container. | |
620 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
621 kVideoWebM, vp8_and_vorbis_codecs(), kExternal)); | |
622 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
625 kVideoWebM, vp9_and_vorbis_codecs(), kExternal)); | 623 kVideoWebM, vp9_and_vorbis_codecs(), kExternal)); |
626 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 624 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
627 kVideoWebM, vorbis_codec(), kExternal)); | 625 kVideoWebM, vorbis_codec(), kExternal)); |
628 | 626 |
629 // Valid video types - parent key system. | 627 // Valid video types - parent key system. |
630 // Unprefixed has no parent key system support. | 628 // Unprefixed has no parent key system support. |
631 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 629 EXPECT_FALSE(IsSupportedKeySystem(kExternalParent)); |
ddorwin
2015/03/24 22:36:36
Tested at 585 and not video.
sandersd (OOO until July 31)
2015/03/24 23:26:36
Done.
| |
632 kVideoWebM, no_codecs(), kExternalParent)); | |
633 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
634 kVideoWebM, vp8_codec(), kExternalParent)); | |
635 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
636 kVideoWebM, vp80_codec(), kExternalParent)); | |
637 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
638 kVideoWebM, vp8_and_vorbis_codecs(), kExternalParent)); | |
639 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
640 kVideoWebM, vp9_codec(), kExternalParent)); | |
641 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
642 kVideoWebM, vp90_codec(), kExternalParent)); | |
643 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
644 kVideoWebM, vp9_and_vorbis_codecs(), kExternalParent)); | |
645 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
646 kVideoWebM, vorbis_codec(), kExternalParent)); | |
647 // Prefixed has parent key system support. | 630 // Prefixed has parent key system support. |
648 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | 631 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
649 kVideoWebM, no_codecs(), kExternalParent)); | 632 kVideoWebM, no_codecs(), kExternalParent)); |
650 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | 633 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
651 kVideoWebM, vp8_codec(), kExternalParent)); | 634 kVideoWebM, vp8_codec(), kExternalParent)); |
652 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | 635 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
653 kVideoWebM, vp80_codec(), kExternalParent)); | 636 kVideoWebM, vp80_codec(), kExternalParent)); |
654 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | 637 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
655 kVideoWebM, vp8_and_vorbis_codecs(), kExternalParent)); | 638 kVideoWebM, vp8_and_vorbis_codecs(), kExternalParent)); |
656 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | 639 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
657 kVideoWebM, vp9_codec(), kExternalParent)); | 640 kVideoWebM, vp9_codec(), kExternalParent)); |
658 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | 641 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
659 kVideoWebM, vp90_codec(), kExternalParent)); | 642 kVideoWebM, vp90_codec(), kExternalParent)); |
660 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | 643 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
661 kVideoWebM, vp9_and_vorbis_codecs(), kExternalParent)); | 644 kVideoWebM, vp9_and_vorbis_codecs(), kExternalParent)); |
662 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | 645 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
663 kVideoWebM, vorbis_codec(), kExternalParent)); | 646 kVideoWebM, vorbis_codec(), kExternalParent)); |
664 | 647 |
665 // Non-Webm codecs. | 648 // Non-Webm codecs. |
666 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 649 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
667 kVideoWebM, foovideo_codec(), kExternal)); | 650 kVideoWebM, foovideo_codec(), kExternal)); |
668 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 651 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
669 kVideoWebM, unknown_codec(), kExternal)); | 652 kVideoWebM, unknown_codec(), kExternal)); |
670 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 653 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
671 kVideoWebM, mixed_codecs(), kExternal)); | 654 kVideoWebM, mixed_codecs(), kExternal)); |
672 | 655 |
673 // Valid audio types. | 656 // Valid audio types. |
674 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 657 EXPECT_TRUE(IsSupportedKeySystemWithAudioMimeType( |
675 kAudioWebM, no_codecs(), kExternal)); | 658 kAudioWebM, no_codecs(), kExternal)); |
676 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 659 EXPECT_TRUE(IsSupportedKeySystemWithAudioMimeType( |
677 kAudioWebM, vorbis_codec(), kExternal)); | 660 kAudioWebM, vorbis_codec(), kExternal)); |
678 | 661 |
679 // Valid audio types - parent key system. | 662 // Valid audio types - parent key system. |
680 // Unprefixed has no parent key system support. | 663 // Unprefixed has no parent key system support. |
ddorwin
2015/03/24 22:36:36
remove this line
sandersd (OOO until July 31)
2015/03/24 23:26:36
Done.
| |
681 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
682 kAudioWebM, no_codecs(), kExternalParent)); | |
683 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
684 kAudioWebM, vorbis_codec(), kExternalParent)); | |
685 // Prefixed has parent key system support. | 664 // Prefixed has parent key system support. |
686 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | 665 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
687 kAudioWebM, no_codecs(), kExternalParent)); | 666 kAudioWebM, no_codecs(), kExternalParent)); |
688 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | 667 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
689 kAudioWebM, vorbis_codec(), kExternalParent)); | 668 kAudioWebM, vorbis_codec(), kExternalParent)); |
690 | 669 |
691 // Non-audio codecs. | 670 // Non-audio codecs. |
692 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 671 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( |
693 kAudioWebM, vp8_codec(), kExternal)); | 672 kAudioWebM, vp8_codec(), kExternal)); |
694 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 673 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( |
695 kAudioWebM, vp8_and_vorbis_codecs(), kExternal)); | 674 kAudioWebM, vp8_and_vorbis_codecs(), kExternal)); |
696 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 675 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( |
697 kAudioWebM, vp9_codec(), kExternal)); | 676 kAudioWebM, vp9_codec(), kExternal)); |
698 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 677 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( |
699 kAudioWebM, vp9_and_vorbis_codecs(), kExternal)); | 678 kAudioWebM, vp9_and_vorbis_codecs(), kExternal)); |
700 | 679 |
701 // Non-Webm codec. | 680 // Non-Webm codec. |
702 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 681 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( |
703 kAudioWebM, fooaudio_codec(), kExternal)); | 682 kAudioWebM, fooaudio_codec(), kExternal)); |
704 } | 683 } |
705 | 684 |
706 TEST_F( | 685 TEST_F( |
707 KeySystemsTest, | 686 KeySystemsTest, |
708 IsSupportedKeySystemWithMediaMimeType_ExternalDecryptor_TypesContainer2) { | 687 IsSupportedKeySystemWithMediaMimeType_ExternalDecryptor_TypesContainer2) { |
709 // Valid video types. | 688 // Valid video types. |
710 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 689 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
711 kVideoFoo, no_codecs(), kExternal)); | 690 kVideoFoo, no_codecs(), kExternal)); |
712 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 691 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
713 kVideoFoo, foovideo_codec(), kExternal)); | 692 kVideoFoo, foovideo_codec(), kExternal)); |
714 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 693 |
694 // Audio in a video container. | |
695 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
715 kVideoFoo, foovideo_and_fooaudio_codecs(), kExternal)); | 696 kVideoFoo, foovideo_and_fooaudio_codecs(), kExternal)); |
716 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 697 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
717 kVideoFoo, fooaudio_codec(), kExternal)); | 698 kVideoFoo, fooaudio_codec(), kExternal)); |
718 | 699 |
719 // Valid video types - parent key system. | 700 // Valid video types - parent key system. |
720 // Unprefixed has no parent key system support. | 701 // Unprefixed has no parent key system support. |
721 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 702 EXPECT_FALSE(IsSupportedKeySystem(kExternalParent)); |
ddorwin
2015/03/24 22:36:36
Tested at 585 and not video.
sandersd (OOO until July 31)
2015/03/24 23:26:36
Done.
| |
722 kVideoFoo, no_codecs(), kExternalParent)); | |
723 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
724 kVideoFoo, foovideo_codec(), kExternalParent)); | |
725 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
726 kVideoFoo, foovideo_and_fooaudio_codecs(), kExternalParent)); | |
727 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
728 kVideoFoo, fooaudio_codec(), kExternalParent)); | |
729 // Prefixed has parent key system support. | 703 // Prefixed has parent key system support. |
730 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | 704 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
731 kVideoFoo, no_codecs(), kExternalParent)); | 705 kVideoFoo, no_codecs(), kExternalParent)); |
732 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | 706 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
733 kVideoFoo, foovideo_codec(), kExternalParent)); | 707 kVideoFoo, foovideo_codec(), kExternalParent)); |
734 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | 708 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
735 kVideoFoo, foovideo_and_fooaudio_codecs(), kExternalParent)); | 709 kVideoFoo, foovideo_and_fooaudio_codecs(), kExternalParent)); |
736 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | 710 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
737 kVideoFoo, fooaudio_codec(), kExternalParent)); | 711 kVideoFoo, fooaudio_codec(), kExternalParent)); |
738 | 712 |
739 // Extended codecs fail because this is handled by SimpleWebMimeRegistryImpl. | 713 // Extended codecs fail because this is handled by SimpleWebMimeRegistryImpl. |
740 // They should really pass canPlayType(). | 714 // They should really pass canPlayType(). |
741 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 715 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
742 kVideoFoo, foovideo_extended_codec(), kExternal)); | 716 kVideoFoo, foovideo_extended_codec(), kExternal)); |
743 | 717 |
744 // Invalid codec format. | 718 // Invalid codec format. |
745 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 719 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
746 kVideoFoo, foovideo_dot_codec(), kExternal)); | 720 kVideoFoo, foovideo_dot_codec(), kExternal)); |
747 | 721 |
748 // Non-container2 codecs. | 722 // Non-container2 codecs. |
749 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 723 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
750 kVideoFoo, vp8_codec(), kExternal)); | 724 kVideoFoo, vp8_codec(), kExternal)); |
751 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 725 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
752 kVideoFoo, unknown_codec(), kExternal)); | 726 kVideoFoo, unknown_codec(), kExternal)); |
753 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 727 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
754 kVideoFoo, mixed_codecs(), kExternal)); | 728 kVideoFoo, mixed_codecs(), kExternal)); |
755 | 729 |
756 // Valid audio types. | 730 // Valid audio types. |
757 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 731 EXPECT_TRUE(IsSupportedKeySystemWithAudioMimeType( |
758 kAudioFoo, no_codecs(), kExternal)); | 732 kAudioFoo, no_codecs(), kExternal)); |
759 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 733 EXPECT_TRUE(IsSupportedKeySystemWithAudioMimeType( |
760 kAudioFoo, fooaudio_codec(), kExternal)); | 734 kAudioFoo, fooaudio_codec(), kExternal)); |
761 | 735 |
762 // Valid audio types - parent key system. | 736 // Valid audio types - parent key system. |
763 // Unprefixed has no parent key system support. | 737 // Unprefixed has no parent key system support. |
ddorwin
2015/03/24 22:36:35
Remove this line.
sandersd (OOO until July 31)
2015/03/24 23:26:36
Done.
| |
764 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
765 kAudioFoo, no_codecs(), kExternalParent)); | |
766 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
767 kAudioFoo, fooaudio_codec(), kExternalParent)); | |
768 // Prefixed has parent key system support. | 738 // Prefixed has parent key system support. |
769 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | 739 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
770 kAudioFoo, no_codecs(), kExternalParent)); | 740 kAudioFoo, no_codecs(), kExternalParent)); |
771 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | 741 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
772 kAudioFoo, fooaudio_codec(), kExternalParent)); | 742 kAudioFoo, fooaudio_codec(), kExternalParent)); |
773 | 743 |
774 // Non-audio codecs. | 744 // Non-audio codecs. |
775 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 745 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( |
776 kAudioFoo, foovideo_codec(), kExternal)); | 746 kAudioFoo, foovideo_codec(), kExternal)); |
777 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 747 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( |
778 kAudioFoo, foovideo_and_fooaudio_codecs(), kExternal)); | 748 kAudioFoo, foovideo_and_fooaudio_codecs(), kExternal)); |
779 | 749 |
780 // Non-container2 codec. | 750 // Non-container2 codec. |
781 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 751 EXPECT_FALSE(IsSupportedKeySystemWithAudioMimeType( |
782 kAudioFoo, vorbis_codec(), kExternal)); | 752 kAudioFoo, vorbis_codec(), kExternal)); |
783 } | 753 } |
784 | 754 |
785 TEST_F(KeySystemsTest, KeySystemNameForUMA) { | 755 TEST_F(KeySystemsTest, KeySystemNameForUMA) { |
786 EXPECT_EQ("ClearKey", GetKeySystemNameForUMA(kClearKey)); | 756 EXPECT_EQ("ClearKey", GetKeySystemNameForUMA(kClearKey)); |
787 // Prefixed is not supported internally. | 757 // Prefixed is not supported internally. |
788 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kPrefixedClearKey)); | 758 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kPrefixedClearKey)); |
789 | 759 |
790 // External Clear Key never has a UMA name. | 760 // External Clear Key never has a UMA name. |
791 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kExternalClearKey)); | 761 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kExternalClearKey)); |
792 } | 762 } |
793 | 763 |
794 TEST_F(KeySystemsTest, KeySystemsUpdate) { | 764 TEST_F(KeySystemsTest, KeySystemsUpdate) { |
795 EXPECT_TRUE(IsSupportedKeySystem(kUsesAes)); | 765 EXPECT_TRUE(IsSupportedKeySystem(kUsesAes)); |
796 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 766 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
797 kVideoWebM, no_codecs(), kUsesAes)); | 767 kVideoWebM, no_codecs(), kUsesAes)); |
798 EXPECT_TRUE(IsSupportedKeySystem(kExternal)); | 768 EXPECT_TRUE(IsSupportedKeySystem(kExternal)); |
799 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 769 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
800 kVideoWebM, no_codecs(), kExternal)); | 770 kVideoWebM, no_codecs(), kExternal)); |
801 | 771 |
802 UpdateClientKeySystems(); | 772 UpdateClientKeySystems(); |
803 | 773 |
804 EXPECT_TRUE(IsSupportedKeySystem(kUsesAes)); | 774 EXPECT_TRUE(IsSupportedKeySystem(kUsesAes)); |
805 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 775 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
806 kVideoWebM, no_codecs(), kUsesAes)); | 776 kVideoWebM, no_codecs(), kUsesAes)); |
807 EXPECT_FALSE(IsSupportedKeySystem(kExternal)); | 777 EXPECT_FALSE(IsSupportedKeySystem(kExternal)); |
808 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | |
809 kVideoWebM, no_codecs(), kExternal)); | |
810 } | 778 } |
ddorwin
2015/03/24 22:36:36
What was wrong with the removed line?
sandersd (OOO until July 31)
2015/03/24 23:26:36
kExternal is not supported by unprefixed (and thus
| |
811 | 779 |
812 TEST_F(KeySystemsTest, PrefixedKeySystemsUpdate) { | 780 TEST_F(KeySystemsTest, PrefixedKeySystemsUpdate) { |
813 EXPECT_TRUE(IsSupportedKeySystem(kUsesAes)); | 781 EXPECT_TRUE(IsSupportedKeySystem(kUsesAes)); |
814 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | 782 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
815 kVideoWebM, no_codecs(), kUsesAes)); | 783 kVideoWebM, no_codecs(), kUsesAes)); |
816 EXPECT_TRUE(IsSupportedKeySystem(kExternal)); | 784 EXPECT_TRUE(IsSupportedKeySystem(kExternal)); |
817 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | 785 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
818 kVideoWebM, no_codecs(), kExternal)); | 786 kVideoWebM, no_codecs(), kExternal)); |
819 | 787 |
820 UpdateClientKeySystems(); | 788 UpdateClientKeySystems(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
860 EXPECT_FALSE(IsSupportedKeySystem("com.chromecast.something.else")); | 828 EXPECT_FALSE(IsSupportedKeySystem("com.chromecast.something.else")); |
861 EXPECT_FALSE(IsSupportedKeySystem("com.chromecast.other")); | 829 EXPECT_FALSE(IsSupportedKeySystem("com.chromecast.other")); |
862 | 830 |
863 EXPECT_FALSE(IsSupportedKeySystem("x-")); | 831 EXPECT_FALSE(IsSupportedKeySystem("x-")); |
864 EXPECT_TRUE(IsSupportedKeySystem("x-something")); | 832 EXPECT_TRUE(IsSupportedKeySystem("x-something")); |
865 EXPECT_FALSE(IsSupportedKeySystem("x-something.else")); | 833 EXPECT_FALSE(IsSupportedKeySystem("x-something.else")); |
866 EXPECT_FALSE(IsSupportedKeySystem("x-other")); | 834 EXPECT_FALSE(IsSupportedKeySystem("x-other")); |
867 } | 835 } |
868 | 836 |
869 } // namespace media | 837 } // namespace media |
OLD | NEW |