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

Side by Side Diff: webkit/media/crypto/key_systems_unittest.cc

Issue 11492003: Encrypted Media: Support Audio Decrypt-Only. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years 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 | « webkit/media/crypto/key_systems.cc ('k') | webkit/media/webmediaplayer_impl.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" 9 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
10 #include "webkit/media/crypto/key_systems.h" 10 #include "webkit/media/crypto/key_systems.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // Valid video types. 209 // Valid video types.
210 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( 210 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
211 "video/webm", no_codecs(), kClearKey)); 211 "video/webm", no_codecs(), kClearKey));
212 // The parent should be supported but is not. See http://crbug.com/164303. 212 // The parent should be supported but is not. See http://crbug.com/164303.
213 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 213 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
214 "video/webm", no_codecs(), "webkit-org.w3")); 214 "video/webm", no_codecs(), "webkit-org.w3"));
215 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( 215 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
216 "video/webm", vp8_codec(), kClearKey)); 216 "video/webm", vp8_codec(), kClearKey));
217 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( 217 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
218 "video/webm", vp80_codec(), kClearKey)); 218 "video/webm", vp80_codec(), kClearKey));
219 // These two should be true. See http://crbug.com/123421. 219 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
220 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
221 "video/webm", vp8_and_vorbis_codecs(), kClearKey)); 220 "video/webm", vp8_and_vorbis_codecs(), kClearKey));
222 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 221 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
223 "video/webm", vorbis_codec(), kClearKey)); 222 "video/webm", vorbis_codec(), kClearKey));
224 223
225 // Non-Webm codecs. 224 // Non-Webm codecs.
226 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 225 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
227 "video/webm", avc1_codec(), kClearKey)); 226 "video/webm", avc1_codec(), kClearKey));
228 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 227 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
229 "video/webm", unknown_codec(), kClearKey)); 228 "video/webm", unknown_codec(), kClearKey));
230 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 229 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
231 "video/webm", mixed_codecs(), kClearKey)); 230 "video/webm", mixed_codecs(), kClearKey));
232 231
233 // Valid audio types. 232 // Valid audio types.
234 // Should be true. See http://crbug.com/123421. 233 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
235 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
236 "audio/webm", no_codecs(), kClearKey)); 234 "audio/webm", no_codecs(), kClearKey));
237 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 235 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
238 "audio/webm", vorbis_codec(), kClearKey)); 236 "audio/webm", vorbis_codec(), kClearKey));
239 237
240 // Non-audio codecs. 238 // Non-audio codecs.
241 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 239 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
242 "audio/webm", vp8_codec(), kClearKey)); 240 "audio/webm", vp8_codec(), kClearKey));
243 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 241 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
244 "audio/webm", vp8_and_vorbis_codecs(), kClearKey)); 242 "audio/webm", vp8_and_vorbis_codecs(), kClearKey));
245 243
246 // Non-Webm codec. 244 // Non-Webm codec.
247 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 245 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
248 "audio/webm", aac_codec(), kClearKey)); 246 "audio/webm", aac_codec(), kClearKey));
249 } 247 }
250 248
251 TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_ClearKey_MP4) { 249 TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_ClearKey_MP4) {
252 // Valid video types. 250 // Valid video types.
253 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType( 251 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
254 "video/mp4", no_codecs(), kClearKey)); 252 "video/mp4", no_codecs(), kClearKey));
255 // The parent should be supported but is not. See http://crbug.com/164303. 253 // The parent should be supported but is not. See http://crbug.com/164303.
256 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 254 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
257 "video/mp4", no_codecs(), "webkit-org.w3")); 255 "video/mp4", no_codecs(), "webkit-org.w3"));
258 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType( 256 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
259 "video/mp4", avc1_codec(), kClearKey)); 257 "video/mp4", avc1_codec(), kClearKey));
260 // These two should be true. See http://crbug.com/123421. 258 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
261 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
262 "video/mp4", avc1_and_aac_codecs(), kClearKey)); 259 "video/mp4", avc1_and_aac_codecs(), kClearKey));
263 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 260 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
264 "video/mp4", aac_codec(), kClearKey)); 261 "video/mp4", aac_codec(), kClearKey));
265 262
266 // Extended codecs fail because this is handled by SimpleWebMimeRegistryImpl. 263 // Extended codecs fail because this is handled by SimpleWebMimeRegistryImpl.
267 // They should really pass canPlayType(). 264 // They should really pass canPlayType().
268 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 265 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
269 "video/mp4", avc1_extended_codec(), kClearKey)); 266 "video/mp4", avc1_extended_codec(), kClearKey));
270 267
271 // Invalid codec format. 268 // Invalid codec format.
272 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 269 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
273 "video/mp4", avc1_dot_codec(), kClearKey)); 270 "video/mp4", avc1_dot_codec(), kClearKey));
274 271
275 // Non-MP4 codecs. 272 // Non-MP4 codecs.
276 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 273 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
277 "video/mp4", avc2_codec(), kClearKey)); 274 "video/mp4", avc2_codec(), kClearKey));
278 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 275 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
279 "video/mp4", vp8_codec(), kClearKey)); 276 "video/mp4", vp8_codec(), kClearKey));
280 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 277 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
281 "video/mp4", unknown_codec(), kClearKey)); 278 "video/mp4", unknown_codec(), kClearKey));
282 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 279 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
283 "video/mp4", mixed_codecs(), kClearKey)); 280 "video/mp4", mixed_codecs(), kClearKey));
284 281
285 // Valid audio types. 282 // Valid audio types.
286 // Should be true. See http://crbug.com/123421. 283 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
287 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
288 "audio/mp4", no_codecs(), kClearKey)); 284 "audio/mp4", no_codecs(), kClearKey));
289 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 285 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
290 "audio/mp4", aac_codec(), kClearKey)); 286 "audio/mp4", aac_codec(), kClearKey));
291 287
292 // Non-audio codecs. 288 // Non-audio codecs.
293 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 289 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
294 "audio/mp4", avc1_codec(), kClearKey)); 290 "audio/mp4", avc1_codec(), kClearKey));
295 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 291 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
296 "audio/mp4", avc1_and_aac_codecs(), kClearKey)); 292 "audio/mp4", avc1_and_aac_codecs(), kClearKey));
297 293
298 // Non-MP4 codec. 294 // Non-MP4 codec.
299 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 295 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 "audio/mp4", avc1_codec(), kWidevineAlpha)); 661 "audio/mp4", avc1_codec(), kWidevineAlpha));
666 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 662 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
667 "audio/mp4", avc1_and_aac_codecs(), kWidevineAlpha)); 663 "audio/mp4", avc1_and_aac_codecs(), kWidevineAlpha));
668 664
669 // Non-MP4 codec. 665 // Non-MP4 codec.
670 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 666 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
671 "audio/mp4", vorbis_codec(), kWidevineAlpha)); 667 "audio/mp4", vorbis_codec(), kWidevineAlpha));
672 } 668 }
673 669
674 } // namespace webkit_media 670 } // namespace webkit_media
OLDNEW
« no previous file with comments | « webkit/media/crypto/key_systems.cc ('k') | webkit/media/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698