| 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 "content/public/common/content_client.h" | 8 #include "content/public/common/content_client.h" |
| 9 #include "content/public/common/eme_constants.h" |
| 9 #include "content/public/renderer/content_renderer_client.h" | 10 #include "content/public/renderer/content_renderer_client.h" |
| 10 #include "content/public/renderer/key_system_info.h" | 11 #include "content/public/renderer/key_system_info.h" |
| 11 #include "content/renderer/media/crypto/key_systems.h" | 12 #include "content/renderer/media/crypto/key_systems.h" |
| 12 #include "content/test/test_content_client.h" | 13 #include "content/test/test_content_client.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "third_party/WebKit/public/platform/WebString.h" | 15 #include "third_party/WebKit/public/platform/WebString.h" |
| 15 | 16 |
| 16 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | 17 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
| 17 | 18 |
| 18 // Death tests are not always available, including on Android. | 19 // Death tests are not always available, including on Android. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 class TestContentRendererClient : public ContentRendererClient { | 94 class TestContentRendererClient : public ContentRendererClient { |
| 94 virtual void AddKeySystems( | 95 virtual void AddKeySystems( |
| 95 std::vector<content::KeySystemInfo>* key_systems) OVERRIDE; | 96 std::vector<content::KeySystemInfo>* key_systems) OVERRIDE; |
| 96 }; | 97 }; |
| 97 | 98 |
| 98 void TestContentRendererClient::AddKeySystems( | 99 void TestContentRendererClient::AddKeySystems( |
| 99 std::vector<content::KeySystemInfo>* key_systems) { | 100 std::vector<content::KeySystemInfo>* key_systems) { |
| 100 KeySystemInfo aes(kUsesAes); | 101 KeySystemInfo aes(kUsesAes); |
| 101 aes.supported_codecs = EME_CODEC_WEBM_ALL; | 102 aes.supported_codecs = EME_CODEC_WEBM_ALL; |
| 102 aes.supported_codecs |= TEST_CODEC_FOO_ALL; | 103 aes.supported_codecs |= TEST_CODEC_FOO_ALL; |
| 104 aes.supported_init_data_types = EME_INIT_DATA_TYPE_ALL; |
| 103 aes.use_aes_decryptor = true; | 105 aes.use_aes_decryptor = true; |
| 104 key_systems->push_back(aes); | 106 key_systems->push_back(aes); |
| 105 | 107 |
| 106 KeySystemInfo ext(kExternal); | 108 KeySystemInfo ext(kExternal); |
| 107 ext.supported_codecs = EME_CODEC_WEBM_ALL; | 109 ext.supported_codecs = EME_CODEC_WEBM_ALL; |
| 108 ext.supported_codecs |= TEST_CODEC_FOO_ALL; | 110 ext.supported_codecs |= TEST_CODEC_FOO_ALL; |
| 111 ext.supported_init_data_types = EME_INIT_DATA_TYPE_ALL; |
| 109 ext.parent_key_system = kExternalParent; | 112 ext.parent_key_system = kExternalParent; |
| 110 #if defined(ENABLE_PEPPER_CDMS) | 113 #if defined(ENABLE_PEPPER_CDMS) |
| 111 ext.pepper_type = "application/x-ppapi-external-cdm"; | 114 ext.pepper_type = "application/x-ppapi-external-cdm"; |
| 112 #endif // defined(ENABLE_PEPPER_CDMS) | 115 #endif // defined(ENABLE_PEPPER_CDMS) |
| 113 key_systems->push_back(ext); | 116 key_systems->push_back(ext); |
| 114 } | 117 } |
| 115 | 118 |
| 119 // TODO(sandersd): Refactor. http://crbug.com/417444 |
| 116 class KeySystemsTest : public testing::Test { | 120 class KeySystemsTest : public testing::Test { |
| 117 protected: | 121 protected: |
| 118 KeySystemsTest() { | 122 KeySystemsTest() { |
| 119 vp8_codec_.push_back("vp8"); | 123 vp8_codec_.push_back("vp8"); |
| 120 | 124 |
| 121 vp80_codec_.push_back("vp8.0"); | 125 vp80_codec_.push_back("vp8.0"); |
| 122 | 126 |
| 123 vp9_codec_.push_back("vp9"); | 127 vp9_codec_.push_back("vp9"); |
| 124 | 128 |
| 125 vp90_codec_.push_back("vp9.0"); | 129 vp90_codec_.push_back("vp9.0"); |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 | 641 |
| 638 #if defined(WIDEVINE_CDM_AVAILABLE) | 642 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 639 const char* const kTestWidevineUmaName = "Widevine"; | 643 const char* const kTestWidevineUmaName = "Widevine"; |
| 640 #else | 644 #else |
| 641 const char* const kTestWidevineUmaName = "Unknown"; | 645 const char* const kTestWidevineUmaName = "Unknown"; |
| 642 #endif | 646 #endif |
| 643 EXPECT_EQ(kTestWidevineUmaName, KeySystemNameForUMA("com.widevine.alpha")); | 647 EXPECT_EQ(kTestWidevineUmaName, KeySystemNameForUMA("com.widevine.alpha")); |
| 644 } | 648 } |
| 645 | 649 |
| 646 } // namespace content | 650 } // namespace content |
| OLD | NEW |