Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: media/base/key_systems_unittest.cc

Issue 2412493003: Revert of Move ENABLE_PEPPER_CDMS to a buildflag header. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/key_systems.cc ('k') | media/blink/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // TODO(sandersd): Refactor to remove recomputed codec arrays, and generally 5 // TODO(sandersd): Refactor to remove recomputed codec arrays, and generally
6 // shorten and improve coverage. 6 // shorten and improve coverage.
7 // - http://crbug.com/417444 7 // - http://crbug.com/417444
8 // - http://crbug.com/457438 8 // - http://crbug.com/457438
9 // TODO(sandersd): Add tests to cover codec vectors with empty items. 9 // TODO(sandersd): Add tests to cover codec vectors with empty items.
10 // http://crbug.com/417461 10 // http://crbug.com/417461
11 11
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "media/base/eme_constants.h" 16 #include "media/base/eme_constants.h"
17 #include "media/base/key_systems.h" 17 #include "media/base/key_systems.h"
18 #include "media/base/media.h" 18 #include "media/base/media.h"
19 #include "media/base/media_client.h" 19 #include "media/base/media_client.h"
20 #include "ppapi/features/features.h"
21 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
22 21
23 namespace media { 22 namespace media {
24 23
25 // These are the (fake) key systems that are registered for these tests. 24 // These are the (fake) key systems that are registered for these tests.
26 // kUsesAes uses the AesDecryptor like Clear Key. 25 // kUsesAes uses the AesDecryptor like Clear Key.
27 // kExternal uses an external CDM, such as Pepper-based or Android platform CDM. 26 // kExternal uses an external CDM, such as Pepper-based or Android platform CDM.
28 const char kUsesAes[] = "x-org.example.clear"; 27 const char kUsesAes[] = "x-org.example.clear";
29 const char kUseAesNameForUMA[] = "UseAes"; 28 const char kUseAesNameForUMA[] = "UseAes";
30 const char kExternal[] = "x-com.example.test"; 29 const char kExternal[] = "x-com.example.test";
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 416
418 // The key system is not registered and therefore is unrecognized. 417 // The key system is not registered and therefore is unrecognized.
419 TEST_F(KeySystemsTest, Basic_UnrecognizedKeySystem) { 418 TEST_F(KeySystemsTest, Basic_UnrecognizedKeySystem) {
420 static const char* const kUnrecognized = "x-org.example.unrecognized"; 419 static const char* const kUnrecognized = "x-org.example.unrecognized";
421 420
422 EXPECT_FALSE(IsSupportedKeySystem(kUnrecognized)); 421 EXPECT_FALSE(IsSupportedKeySystem(kUnrecognized));
423 422
424 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kUnrecognized)); 423 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kUnrecognized));
425 EXPECT_FALSE(CanUseAesDecryptor(kUnrecognized)); 424 EXPECT_FALSE(CanUseAesDecryptor(kUnrecognized));
426 425
427 #if BUILDFLAG(ENABLE_PEPPER_CDMS) 426 #if defined(ENABLE_PEPPER_CDMS)
428 std::string type; 427 std::string type;
429 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) 428 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
430 EXPECT_DEATH(type = GetPepperType(kUnrecognized), 429 EXPECT_DEATH(type = GetPepperType(kUnrecognized),
431 "x-org.example.unrecognized is not a known system"); 430 "x-org.example.unrecognized is not a known system");
432 #endif 431 #endif
433 EXPECT_TRUE(type.empty()); 432 EXPECT_TRUE(type.empty());
434 #endif 433 #endif
435 } 434 }
436 435
437 TEST_F(KeySystemsTest, Basic_UsesAesDecryptor) { 436 TEST_F(KeySystemsTest, Basic_UsesAesDecryptor) {
438 EXPECT_TRUE(IsSupportedKeySystem(kUsesAes)); 437 EXPECT_TRUE(IsSupportedKeySystem(kUsesAes));
439 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( 438 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
440 kVideoWebM, no_codecs(), kUsesAes)); 439 kVideoWebM, no_codecs(), kUsesAes));
441 440
442 // No UMA value for this test key system. 441 // No UMA value for this test key system.
443 EXPECT_EQ("UseAes", GetKeySystemNameForUMA(kUsesAes)); 442 EXPECT_EQ("UseAes", GetKeySystemNameForUMA(kUsesAes));
444 443
445 EXPECT_TRUE(CanUseAesDecryptor(kUsesAes)); 444 EXPECT_TRUE(CanUseAesDecryptor(kUsesAes));
446 #if BUILDFLAG(ENABLE_PEPPER_CDMS) 445 #if defined(ENABLE_PEPPER_CDMS)
447 std::string type; 446 std::string type;
448 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) 447 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
449 EXPECT_DEATH(type = GetPepperType(kUsesAes), 448 EXPECT_DEATH(type = GetPepperType(kUsesAes),
450 "x-org.example.clear is not Pepper-based"); 449 "x-org.example.clear is not Pepper-based");
451 #endif 450 #endif
452 EXPECT_TRUE(type.empty()); 451 EXPECT_TRUE(type.empty());
453 #endif 452 #endif
454 } 453 }
455 454
456 TEST_F(KeySystemsTest, 455 TEST_F(KeySystemsTest,
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 592
594 TEST_F(KeySystemsTest, Basic_ExternalDecryptor) { 593 TEST_F(KeySystemsTest, Basic_ExternalDecryptor) {
595 if (!CanRunExternalKeySystemTests()) 594 if (!CanRunExternalKeySystemTests())
596 return; 595 return;
597 596
598 EXPECT_TRUE(IsSupportedKeySystem(kExternal)); 597 EXPECT_TRUE(IsSupportedKeySystem(kExternal));
599 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( 598 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
600 kVideoWebM, no_codecs(), kExternal)); 599 kVideoWebM, no_codecs(), kExternal));
601 600
602 EXPECT_FALSE(CanUseAesDecryptor(kExternal)); 601 EXPECT_FALSE(CanUseAesDecryptor(kExternal));
603 #if BUILDFLAG(ENABLE_PEPPER_CDMS) 602 #if defined(ENABLE_PEPPER_CDMS)
604 EXPECT_EQ("application/x-ppapi-external-cdm", GetPepperType(kExternal)); 603 EXPECT_EQ("application/x-ppapi-external-cdm", GetPepperType(kExternal));
605 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) 604 #endif // defined(ENABLE_PEPPER_CDMS)
606 } 605 }
607 606
608 TEST_F( 607 TEST_F(
609 KeySystemsTest, 608 KeySystemsTest,
610 IsSupportedKeySystemWithMediaMimeType_ExternalDecryptor_TypesContainer1) { 609 IsSupportedKeySystemWithMediaMimeType_ExternalDecryptor_TypesContainer1) {
611 if (!CanRunExternalKeySystemTests()) 610 if (!CanRunExternalKeySystemTests())
612 return; 611 return;
613 612
614 // Valid video types. 613 // Valid video types.
615 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( 614 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 EXPECT_FALSE(IsSupportedKeySystem("com.chromecast.something.else")); 772 EXPECT_FALSE(IsSupportedKeySystem("com.chromecast.something.else"));
774 EXPECT_FALSE(IsSupportedKeySystem("com.chromecast.other")); 773 EXPECT_FALSE(IsSupportedKeySystem("com.chromecast.other"));
775 774
776 EXPECT_FALSE(IsSupportedKeySystem("x-")); 775 EXPECT_FALSE(IsSupportedKeySystem("x-"));
777 EXPECT_TRUE(IsSupportedKeySystem("x-something")); 776 EXPECT_TRUE(IsSupportedKeySystem("x-something"));
778 EXPECT_FALSE(IsSupportedKeySystem("x-something.else")); 777 EXPECT_FALSE(IsSupportedKeySystem("x-something.else"));
779 EXPECT_FALSE(IsSupportedKeySystem("x-other")); 778 EXPECT_FALSE(IsSupportedKeySystem("x-other"));
780 } 779 }
781 780
782 } // namespace media 781 } // namespace media
OLDNEW
« no previous file with comments | « media/base/key_systems.cc ('k') | media/blink/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698