| 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 "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" |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 CodecVector unknown_codec_; | 285 CodecVector unknown_codec_; |
| 286 | 286 |
| 287 CodecVector mixed_codecs_; | 287 CodecVector mixed_codecs_; |
| 288 | 288 |
| 289 TestMediaClient test_media_client_; | 289 TestMediaClient test_media_client_; |
| 290 }; | 290 }; |
| 291 | 291 |
| 292 // TODO(ddorwin): Consider moving GetPepperType() calls out to their own test. | 292 // TODO(ddorwin): Consider moving GetPepperType() calls out to their own test. |
| 293 | 293 |
| 294 TEST_F(KeySystemsTest, EmptyKeySystem) { | 294 TEST_F(KeySystemsTest, EmptyKeySystem) { |
| 295 EXPECT_FALSE(IsConcreteSupportedKeySystem(std::string())); | 295 EXPECT_FALSE(IsSupportedKeySystem(std::string())); |
| 296 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 296 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 297 kVideoWebM, no_codecs(), std::string())); | 297 kVideoWebM, no_codecs(), std::string())); |
| 298 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(std::string())); | 298 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(std::string())); |
| 299 } | 299 } |
| 300 | 300 |
| 301 // Clear Key is the only key system registered in content. | 301 // Clear Key is the only key system registered in content. |
| 302 TEST_F(KeySystemsTest, ClearKey) { | 302 TEST_F(KeySystemsTest, ClearKey) { |
| 303 EXPECT_TRUE(IsConcreteSupportedKeySystem(kClearKey)); | 303 EXPECT_TRUE(IsSupportedKeySystem(kClearKey)); |
| 304 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 304 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 305 kVideoWebM, no_codecs(), kClearKey)); | 305 kVideoWebM, no_codecs(), kClearKey)); |
| 306 | 306 |
| 307 EXPECT_EQ("ClearKey", GetKeySystemNameForUMA(kClearKey)); | 307 EXPECT_EQ("ClearKey", GetKeySystemNameForUMA(kClearKey)); |
| 308 | 308 |
| 309 // Prefixed Clear Key is not supported internally. | 309 // Prefixed Clear Key is not supported internally. |
| 310 EXPECT_FALSE(IsConcreteSupportedKeySystem(kPrefixedClearKey)); | 310 EXPECT_FALSE(IsSupportedKeySystem(kPrefixedClearKey)); |
| 311 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 311 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 312 kVideoWebM, no_codecs(), kPrefixedClearKey)); | 312 kVideoWebM, no_codecs(), kPrefixedClearKey)); |
| 313 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kPrefixedClearKey)); | 313 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kPrefixedClearKey)); |
| 314 } | 314 } |
| 315 | 315 |
| 316 // The key system is not registered and therefore is unrecognized. | 316 // The key system is not registered and therefore is unrecognized. |
| 317 TEST_F(KeySystemsTest, Basic_UnrecognizedKeySystem) { | 317 TEST_F(KeySystemsTest, Basic_UnrecognizedKeySystem) { |
| 318 static const char* const kUnrecognized = "org.example.unrecognized"; | 318 static const char* const kUnrecognized = "org.example.unrecognized"; |
| 319 | 319 |
| 320 EXPECT_FALSE(IsConcreteSupportedKeySystem(kUnrecognized)); | 320 EXPECT_FALSE(IsSupportedKeySystem(kUnrecognized)); |
| 321 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 321 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 322 kVideoWebM, no_codecs(), kUnrecognized)); | 322 kVideoWebM, no_codecs(), kUnrecognized)); |
| 323 | 323 |
| 324 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kUnrecognized)); | 324 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kUnrecognized)); |
| 325 | 325 |
| 326 bool can_use = false; | 326 bool can_use = false; |
| 327 EXPECT_DEBUG_DEATH_PORTABLE( | 327 EXPECT_DEBUG_DEATH_PORTABLE( |
| 328 can_use = CanUseAesDecryptor(kUnrecognized), | 328 can_use = CanUseAesDecryptor(kUnrecognized), |
| 329 "org.example.unrecognized is not a known concrete system"); | 329 "org.example.unrecognized is not a known concrete system"); |
| 330 EXPECT_FALSE(can_use); | 330 EXPECT_FALSE(can_use); |
| 331 | 331 |
| 332 #if defined(ENABLE_PEPPER_CDMS) | 332 #if defined(ENABLE_PEPPER_CDMS) |
| 333 std::string type; | 333 std::string type; |
| 334 EXPECT_DEBUG_DEATH(type = GetPepperType(kUnrecognized), | 334 EXPECT_DEBUG_DEATH(type = GetPepperType(kUnrecognized), |
| 335 "org.example.unrecognized is not a known concrete system"); | 335 "org.example.unrecognized is not a known concrete system"); |
| 336 EXPECT_TRUE(type.empty()); | 336 EXPECT_TRUE(type.empty()); |
| 337 #endif | 337 #endif |
| 338 } | 338 } |
| 339 | 339 |
| 340 TEST_F(KeySystemsTest, Basic_UsesAesDecryptor) { | 340 TEST_F(KeySystemsTest, Basic_UsesAesDecryptor) { |
| 341 EXPECT_TRUE(IsConcreteSupportedKeySystem(kUsesAes)); | 341 EXPECT_TRUE(IsSupportedKeySystem(kUsesAes)); |
| 342 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 342 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 343 kVideoWebM, no_codecs(), kUsesAes)); | 343 kVideoWebM, no_codecs(), kUsesAes)); |
| 344 | 344 |
| 345 // No UMA value for this test key system. | 345 // No UMA value for this test key system. |
| 346 EXPECT_EQ("UseAes", GetKeySystemNameForUMA(kUsesAes)); | 346 EXPECT_EQ("UseAes", GetKeySystemNameForUMA(kUsesAes)); |
| 347 | 347 |
| 348 EXPECT_TRUE(CanUseAesDecryptor(kUsesAes)); | 348 EXPECT_TRUE(CanUseAesDecryptor(kUsesAes)); |
| 349 #if defined(ENABLE_PEPPER_CDMS) | 349 #if defined(ENABLE_PEPPER_CDMS) |
| 350 std::string type; | 350 std::string type; |
| 351 EXPECT_DEBUG_DEATH(type = GetPepperType(kUsesAes), | 351 EXPECT_DEBUG_DEATH(type = GetPepperType(kUsesAes), |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 396 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 397 kAudioWebM, vp9_and_vorbis_codecs(), kUsesAes)); | 397 kAudioWebM, vp9_and_vorbis_codecs(), kUsesAes)); |
| 398 | 398 |
| 399 // Non-Webm codec. | 399 // Non-Webm codec. |
| 400 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 400 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 401 kAudioWebM, fooaudio_codec(), kUsesAes)); | 401 kAudioWebM, fooaudio_codec(), kUsesAes)); |
| 402 } | 402 } |
| 403 | 403 |
| 404 // No parent is registered for UsesAes. | 404 // No parent is registered for UsesAes. |
| 405 TEST_F(KeySystemsTest, Parent_NoParentRegistered) { | 405 TEST_F(KeySystemsTest, Parent_NoParentRegistered) { |
| 406 EXPECT_FALSE(IsConcreteSupportedKeySystem(kUsesAesParent)); | 406 EXPECT_FALSE(IsSupportedKeySystem(kUsesAesParent)); |
| 407 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 407 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 408 kVideoWebM, no_codecs(), kUsesAesParent)); | 408 kVideoWebM, no_codecs(), kUsesAesParent)); |
| 409 | 409 |
| 410 // The parent is not supported for most things. | 410 // The parent is not supported for most things. |
| 411 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kUsesAesParent)); | 411 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kUsesAesParent)); |
| 412 bool result = false; | 412 bool result = false; |
| 413 EXPECT_DEBUG_DEATH_PORTABLE(result = CanUseAesDecryptor(kUsesAesParent), | 413 EXPECT_DEBUG_DEATH_PORTABLE(result = CanUseAesDecryptor(kUsesAesParent), |
| 414 "org.example is not a known concrete system"); | 414 "org.example is not a known concrete system"); |
| 415 EXPECT_FALSE(result); | 415 EXPECT_FALSE(result); |
| 416 #if defined(ENABLE_PEPPER_CDMS) | 416 #if defined(ENABLE_PEPPER_CDMS) |
| 417 std::string type; | 417 std::string type; |
| 418 EXPECT_DEBUG_DEATH(type = GetPepperType(kUsesAesParent), | 418 EXPECT_DEBUG_DEATH(type = GetPepperType(kUsesAesParent), |
| 419 "org.example is not a known concrete system"); | 419 "org.example is not a known concrete system"); |
| 420 EXPECT_TRUE(type.empty()); | 420 EXPECT_TRUE(type.empty()); |
| 421 #endif | 421 #endif |
| 422 } | 422 } |
| 423 | 423 |
| 424 TEST_F(KeySystemsTest, IsSupportedKeySystem_InvalidVariants) { | 424 TEST_F(KeySystemsTest, IsSupportedKeySystem_InvalidVariants) { |
| 425 // Case sensitive. | 425 // Case sensitive. |
| 426 EXPECT_FALSE(IsConcreteSupportedKeySystem("org.example.ClEaR")); | 426 EXPECT_FALSE(IsSupportedKeySystem("org.example.ClEaR")); |
| 427 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 427 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 428 kVideoWebM, no_codecs(), "org.example.ClEaR")); | 428 kVideoWebM, no_codecs(), "org.example.ClEaR")); |
| 429 | 429 |
| 430 // TLDs are not allowed. | 430 // TLDs are not allowed. |
| 431 EXPECT_FALSE(IsConcreteSupportedKeySystem("org.")); | 431 EXPECT_FALSE(IsSupportedKeySystem("org.")); |
| 432 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 432 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 433 kVideoWebM, no_codecs(), "org.")); | 433 kVideoWebM, no_codecs(), "org.")); |
| 434 EXPECT_FALSE(IsConcreteSupportedKeySystem("com")); | 434 EXPECT_FALSE(IsSupportedKeySystem("com")); |
| 435 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 435 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 436 kVideoWebM, no_codecs(), "com")); | 436 kVideoWebM, no_codecs(), "com")); |
| 437 | 437 |
| 438 // Extra period. | 438 // Extra period. |
| 439 EXPECT_FALSE(IsConcreteSupportedKeySystem("org.example.")); | 439 EXPECT_FALSE(IsSupportedKeySystem("org.example.")); |
| 440 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 440 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 441 kVideoWebM, no_codecs(), "org.example.")); | 441 kVideoWebM, no_codecs(), "org.example.")); |
| 442 | 442 |
| 443 // Incomplete. | 443 // Incomplete. |
| 444 EXPECT_FALSE(IsConcreteSupportedKeySystem("org.example.clea")); | 444 EXPECT_FALSE(IsSupportedKeySystem("org.example.clea")); |
| 445 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 445 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 446 kVideoWebM, no_codecs(), "org.example.clea")); | 446 kVideoWebM, no_codecs(), "org.example.clea")); |
| 447 | 447 |
| 448 // Extra character. | 448 // Extra character. |
| 449 EXPECT_FALSE(IsConcreteSupportedKeySystem("org.example.clearz")); | 449 EXPECT_FALSE(IsSupportedKeySystem("org.example.clearz")); |
| 450 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 450 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 451 kVideoWebM, no_codecs(), "org.example.clearz")); | 451 kVideoWebM, no_codecs(), "org.example.clearz")); |
| 452 | 452 |
| 453 // There are no child key systems for UsesAes. | 453 // There are no child key systems for UsesAes. |
| 454 EXPECT_FALSE(IsConcreteSupportedKeySystem("org.example.clear.foo")); | 454 EXPECT_FALSE(IsSupportedKeySystem("org.example.clear.foo")); |
| 455 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 455 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 456 kVideoWebM, no_codecs(), "org.example.clear.foo")); | 456 kVideoWebM, no_codecs(), "org.example.clear.foo")); |
| 457 } | 457 } |
| 458 | 458 |
| 459 TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_NoType) { | 459 TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_NoType) { |
| 460 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 460 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 461 std::string(), no_codecs(), kUsesAes)); | 461 std::string(), no_codecs(), kUsesAes)); |
| 462 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 462 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 463 std::string(), no_codecs(), kUsesAesParent)); | 463 std::string(), no_codecs(), kUsesAesParent)); |
| 464 | 464 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 // Non-container2 codec. | 517 // Non-container2 codec. |
| 518 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 518 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 519 kAudioFoo, vorbis_codec(), kUsesAes)); | 519 kAudioFoo, vorbis_codec(), kUsesAes)); |
| 520 } | 520 } |
| 521 | 521 |
| 522 // | 522 // |
| 523 // Non-AesDecryptor-based key system. | 523 // Non-AesDecryptor-based key system. |
| 524 // | 524 // |
| 525 | 525 |
| 526 TEST_F(KeySystemsTest, Basic_ExternalDecryptor) { | 526 TEST_F(KeySystemsTest, Basic_ExternalDecryptor) { |
| 527 EXPECT_TRUE(IsConcreteSupportedKeySystem(kExternal)); | 527 EXPECT_TRUE(IsSupportedKeySystem(kExternal)); |
| 528 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 528 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 529 kVideoWebM, no_codecs(), kExternal)); | 529 kVideoWebM, no_codecs(), kExternal)); |
| 530 | 530 |
| 531 EXPECT_FALSE(CanUseAesDecryptor(kExternal)); | 531 EXPECT_FALSE(CanUseAesDecryptor(kExternal)); |
| 532 #if defined(ENABLE_PEPPER_CDMS) | 532 #if defined(ENABLE_PEPPER_CDMS) |
| 533 EXPECT_EQ("application/x-ppapi-external-cdm", GetPepperType(kExternal)); | 533 EXPECT_EQ("application/x-ppapi-external-cdm", GetPepperType(kExternal)); |
| 534 #endif // defined(ENABLE_PEPPER_CDMS) | 534 #endif // defined(ENABLE_PEPPER_CDMS) |
| 535 } | 535 } |
| 536 | 536 |
| 537 TEST_F(KeySystemsTest, Parent_ParentRegistered) { | 537 TEST_F(KeySystemsTest, Parent_ParentRegistered) { |
| 538 // The parent system is not a concrete system but is supported. | 538 // The parent system is not a concrete system but is supported. |
| 539 EXPECT_FALSE(IsConcreteSupportedKeySystem(kExternalParent)); | 539 EXPECT_FALSE(IsSupportedKeySystem(kExternalParent)); |
| 540 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 540 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 541 kVideoWebM, no_codecs(), kExternalParent)); |
| 542 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
| 541 kVideoWebM, no_codecs(), kExternalParent)); | 543 kVideoWebM, no_codecs(), kExternalParent)); |
| 542 | 544 |
| 543 // The parent is not supported for most things. | 545 // The parent is not supported for most things. |
| 544 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kExternalParent)); | 546 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kExternalParent)); |
| 545 bool result = false; | 547 bool result = false; |
| 546 EXPECT_DEBUG_DEATH_PORTABLE(result = CanUseAesDecryptor(kExternalParent), | 548 EXPECT_DEBUG_DEATH_PORTABLE(result = CanUseAesDecryptor(kExternalParent), |
| 547 "com.example is not a known concrete system"); | 549 "com.example is not a known concrete system"); |
| 548 EXPECT_FALSE(result); | 550 EXPECT_FALSE(result); |
| 549 #if defined(ENABLE_PEPPER_CDMS) | 551 #if defined(ENABLE_PEPPER_CDMS) |
| 550 std::string type; | 552 std::string type; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 569 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 571 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 570 kVideoWebM, vp9_codec(), kExternal)); | 572 kVideoWebM, vp9_codec(), kExternal)); |
| 571 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 573 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 572 kVideoWebM, vp90_codec(), kExternal)); | 574 kVideoWebM, vp90_codec(), kExternal)); |
| 573 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 575 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 574 kVideoWebM, vp9_and_vorbis_codecs(), kExternal)); | 576 kVideoWebM, vp9_and_vorbis_codecs(), kExternal)); |
| 575 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 577 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 576 kVideoWebM, vorbis_codec(), kExternal)); | 578 kVideoWebM, vorbis_codec(), kExternal)); |
| 577 | 579 |
| 578 // Valid video types - parent key system. | 580 // Valid video types - parent key system. |
| 579 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 581 // Unprefixed has no parent key system support. |
| 582 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 580 kVideoWebM, no_codecs(), kExternalParent)); | 583 kVideoWebM, no_codecs(), kExternalParent)); |
| 581 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 584 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 582 kVideoWebM, vp8_codec(), kExternalParent)); | 585 kVideoWebM, vp8_codec(), kExternalParent)); |
| 583 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 586 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 584 kVideoWebM, vp80_codec(), kExternalParent)); | 587 kVideoWebM, vp80_codec(), kExternalParent)); |
| 585 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 588 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 586 kVideoWebM, vp8_and_vorbis_codecs(), kExternalParent)); | 589 kVideoWebM, vp8_and_vorbis_codecs(), kExternalParent)); |
| 587 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 590 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 588 kVideoWebM, vp9_codec(), kExternalParent)); | 591 kVideoWebM, vp9_codec(), kExternalParent)); |
| 589 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 592 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 590 kVideoWebM, vp90_codec(), kExternalParent)); | 593 kVideoWebM, vp90_codec(), kExternalParent)); |
| 591 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 594 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 592 kVideoWebM, vp9_and_vorbis_codecs(), kExternalParent)); | 595 kVideoWebM, vp9_and_vorbis_codecs(), kExternalParent)); |
| 593 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 596 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 597 kVideoWebM, vorbis_codec(), kExternalParent)); |
| 598 // Prefixed has parent key system support. |
| 599 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
| 600 kVideoWebM, no_codecs(), kExternalParent)); |
| 601 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
| 602 kVideoWebM, vp8_codec(), kExternalParent)); |
| 603 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
| 604 kVideoWebM, vp80_codec(), kExternalParent)); |
| 605 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
| 606 kVideoWebM, vp8_and_vorbis_codecs(), kExternalParent)); |
| 607 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
| 608 kVideoWebM, vp9_codec(), kExternalParent)); |
| 609 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
| 610 kVideoWebM, vp90_codec(), kExternalParent)); |
| 611 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
| 612 kVideoWebM, vp9_and_vorbis_codecs(), kExternalParent)); |
| 613 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
| 594 kVideoWebM, vorbis_codec(), kExternalParent)); | 614 kVideoWebM, vorbis_codec(), kExternalParent)); |
| 595 | 615 |
| 596 // Non-Webm codecs. | 616 // Non-Webm codecs. |
| 597 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 617 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 598 kVideoWebM, foovideo_codec(), kExternal)); | 618 kVideoWebM, foovideo_codec(), kExternal)); |
| 599 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 619 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 600 kVideoWebM, unknown_codec(), kExternal)); | 620 kVideoWebM, unknown_codec(), kExternal)); |
| 601 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 621 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 602 kVideoWebM, mixed_codecs(), kExternal)); | 622 kVideoWebM, mixed_codecs(), kExternal)); |
| 603 | 623 |
| 604 // Valid audio types. | 624 // Valid audio types. |
| 605 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 625 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 606 kAudioWebM, no_codecs(), kExternal)); | 626 kAudioWebM, no_codecs(), kExternal)); |
| 607 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 627 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 608 kAudioWebM, vorbis_codec(), kExternal)); | 628 kAudioWebM, vorbis_codec(), kExternal)); |
| 609 | 629 |
| 610 // Valid audio types - parent key system. | 630 // Valid audio types - parent key system. |
| 611 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 631 // Unprefixed has no parent key system support. |
| 632 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 612 kAudioWebM, no_codecs(), kExternalParent)); | 633 kAudioWebM, no_codecs(), kExternalParent)); |
| 613 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 634 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 635 kAudioWebM, vorbis_codec(), kExternalParent)); |
| 636 // Prefixed has parent key system support. |
| 637 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
| 638 kAudioWebM, no_codecs(), kExternalParent)); |
| 639 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
| 614 kAudioWebM, vorbis_codec(), kExternalParent)); | 640 kAudioWebM, vorbis_codec(), kExternalParent)); |
| 615 | 641 |
| 616 // Non-audio codecs. | 642 // Non-audio codecs. |
| 617 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 643 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 618 kAudioWebM, vp8_codec(), kExternal)); | 644 kAudioWebM, vp8_codec(), kExternal)); |
| 619 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 645 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 620 kAudioWebM, vp8_and_vorbis_codecs(), kExternal)); | 646 kAudioWebM, vp8_and_vorbis_codecs(), kExternal)); |
| 621 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 647 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 622 kAudioWebM, vp9_codec(), kExternal)); | 648 kAudioWebM, vp9_codec(), kExternal)); |
| 623 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 649 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 635 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 661 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 636 kVideoFoo, no_codecs(), kExternal)); | 662 kVideoFoo, no_codecs(), kExternal)); |
| 637 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 663 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 638 kVideoFoo, foovideo_codec(), kExternal)); | 664 kVideoFoo, foovideo_codec(), kExternal)); |
| 639 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 665 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 640 kVideoFoo, foovideo_and_fooaudio_codecs(), kExternal)); | 666 kVideoFoo, foovideo_and_fooaudio_codecs(), kExternal)); |
| 641 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 667 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 642 kVideoFoo, fooaudio_codec(), kExternal)); | 668 kVideoFoo, fooaudio_codec(), kExternal)); |
| 643 | 669 |
| 644 // Valid video types - parent key system. | 670 // Valid video types - parent key system. |
| 645 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 671 // Unprefixed has no parent key system support. |
| 672 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 646 kVideoFoo, no_codecs(), kExternalParent)); | 673 kVideoFoo, no_codecs(), kExternalParent)); |
| 647 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 674 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 648 kVideoFoo, foovideo_codec(), kExternalParent)); | 675 kVideoFoo, foovideo_codec(), kExternalParent)); |
| 649 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 676 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 650 kVideoFoo, foovideo_and_fooaudio_codecs(), kExternalParent)); | 677 kVideoFoo, foovideo_and_fooaudio_codecs(), kExternalParent)); |
| 651 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 678 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 679 kVideoFoo, fooaudio_codec(), kExternalParent)); |
| 680 // Prefixed has parent key system support. |
| 681 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
| 682 kVideoFoo, no_codecs(), kExternalParent)); |
| 683 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
| 684 kVideoFoo, foovideo_codec(), kExternalParent)); |
| 685 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
| 686 kVideoFoo, foovideo_and_fooaudio_codecs(), kExternalParent)); |
| 687 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
| 652 kVideoFoo, fooaudio_codec(), kExternalParent)); | 688 kVideoFoo, fooaudio_codec(), kExternalParent)); |
| 653 | 689 |
| 654 // Extended codecs fail because this is handled by SimpleWebMimeRegistryImpl. | 690 // Extended codecs fail because this is handled by SimpleWebMimeRegistryImpl. |
| 655 // They should really pass canPlayType(). | 691 // They should really pass canPlayType(). |
| 656 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 692 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 657 kVideoFoo, foovideo_extended_codec(), kExternal)); | 693 kVideoFoo, foovideo_extended_codec(), kExternal)); |
| 658 | 694 |
| 659 // Invalid codec format. | 695 // Invalid codec format. |
| 660 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 696 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 661 kVideoFoo, foovideo_dot_codec(), kExternal)); | 697 kVideoFoo, foovideo_dot_codec(), kExternal)); |
| 662 | 698 |
| 663 // Non-container2 codecs. | 699 // Non-container2 codecs. |
| 664 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 700 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 665 kVideoFoo, vp8_codec(), kExternal)); | 701 kVideoFoo, vp8_codec(), kExternal)); |
| 666 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 702 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 667 kVideoFoo, unknown_codec(), kExternal)); | 703 kVideoFoo, unknown_codec(), kExternal)); |
| 668 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 704 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 669 kVideoFoo, mixed_codecs(), kExternal)); | 705 kVideoFoo, mixed_codecs(), kExternal)); |
| 670 | 706 |
| 671 // Valid audio types. | 707 // Valid audio types. |
| 672 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 708 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 673 kAudioFoo, no_codecs(), kExternal)); | 709 kAudioFoo, no_codecs(), kExternal)); |
| 674 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 710 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 675 kAudioFoo, fooaudio_codec(), kExternal)); | 711 kAudioFoo, fooaudio_codec(), kExternal)); |
| 676 | 712 |
| 677 // Valid audio types - parent key system. | 713 // Valid audio types - parent key system. |
| 678 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 714 // Unprefixed has no parent key system support. |
| 715 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 679 kAudioFoo, no_codecs(), kExternalParent)); | 716 kAudioFoo, no_codecs(), kExternalParent)); |
| 680 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 717 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 718 kAudioFoo, fooaudio_codec(), kExternalParent)); |
| 719 // Prefixed has parent key system support. |
| 720 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
| 721 kAudioFoo, no_codecs(), kExternalParent)); |
| 722 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
| 681 kAudioFoo, fooaudio_codec(), kExternalParent)); | 723 kAudioFoo, fooaudio_codec(), kExternalParent)); |
| 682 | 724 |
| 683 // Non-audio codecs. | 725 // Non-audio codecs. |
| 684 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 726 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 685 kAudioFoo, foovideo_codec(), kExternal)); | 727 kAudioFoo, foovideo_codec(), kExternal)); |
| 686 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 728 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 687 kAudioFoo, foovideo_and_fooaudio_codecs(), kExternal)); | 729 kAudioFoo, foovideo_and_fooaudio_codecs(), kExternal)); |
| 688 | 730 |
| 689 // Non-container2 codec. | 731 // Non-container2 codec. |
| 690 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 732 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 691 kAudioFoo, vorbis_codec(), kExternal)); | 733 kAudioFoo, vorbis_codec(), kExternal)); |
| 692 } | 734 } |
| 693 | 735 |
| 694 TEST_F(KeySystemsTest, KeySystemNameForUMA) { | 736 TEST_F(KeySystemsTest, KeySystemNameForUMA) { |
| 695 EXPECT_EQ("ClearKey", GetKeySystemNameForUMA(kClearKey)); | 737 EXPECT_EQ("ClearKey", GetKeySystemNameForUMA(kClearKey)); |
| 696 // Prefixed is not supported internally. | 738 // Prefixed is not supported internally. |
| 697 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kPrefixedClearKey)); | 739 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kPrefixedClearKey)); |
| 698 | 740 |
| 699 // External Clear Key never has a UMA name. | 741 // External Clear Key never has a UMA name. |
| 700 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kExternalClearKey)); | 742 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kExternalClearKey)); |
| 701 } | 743 } |
| 702 | 744 |
| 703 TEST_F(KeySystemsTest, KeySystemsUpdate) { | 745 TEST_F(KeySystemsTest, KeySystemsUpdate) { |
| 704 EXPECT_TRUE(IsConcreteSupportedKeySystem(kUsesAes)); | 746 EXPECT_TRUE(IsSupportedKeySystem(kUsesAes)); |
| 705 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 747 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 706 kVideoWebM, no_codecs(), kUsesAes)); | 748 kVideoWebM, no_codecs(), kUsesAes)); |
| 707 EXPECT_TRUE(IsConcreteSupportedKeySystem(kExternal)); | 749 EXPECT_TRUE(IsSupportedKeySystem(kExternal)); |
| 708 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 750 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 709 kVideoWebM, no_codecs(), kExternal)); | 751 kVideoWebM, no_codecs(), kExternal)); |
| 710 | 752 |
| 711 UpdateClientKeySystems(); | 753 UpdateClientKeySystems(); |
| 712 | 754 |
| 713 EXPECT_TRUE(IsConcreteSupportedKeySystem(kUsesAes)); | 755 EXPECT_TRUE(IsSupportedKeySystem(kUsesAes)); |
| 714 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 756 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 715 kVideoWebM, no_codecs(), kUsesAes)); | 757 kVideoWebM, no_codecs(), kUsesAes)); |
| 716 EXPECT_FALSE(IsConcreteSupportedKeySystem(kExternal)); | 758 EXPECT_FALSE(IsSupportedKeySystem(kExternal)); |
| 717 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 759 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 718 kVideoWebM, no_codecs(), kExternal)); | 760 kVideoWebM, no_codecs(), kExternal)); |
| 719 } | 761 } |
| 720 | 762 |
| 721 TEST_F(KeySystemsTest, PrefixedKeySystemsUpdate) { | 763 TEST_F(KeySystemsTest, PrefixedKeySystemsUpdate) { |
| 722 EXPECT_TRUE(IsConcreteSupportedKeySystem(kUsesAes)); | 764 EXPECT_TRUE(IsSupportedKeySystem(kUsesAes)); |
| 723 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | 765 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
| 724 kVideoWebM, no_codecs(), kUsesAes)); | 766 kVideoWebM, no_codecs(), kUsesAes)); |
| 725 EXPECT_TRUE(IsConcreteSupportedKeySystem(kExternal)); | 767 EXPECT_TRUE(IsSupportedKeySystem(kExternal)); |
| 726 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | 768 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
| 727 kVideoWebM, no_codecs(), kExternal)); | 769 kVideoWebM, no_codecs(), kExternal)); |
| 728 | 770 |
| 729 UpdateClientKeySystems(); | 771 UpdateClientKeySystems(); |
| 730 | 772 |
| 731 EXPECT_TRUE(IsConcreteSupportedKeySystem(kUsesAes)); | 773 EXPECT_TRUE(IsSupportedKeySystem(kUsesAes)); |
| 732 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( | 774 EXPECT_TRUE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
| 733 kVideoWebM, no_codecs(), kUsesAes)); | 775 kVideoWebM, no_codecs(), kUsesAes)); |
| 734 EXPECT_FALSE(IsConcreteSupportedKeySystem(kExternal)); | 776 EXPECT_FALSE(IsSupportedKeySystem(kExternal)); |
| 735 EXPECT_FALSE(PrefixedIsSupportedKeySystemWithMediaMimeType( | 777 EXPECT_FALSE(PrefixedIsSupportedKeySystemWithMediaMimeType( |
| 736 kVideoWebM, no_codecs(), kExternal)); | 778 kVideoWebM, no_codecs(), kExternal)); |
| 737 } | 779 } |
| 738 | 780 |
| 739 } // namespace media | 781 } // namespace media |
| OLD | NEW |