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

Side by Side Diff: content/renderer/media/crypto/key_systems_unittest.cc

Issue 557723003: Implement Chromium side of MediaKeys.isTypeSupported(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Requested changes. Created 6 years, 3 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
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 #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
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;
ddorwin 2014/09/23 22:48:17 TODO: Add tests for IDT. The reason I say we can
sandersd (OOO until July 31) 2014/09/24 22:22:34 Done.
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
116 class KeySystemsTest : public testing::Test { 119 class KeySystemsTest : public testing::Test {
117 protected: 120 protected:
118 KeySystemsTest() { 121 KeySystemsTest() {
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 640
638 #if defined(WIDEVINE_CDM_AVAILABLE) 641 #if defined(WIDEVINE_CDM_AVAILABLE)
639 const char* const kTestWidevineUmaName = "Widevine"; 642 const char* const kTestWidevineUmaName = "Widevine";
640 #else 643 #else
641 const char* const kTestWidevineUmaName = "Unknown"; 644 const char* const kTestWidevineUmaName = "Unknown";
642 #endif 645 #endif
643 EXPECT_EQ(kTestWidevineUmaName, KeySystemNameForUMA("com.widevine.alpha")); 646 EXPECT_EQ(kTestWidevineUmaName, KeySystemNameForUMA("com.widevine.alpha"));
644 } 647 }
645 648
646 } // namespace content 649 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698