| Index: media/base/key_systems_unittest.cc
|
| diff --git a/media/base/key_systems_unittest.cc b/media/base/key_systems_unittest.cc
|
| index 62677fab143634708a792fa81a879d2103514104..2d3d3ba67d1a12323cf198419b89246b780eeba9 100644
|
| --- a/media/base/key_systems_unittest.cc
|
| +++ b/media/base/key_systems_unittest.cc
|
| @@ -19,6 +19,7 @@
|
| #include "media/base/media_client.h"
|
| #include "ppapi/features/features.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| +#include "third_party/widevine/cdm/widevine_cdm_common.h"
|
|
|
| namespace media {
|
|
|
| @@ -26,9 +27,7 @@ namespace media {
|
| // kUsesAes uses the AesDecryptor like Clear Key.
|
| // kExternal uses an external CDM, such as Pepper-based or Android platform CDM.
|
| const char kUsesAes[] = "x-org.example.clear";
|
| -const char kUseAesNameForUMA[] = "UseAes";
|
| const char kExternal[] = "x-com.example.test";
|
| -const char kExternalNameForUMA[] = "External";
|
|
|
| const char kClearKey[] = "org.w3.clearkey";
|
| const char kExternalClearKey[] = "org.chromium.externalclearkey";
|
| @@ -174,12 +173,9 @@ class TestMediaClient : public MediaClient {
|
| ~TestMediaClient() override;
|
|
|
| // MediaClient implementation.
|
| - void AddKeySystemsInfoForUMA(
|
| - std::vector<KeySystemInfoForUMA>* key_systems_info_for_uma) final;
|
| bool IsKeySystemsUpdateNeeded() final;
|
| void AddSupportedKeySystems(std::vector<std::unique_ptr<KeySystemProperties>>*
|
| key_systems_properties) override;
|
| - void RecordRapporURL(const std::string& metric, const GURL& url) final;
|
| bool IsSupportedAudioConfig(const media::AudioConfig& config) final;
|
| bool IsSupportedVideoConfig(const media::VideoConfig& config) final;
|
|
|
| @@ -203,14 +199,6 @@ TestMediaClient::TestMediaClient()
|
| TestMediaClient::~TestMediaClient() {
|
| }
|
|
|
| -void TestMediaClient::AddKeySystemsInfoForUMA(
|
| - std::vector<KeySystemInfoForUMA>* key_systems_info_for_uma) {
|
| - key_systems_info_for_uma->push_back(
|
| - media::KeySystemInfoForUMA(kUsesAes, kUseAesNameForUMA));
|
| - key_systems_info_for_uma->push_back(
|
| - media::KeySystemInfoForUMA(kExternal, kExternalNameForUMA));
|
| -}
|
| -
|
| bool TestMediaClient::IsKeySystemsUpdateNeeded() {
|
| return is_update_needed_;
|
| }
|
| @@ -227,11 +215,6 @@ void TestMediaClient::AddSupportedKeySystems(
|
| is_update_needed_ = false;
|
| }
|
|
|
| -void TestMediaClient::RecordRapporURL(const std::string& /* metric */,
|
| - const GURL& /* url */) {
|
| - NOTIMPLEMENTED();
|
| -}
|
| -
|
| bool TestMediaClient::IsSupportedAudioConfig(const media::AudioConfig& config) {
|
| return true;
|
| }
|
| @@ -248,39 +231,6 @@ void TestMediaClient::DisableExternalKeySystemSupport() {
|
| supports_external_key_system_ = false;
|
| }
|
|
|
| -class PotentiallySupportedNamesTestMediaClient : public TestMediaClient {
|
| - void AddSupportedKeySystems(std::vector<std::unique_ptr<KeySystemProperties>>*
|
| - key_systems_properties) final;
|
| -};
|
| -
|
| -void PotentiallySupportedNamesTestMediaClient::AddSupportedKeySystems(
|
| - std::vector<std::unique_ptr<KeySystemProperties>>* key_systems) {
|
| - // org.w3.clearkey is automatically registered.
|
| - key_systems->emplace_back(new AesKeySystemProperties("com.widevine.alpha"));
|
| - key_systems->emplace_back(
|
| - new AesKeySystemProperties("org.chromium.externalclearkey"));
|
| - key_systems->emplace_back(
|
| - new AesKeySystemProperties("org.chromium.externalclearkey.something"));
|
| - key_systems->emplace_back(
|
| - new AesKeySystemProperties("com.chromecast.something"));
|
| - key_systems->emplace_back(new AesKeySystemProperties("x-something"));
|
| -}
|
| -
|
| -class KeySystemsPotentiallySupportedNamesTest : public testing::Test {
|
| - protected:
|
| - KeySystemsPotentiallySupportedNamesTest() {
|
| - SetMediaClient(&test_media_client_);
|
| - }
|
| -
|
| - ~KeySystemsPotentiallySupportedNamesTest() override {
|
| - // Clear the use of |test_media_client_|, which was set in SetUp().
|
| - SetMediaClient(nullptr);
|
| - }
|
| -
|
| - private:
|
| - PotentiallySupportedNamesTestMediaClient test_media_client_;
|
| -};
|
| -
|
| class KeySystemsTest : public testing::Test {
|
| protected:
|
| KeySystemsTest() {
|
| @@ -325,6 +275,8 @@ class KeySystemsTest : public testing::Test {
|
|
|
| ~KeySystemsTest() override {
|
| // Clear the use of |test_media_client_|, which was set in SetUp().
|
| + // NOTE: This does not clear any cached KeySystemProperties in the global
|
| + // KeySystems instance.
|
| SetMediaClient(nullptr);
|
| }
|
|
|
| @@ -441,7 +393,7 @@ TEST_F(KeySystemsTest, Basic_UsesAesDecryptor) {
|
| kVideoWebM, no_codecs(), kUsesAes));
|
|
|
| // No UMA value for this test key system.
|
| - EXPECT_EQ("UseAes", GetKeySystemNameForUMA(kUsesAes));
|
| + EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kUsesAes));
|
|
|
| EXPECT_TRUE(CanUseAesDecryptor(kUsesAes));
|
| #if BUILDFLAG(ENABLE_PEPPER_CDMS)
|
| @@ -715,6 +667,8 @@ TEST_F(
|
|
|
| TEST_F(KeySystemsTest, KeySystemNameForUMA) {
|
| EXPECT_EQ("ClearKey", GetKeySystemNameForUMA(kClearKey));
|
| + EXPECT_EQ("Widevine", GetKeySystemNameForUMA(kWidevineKeySystem));
|
| + EXPECT_EQ("Unknown", GetKeySystemNameForUMA("Foo"));
|
|
|
| // External Clear Key never has a UMA name.
|
| if (CanRunExternalKeySystemTests())
|
| @@ -741,43 +695,4 @@ TEST_F(KeySystemsTest, KeySystemsUpdate) {
|
| EXPECT_FALSE(IsSupportedKeySystem(kExternal));
|
| }
|
|
|
| -TEST_F(KeySystemsPotentiallySupportedNamesTest, PotentiallySupportedNames) {
|
| - EXPECT_FALSE(IsSupportedKeySystem("org.w3"));
|
| - EXPECT_FALSE(IsSupportedKeySystem("org.w3."));
|
| - EXPECT_FALSE(IsSupportedKeySystem("org.w3.clearke"));
|
| - EXPECT_TRUE(IsSupportedKeySystem("org.w3.clearkey"));
|
| - EXPECT_FALSE(IsSupportedKeySystem("org.w3.clearkeys"));
|
| -
|
| - EXPECT_FALSE(IsSupportedKeySystem("com.widevine"));
|
| - EXPECT_FALSE(IsSupportedKeySystem("com.widevine."));
|
| - EXPECT_FALSE(IsSupportedKeySystem("com.widevine.alph"));
|
| - EXPECT_TRUE(IsSupportedKeySystem("com.widevine.alpha"));
|
| - EXPECT_FALSE(IsSupportedKeySystem("com.widevine.beta"));
|
| - EXPECT_FALSE(IsSupportedKeySystem("com.widevine.alphabeta"));
|
| - EXPECT_FALSE(IsSupportedKeySystem("com.widevine.alpha.beta"));
|
| -
|
| - EXPECT_FALSE(IsSupportedKeySystem("org.chromium"));
|
| - EXPECT_FALSE(IsSupportedKeySystem("org.chromium."));
|
| - EXPECT_FALSE(IsSupportedKeySystem("org.chromium.externalclearke"));
|
| - EXPECT_TRUE(IsSupportedKeySystem("org.chromium.externalclearkey"));
|
| - EXPECT_FALSE(IsSupportedKeySystem("org.chromium.externalclearkeys"));
|
| - EXPECT_FALSE(IsSupportedKeySystem("org.chromium.externalclearkey."));
|
| - EXPECT_TRUE(IsSupportedKeySystem("org.chromium.externalclearkey.something"));
|
| - EXPECT_FALSE(
|
| - IsSupportedKeySystem("org.chromium.externalclearkey.something.else"));
|
| - EXPECT_FALSE(IsSupportedKeySystem("org.chromium.externalclearkey.other"));
|
| - EXPECT_FALSE(IsSupportedKeySystem("org.chromium.other"));
|
| -
|
| - EXPECT_FALSE(IsSupportedKeySystem("com.chromecast"));
|
| - EXPECT_FALSE(IsSupportedKeySystem("com.chromecast."));
|
| - EXPECT_TRUE(IsSupportedKeySystem("com.chromecast.something"));
|
| - EXPECT_FALSE(IsSupportedKeySystem("com.chromecast.something.else"));
|
| - EXPECT_FALSE(IsSupportedKeySystem("com.chromecast.other"));
|
| -
|
| - EXPECT_FALSE(IsSupportedKeySystem("x-"));
|
| - EXPECT_TRUE(IsSupportedKeySystem("x-something"));
|
| - EXPECT_FALSE(IsSupportedKeySystem("x-something.else"));
|
| - EXPECT_FALSE(IsSupportedKeySystem("x-other"));
|
| -}
|
| -
|
| } // namespace media
|
|
|