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

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

Issue 23484019: Refactor KeySystems code to call a function to populate the info. (relanding r221932) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix build error (cannot |= an enum) Created 7 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/media/crypto/key_systems_info.cc ('k') | no next file » | 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 #include <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "content/public/common/content_client.h"
9 #include "content/public/renderer/content_renderer_client.h"
8 #include "content/renderer/media/crypto/key_systems.h" 10 #include "content/renderer/media/crypto/key_systems.h"
9 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/WebKit/public/platform/WebString.h" 12 #include "third_party/WebKit/public/platform/WebString.h"
11 13
12 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 14 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
13 15
14 // Death tests are not always available, including on Android. 16 // Death tests are not always available, including on Android.
15 // EXPECT_DEBUG_DEATH_PORTABLE executes tests correctly except in the case that 17 // EXPECT_DEBUG_DEATH_PORTABLE executes tests correctly except in the case that
16 // death tests are not available and NDEBUG is not defined. 18 // death tests are not available and NDEBUG is not defined.
17 #if defined(GTEST_HAS_DEATH_TEST) && !defined(OS_ANDROID) 19 #if defined(GTEST_HAS_DEATH_TEST) && !defined(OS_ANDROID)
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 133
132 aac_codec_.push_back("mp4a"); 134 aac_codec_.push_back("mp4a");
133 135
134 avc1_and_aac_codecs_.push_back("avc1"); 136 avc1_and_aac_codecs_.push_back("avc1");
135 avc1_and_aac_codecs_.push_back("mp4a"); 137 avc1_and_aac_codecs_.push_back("mp4a");
136 138
137 unknown_codec_.push_back("foo"); 139 unknown_codec_.push_back("foo");
138 140
139 mixed_codecs_.push_back("vorbis"); 141 mixed_codecs_.push_back("vorbis");
140 mixed_codecs_.push_back("avc1"); 142 mixed_codecs_.push_back("avc1");
143
144 SetRendererClientForTesting(&content_renderer_client_);
141 } 145 }
142 146
143 typedef std::vector<std::string> CodecVector; 147 typedef std::vector<std::string> CodecVector;
144 148
145 const CodecVector& no_codecs() const { return no_codecs_; } 149 const CodecVector& no_codecs() const { return no_codecs_; }
146 150
147 const CodecVector& vp8_codec() const { return vp8_codec_; } 151 const CodecVector& vp8_codec() const { return vp8_codec_; }
148 const CodecVector& vp80_codec() const { return vp80_codec_; } 152 const CodecVector& vp80_codec() const { return vp80_codec_; }
149 const CodecVector& vorbis_codec() const { return vorbis_codec_; } 153 const CodecVector& vorbis_codec() const { return vorbis_codec_; }
150 const CodecVector& vp8_and_vorbis_codecs() const { 154 const CodecVector& vp8_and_vorbis_codecs() const {
(...skipping 27 matching lines...) Expand all
178 CodecVector avc1_extended_codec_; 182 CodecVector avc1_extended_codec_;
179 CodecVector avc1_dot_codec_; 183 CodecVector avc1_dot_codec_;
180 CodecVector avc2_codec_; 184 CodecVector avc2_codec_;
181 CodecVector aac_codec_; 185 CodecVector aac_codec_;
182 CodecVector avc1_and_aac_codecs_; 186 CodecVector avc1_and_aac_codecs_;
183 187
184 CodecVector unknown_codec_; 188 CodecVector unknown_codec_;
185 189
186 CodecVector mixed_codecs_; 190 CodecVector mixed_codecs_;
187 191
192 ContentRendererClient content_renderer_client_;
188 }; 193 };
189 194
190 TEST_F(KeySystemsTest, ClearKey_Basic) { 195 TEST_F(KeySystemsTest, ClearKey_Basic) {
191 EXPECT_TRUE(IsConcreteSupportedKeySystem(WebString::fromUTF8(kClearKey))); 196 EXPECT_TRUE(IsConcreteSupportedKeySystem(WebString::fromUTF8(kClearKey)));
192 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( 197 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
193 "video/webm", no_codecs(), kClearKey)); 198 "video/webm", no_codecs(), kClearKey));
194 199
195 // Not yet out from behind the vendor prefix. 200 // Not yet out from behind the vendor prefix.
196 EXPECT_FALSE(IsConcreteSupportedKeySystem("org.w3.clearkey")); 201 EXPECT_FALSE(IsConcreteSupportedKeySystem("org.w3.clearkey"));
197 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 202 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 EXPECT_TRUE(uuid.empty()); 843 EXPECT_TRUE(uuid.empty());
839 844
840 EXPECT_TRUE(GetUUID(kClearKey).empty()); 845 EXPECT_TRUE(GetUUID(kClearKey).empty());
841 846
842 EXPECT_DEBUG_DEATH_PORTABLE(uuid = GetUUID(""), " is not a concrete system"); 847 EXPECT_DEBUG_DEATH_PORTABLE(uuid = GetUUID(""), " is not a concrete system");
843 EXPECT_TRUE(uuid.empty()); 848 EXPECT_TRUE(uuid.empty());
844 } 849 }
845 #endif // defined(OS_ANDROID) 850 #endif // defined(OS_ANDROID)
846 851
847 } // namespace content 852 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/crypto/key_systems_info.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698