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 "base/logging.h" | 8 #include "base/logging.h" |
9 #include "media/base/eme_constants.h" | 9 #include "media/base/eme_constants.h" |
10 #include "media/base/key_system_info.h" | 10 #include "media/base/key_system_info.h" |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 CodecVector mixed_codecs_; | 287 CodecVector mixed_codecs_; |
288 | 288 |
289 TestMediaClient test_media_client_; | 289 TestMediaClient test_media_client_; |
290 }; | 290 }; |
291 | 291 |
292 // TODO(ddorwin): Consider moving GetPepperType() calls out to their own test. | 292 // TODO(ddorwin): Consider moving GetPepperType() calls out to their own test. |
293 | 293 |
294 TEST_F(KeySystemsTest, EmptyKeySystem) { | 294 TEST_F(KeySystemsTest, EmptyKeySystem) { |
295 EXPECT_FALSE(IsConcreteSupportedKeySystem(std::string())); | 295 EXPECT_FALSE(IsConcreteSupportedKeySystem(std::string())); |
296 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 296 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
297 kVideoWebM, no_codecs(), std::string())); | 297 kVideoWebM, no_codecs(), std::string(), false)); |
298 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(std::string())); | 298 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(std::string())); |
299 } | 299 } |
300 | 300 |
301 // Clear Key is the only key system registered in content. | 301 // Clear Key is the only key system registered in content. |
302 TEST_F(KeySystemsTest, ClearKey) { | 302 TEST_F(KeySystemsTest, ClearKey) { |
303 EXPECT_TRUE(IsConcreteSupportedKeySystem(kClearKey)); | 303 EXPECT_TRUE(IsConcreteSupportedKeySystem(kClearKey)); |
304 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 304 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
305 kVideoWebM, no_codecs(), kClearKey)); | 305 kVideoWebM, no_codecs(), kClearKey, false)); |
306 | 306 |
307 EXPECT_EQ("ClearKey", GetKeySystemNameForUMA(kClearKey)); | 307 EXPECT_EQ("ClearKey", GetKeySystemNameForUMA(kClearKey)); |
308 | 308 |
309 // Prefixed Clear Key is not supported internally. | 309 // Prefixed Clear Key is not supported internally. |
310 EXPECT_FALSE(IsConcreteSupportedKeySystem(kPrefixedClearKey)); | 310 EXPECT_FALSE(IsConcreteSupportedKeySystem(kPrefixedClearKey)); |
311 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 311 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
312 kVideoWebM, no_codecs(), kPrefixedClearKey)); | 312 kVideoWebM, no_codecs(), kPrefixedClearKey, false)); |
313 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kPrefixedClearKey)); | 313 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kPrefixedClearKey)); |
314 } | 314 } |
315 | 315 |
316 // The key system is not registered and therefore is unrecognized. | 316 // The key system is not registered and therefore is unrecognized. |
317 TEST_F(KeySystemsTest, Basic_UnrecognizedKeySystem) { | 317 TEST_F(KeySystemsTest, Basic_UnrecognizedKeySystem) { |
318 static const char* const kUnrecognized = "org.example.unrecognized"; | 318 static const char* const kUnrecognized = "org.example.unrecognized"; |
319 | 319 |
320 EXPECT_FALSE(IsConcreteSupportedKeySystem(kUnrecognized)); | 320 EXPECT_FALSE(IsConcreteSupportedKeySystem(kUnrecognized)); |
321 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 321 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
322 kVideoWebM, no_codecs(), kUnrecognized)); | 322 kVideoWebM, no_codecs(), kUnrecognized, false)); |
323 | 323 |
324 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kUnrecognized)); | 324 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kUnrecognized)); |
325 | 325 |
326 bool can_use = false; | 326 bool can_use = false; |
327 EXPECT_DEBUG_DEATH_PORTABLE( | 327 EXPECT_DEBUG_DEATH_PORTABLE( |
328 can_use = CanUseAesDecryptor(kUnrecognized), | 328 can_use = CanUseAesDecryptor(kUnrecognized), |
329 "org.example.unrecognized is not a known concrete system"); | 329 "org.example.unrecognized is not a known concrete system"); |
330 EXPECT_FALSE(can_use); | 330 EXPECT_FALSE(can_use); |
331 | 331 |
332 #if defined(ENABLE_PEPPER_CDMS) | 332 #if defined(ENABLE_PEPPER_CDMS) |
333 std::string type; | 333 std::string type; |
334 EXPECT_DEBUG_DEATH(type = GetPepperType(kUnrecognized), | 334 EXPECT_DEBUG_DEATH(type = GetPepperType(kUnrecognized), |
335 "org.example.unrecognized is not a known concrete system"); | 335 "org.example.unrecognized is not a known concrete system"); |
336 EXPECT_TRUE(type.empty()); | 336 EXPECT_TRUE(type.empty()); |
337 #endif | 337 #endif |
338 } | 338 } |
339 | 339 |
340 TEST_F(KeySystemsTest, Basic_UsesAesDecryptor) { | 340 TEST_F(KeySystemsTest, Basic_UsesAesDecryptor) { |
341 EXPECT_TRUE(IsConcreteSupportedKeySystem(kUsesAes)); | 341 EXPECT_TRUE(IsConcreteSupportedKeySystem(kUsesAes)); |
342 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 342 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
343 kVideoWebM, no_codecs(), kUsesAes)); | 343 kVideoWebM, no_codecs(), kUsesAes, false)); |
344 | 344 |
345 // No UMA value for this test key system. | 345 // No UMA value for this test key system. |
346 EXPECT_EQ("UseAes", GetKeySystemNameForUMA(kUsesAes)); | 346 EXPECT_EQ("UseAes", GetKeySystemNameForUMA(kUsesAes)); |
347 | 347 |
348 EXPECT_TRUE(CanUseAesDecryptor(kUsesAes)); | 348 EXPECT_TRUE(CanUseAesDecryptor(kUsesAes)); |
349 #if defined(ENABLE_PEPPER_CDMS) | 349 #if defined(ENABLE_PEPPER_CDMS) |
350 std::string type; | 350 std::string type; |
351 EXPECT_DEBUG_DEATH(type = GetPepperType(kUsesAes), | 351 EXPECT_DEBUG_DEATH(type = GetPepperType(kUsesAes), |
352 "org.example.clear is not Pepper-based"); | 352 "org.example.clear is not Pepper-based"); |
353 EXPECT_TRUE(type.empty()); | 353 EXPECT_TRUE(type.empty()); |
354 #endif | 354 #endif |
355 } | 355 } |
356 | 356 |
357 TEST_F(KeySystemsTest, | 357 TEST_F(KeySystemsTest, |
358 IsSupportedKeySystemWithMediaMimeType_UsesAesDecryptor_TypesContainer1) { | 358 IsSupportedKeySystemWithMediaMimeType_UsesAesDecryptor_TypesContainer1) { |
359 // Valid video types. | 359 // Valid video types. |
360 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 360 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
361 kVideoWebM, vp8_codec(), kUsesAes)); | 361 kVideoWebM, vp8_codec(), kUsesAes, false)); |
362 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 362 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
363 kVideoWebM, vp80_codec(), kUsesAes)); | 363 kVideoWebM, vp80_codec(), kUsesAes, false)); |
364 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 364 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
365 kVideoWebM, vp8_and_vorbis_codecs(), kUsesAes)); | 365 kVideoWebM, vp8_and_vorbis_codecs(), kUsesAes, false)); |
366 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 366 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
367 kVideoWebM, vp9_codec(), kUsesAes)); | 367 kVideoWebM, vp9_codec(), kUsesAes, false)); |
368 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 368 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
369 kVideoWebM, vp90_codec(), kUsesAes)); | 369 kVideoWebM, vp90_codec(), kUsesAes, false)); |
370 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 370 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
371 kVideoWebM, vp9_and_vorbis_codecs(), kUsesAes)); | 371 kVideoWebM, vp9_and_vorbis_codecs(), kUsesAes, false)); |
372 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 372 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
373 kVideoWebM, vorbis_codec(), kUsesAes)); | 373 kVideoWebM, vorbis_codec(), kUsesAes, false)); |
374 | 374 |
375 // Non-Webm codecs. | 375 // Non-Webm codecs. |
376 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 376 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
377 kVideoWebM, foovideo_codec(), kUsesAes)); | 377 kVideoWebM, foovideo_codec(), kUsesAes, false)); |
378 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 378 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
379 kVideoWebM, unknown_codec(), kUsesAes)); | 379 kVideoWebM, unknown_codec(), kUsesAes, false)); |
380 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 380 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
381 kVideoWebM, mixed_codecs(), kUsesAes)); | 381 kVideoWebM, mixed_codecs(), kUsesAes, false)); |
382 | 382 |
383 // Valid audio types. | 383 // Valid audio types. |
384 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 384 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
385 kAudioWebM, no_codecs(), kUsesAes)); | 385 kAudioWebM, no_codecs(), kUsesAes, false)); |
386 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 386 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
387 kAudioWebM, vorbis_codec(), kUsesAes)); | 387 kAudioWebM, vorbis_codec(), kUsesAes, false)); |
388 | 388 |
389 // Non-audio codecs. | 389 // Non-audio codecs. |
390 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 390 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
391 kAudioWebM, vp8_codec(), kUsesAes)); | 391 kAudioWebM, vp8_codec(), kUsesAes, false)); |
392 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 392 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
393 kAudioWebM, vp8_and_vorbis_codecs(), kUsesAes)); | 393 kAudioWebM, vp8_and_vorbis_codecs(), kUsesAes, false)); |
394 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 394 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
395 kAudioWebM, vp9_codec(), kUsesAes)); | 395 kAudioWebM, vp9_codec(), kUsesAes, false)); |
396 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 396 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
397 kAudioWebM, vp9_and_vorbis_codecs(), kUsesAes)); | 397 kAudioWebM, vp9_and_vorbis_codecs(), kUsesAes, false)); |
398 | 398 |
399 // Non-Webm codec. | 399 // Non-Webm codec. |
400 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 400 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
401 kAudioWebM, fooaudio_codec(), kUsesAes)); | 401 kAudioWebM, fooaudio_codec(), kUsesAes, false)); |
402 } | 402 } |
403 | 403 |
404 // No parent is registered for UsesAes. | 404 // No parent is registered for UsesAes. |
405 TEST_F(KeySystemsTest, Parent_NoParentRegistered) { | 405 TEST_F(KeySystemsTest, Parent_NoParentRegistered) { |
406 EXPECT_FALSE(IsConcreteSupportedKeySystem(kUsesAesParent)); | 406 EXPECT_FALSE(IsConcreteSupportedKeySystem(kUsesAesParent)); |
407 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 407 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
408 kVideoWebM, no_codecs(), kUsesAesParent)); | 408 kVideoWebM, no_codecs(), kUsesAesParent, false)); |
409 | 409 |
410 // The parent is not supported for most things. | 410 // The parent is not supported for most things. |
411 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kUsesAesParent)); | 411 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kUsesAesParent)); |
412 bool result = false; | 412 bool result = false; |
413 EXPECT_DEBUG_DEATH_PORTABLE(result = CanUseAesDecryptor(kUsesAesParent), | 413 EXPECT_DEBUG_DEATH_PORTABLE(result = CanUseAesDecryptor(kUsesAesParent), |
414 "org.example is not a known concrete system"); | 414 "org.example is not a known concrete system"); |
415 EXPECT_FALSE(result); | 415 EXPECT_FALSE(result); |
416 #if defined(ENABLE_PEPPER_CDMS) | 416 #if defined(ENABLE_PEPPER_CDMS) |
417 std::string type; | 417 std::string type; |
418 EXPECT_DEBUG_DEATH(type = GetPepperType(kUsesAesParent), | 418 EXPECT_DEBUG_DEATH(type = GetPepperType(kUsesAesParent), |
419 "org.example is not a known concrete system"); | 419 "org.example is not a known concrete system"); |
420 EXPECT_TRUE(type.empty()); | 420 EXPECT_TRUE(type.empty()); |
421 #endif | 421 #endif |
422 } | 422 } |
423 | 423 |
424 TEST_F(KeySystemsTest, IsSupportedKeySystem_InvalidVariants) { | 424 TEST_F(KeySystemsTest, IsSupportedKeySystem_InvalidVariants) { |
425 // Case sensitive. | 425 // Case sensitive. |
426 EXPECT_FALSE(IsConcreteSupportedKeySystem("org.example.ClEaR")); | 426 EXPECT_FALSE(IsConcreteSupportedKeySystem("org.example.ClEaR")); |
427 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 427 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
428 kVideoWebM, no_codecs(), "org.example.ClEaR")); | 428 kVideoWebM, no_codecs(), "org.example.ClEaR", false)); |
429 | 429 |
430 // TLDs are not allowed. | 430 // TLDs are not allowed. |
431 EXPECT_FALSE(IsConcreteSupportedKeySystem("org.")); | 431 EXPECT_FALSE(IsConcreteSupportedKeySystem("org.")); |
432 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 432 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
433 kVideoWebM, no_codecs(), "org.")); | 433 kVideoWebM, no_codecs(), "org.", false)); |
434 EXPECT_FALSE(IsConcreteSupportedKeySystem("com")); | 434 EXPECT_FALSE(IsConcreteSupportedKeySystem("com")); |
435 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 435 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
436 kVideoWebM, no_codecs(), "com")); | 436 kVideoWebM, no_codecs(), "com", false)); |
437 | 437 |
438 // Extra period. | 438 // Extra period. |
439 EXPECT_FALSE(IsConcreteSupportedKeySystem("org.example.")); | 439 EXPECT_FALSE(IsConcreteSupportedKeySystem("org.example.")); |
440 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 440 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
441 kVideoWebM, no_codecs(), "org.example.")); | 441 kVideoWebM, no_codecs(), "org.example.", false)); |
442 | 442 |
443 // Incomplete. | 443 // Incomplete. |
444 EXPECT_FALSE(IsConcreteSupportedKeySystem("org.example.clea")); | 444 EXPECT_FALSE(IsConcreteSupportedKeySystem("org.example.clea")); |
445 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 445 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
446 kVideoWebM, no_codecs(), "org.example.clea")); | 446 kVideoWebM, no_codecs(), "org.example.clea", false)); |
447 | 447 |
448 // Extra character. | 448 // Extra character. |
449 EXPECT_FALSE(IsConcreteSupportedKeySystem("org.example.clearz")); | 449 EXPECT_FALSE(IsConcreteSupportedKeySystem("org.example.clearz")); |
450 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 450 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
451 kVideoWebM, no_codecs(), "org.example.clearz")); | 451 kVideoWebM, no_codecs(), "org.example.clearz", false)); |
452 | 452 |
453 // There are no child key systems for UsesAes. | 453 // There are no child key systems for UsesAes. |
454 EXPECT_FALSE(IsConcreteSupportedKeySystem("org.example.clear.foo")); | 454 EXPECT_FALSE(IsConcreteSupportedKeySystem("org.example.clear.foo")); |
455 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 455 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
456 kVideoWebM, no_codecs(), "org.example.clear.foo")); | 456 kVideoWebM, no_codecs(), "org.example.clear.foo", false)); |
457 } | 457 } |
458 | 458 |
459 TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_NoType) { | 459 TEST_F(KeySystemsTest, IsSupportedKeySystemWithMediaMimeType_NoType) { |
460 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 460 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
461 std::string(), no_codecs(), kUsesAes)); | 461 std::string(), no_codecs(), kUsesAes, false)); |
462 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 462 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
463 std::string(), no_codecs(), kUsesAesParent)); | 463 std::string(), no_codecs(), kUsesAesParent, false)); |
464 | 464 |
465 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 465 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
466 std::string(), no_codecs(), "org.example.foo")); | 466 std::string(), no_codecs(), "org.example.foo", false)); |
467 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 467 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
468 std::string(), no_codecs(), "org.example.clear.foo")); | 468 std::string(), no_codecs(), "org.example.clear.foo", false)); |
469 } | 469 } |
470 | 470 |
471 // Tests the second registered container type. | 471 // Tests the second registered container type. |
472 // TODO(ddorwin): Combined with TypesContainer1 in a future CL. | 472 // TODO(ddorwin): Combined with TypesContainer1 in a future CL. |
473 TEST_F(KeySystemsTest, | 473 TEST_F(KeySystemsTest, |
474 IsSupportedKeySystemWithMediaMimeType_UsesAesDecryptor_TypesContainer2) { | 474 IsSupportedKeySystemWithMediaMimeType_UsesAesDecryptor_TypesContainer2) { |
475 // Valid video types. | 475 // Valid video types. |
476 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 476 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
477 kVideoFoo, no_codecs(), kUsesAes)); | 477 kVideoFoo, no_codecs(), kUsesAes, false)); |
478 // The parent should be supported but is not. See http://crbug.com/164303. | 478 // The parent should be supported but is not. See http://crbug.com/164303. |
479 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 479 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
480 kVideoFoo, no_codecs(), kUsesAesParent)); | 480 kVideoFoo, no_codecs(), kUsesAesParent, false)); |
481 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 481 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
482 kVideoFoo, foovideo_codec(), kUsesAes)); | 482 kVideoFoo, foovideo_codec(), kUsesAes, false)); |
483 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 483 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
484 kVideoFoo, foovideo_and_fooaudio_codecs(), kUsesAes)); | 484 kVideoFoo, foovideo_and_fooaudio_codecs(), kUsesAes, false)); |
485 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 485 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
486 kVideoFoo, fooaudio_codec(), kUsesAes)); | 486 kVideoFoo, fooaudio_codec(), kUsesAes, false)); |
487 | 487 |
488 // Extended codecs fail because this is handled by SimpleWebMimeRegistryImpl. | 488 // Extended codecs fail because this is handled by SimpleWebMimeRegistryImpl. |
489 // They should really pass canPlayType(). | 489 // They should really pass canPlayType(). |
490 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 490 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
491 kVideoFoo, foovideo_extended_codec(), kUsesAes)); | 491 kVideoFoo, foovideo_extended_codec(), kUsesAes, false)); |
492 | 492 |
493 // Invalid codec format. | 493 // Invalid codec format. |
494 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 494 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
495 kVideoFoo, foovideo_dot_codec(), kUsesAes)); | 495 kVideoFoo, foovideo_dot_codec(), kUsesAes, false)); |
496 | 496 |
497 // Non-container2 codec. | 497 // Non-container2 codec. |
498 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 498 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
499 kVideoFoo, vp8_codec(), kUsesAes)); | 499 kVideoFoo, vp8_codec(), kUsesAes, false)); |
500 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 500 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
501 kVideoFoo, unknown_codec(), kUsesAes)); | 501 kVideoFoo, unknown_codec(), kUsesAes, false)); |
502 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 502 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
503 kVideoFoo, mixed_codecs(), kUsesAes)); | 503 kVideoFoo, mixed_codecs(), kUsesAes, false)); |
504 | 504 |
505 // Valid audio types. | 505 // Valid audio types. |
506 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 506 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
507 kAudioFoo, no_codecs(), kUsesAes)); | 507 kAudioFoo, no_codecs(), kUsesAes, false)); |
508 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 508 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
509 kAudioFoo, fooaudio_codec(), kUsesAes)); | 509 kAudioFoo, fooaudio_codec(), kUsesAes, false)); |
510 | 510 |
511 // Non-audio codecs. | 511 // Non-audio codecs. |
512 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 512 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
513 kAudioFoo, foovideo_codec(), kUsesAes)); | 513 kAudioFoo, foovideo_codec(), kUsesAes, false)); |
514 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 514 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
515 kAudioFoo, foovideo_and_fooaudio_codecs(), kUsesAes)); | 515 kAudioFoo, foovideo_and_fooaudio_codecs(), kUsesAes, false)); |
516 | 516 |
517 // Non-container2 codec. | 517 // Non-container2 codec. |
518 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 518 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
519 kAudioFoo, vorbis_codec(), kUsesAes)); | 519 kAudioFoo, vorbis_codec(), kUsesAes, false)); |
520 } | 520 } |
521 | 521 |
522 // | 522 // |
523 // Non-AesDecryptor-based key system. | 523 // Non-AesDecryptor-based key system. |
524 // | 524 // |
525 | 525 |
526 TEST_F(KeySystemsTest, Basic_ExternalDecryptor) { | 526 TEST_F(KeySystemsTest, Basic_ExternalDecryptor) { |
527 EXPECT_TRUE(IsConcreteSupportedKeySystem(kExternal)); | 527 EXPECT_TRUE(IsConcreteSupportedKeySystem(kExternal)); |
528 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 528 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
529 kVideoWebM, no_codecs(), kExternal)); | 529 kVideoWebM, no_codecs(), kExternal, false)); |
530 | 530 |
531 EXPECT_FALSE(CanUseAesDecryptor(kExternal)); | 531 EXPECT_FALSE(CanUseAesDecryptor(kExternal)); |
532 #if defined(ENABLE_PEPPER_CDMS) | 532 #if defined(ENABLE_PEPPER_CDMS) |
533 EXPECT_EQ("application/x-ppapi-external-cdm", GetPepperType(kExternal)); | 533 EXPECT_EQ("application/x-ppapi-external-cdm", GetPepperType(kExternal)); |
534 #endif // defined(ENABLE_PEPPER_CDMS) | 534 #endif // defined(ENABLE_PEPPER_CDMS) |
535 } | 535 } |
536 | 536 |
537 TEST_F(KeySystemsTest, Parent_ParentRegistered) { | 537 TEST_F(KeySystemsTest, Parent_ParentRegistered) { |
538 // The parent system is not a concrete system but is supported. | 538 // The parent system is not a concrete system but is supported. |
539 EXPECT_FALSE(IsConcreteSupportedKeySystem(kExternalParent)); | 539 EXPECT_FALSE(IsConcreteSupportedKeySystem(kExternalParent)); |
540 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 540 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
541 kVideoWebM, no_codecs(), kExternalParent)); | 541 kVideoWebM, no_codecs(), kExternalParent, false)); |
542 | 542 |
543 // The parent is not supported for most things. | 543 // The parent is not supported for most things. |
544 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kExternalParent)); | 544 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kExternalParent)); |
545 bool result = false; | 545 bool result = false; |
546 EXPECT_DEBUG_DEATH_PORTABLE(result = CanUseAesDecryptor(kExternalParent), | 546 EXPECT_DEBUG_DEATH_PORTABLE(result = CanUseAesDecryptor(kExternalParent), |
547 "com.example is not a known concrete system"); | 547 "com.example is not a known concrete system"); |
548 EXPECT_FALSE(result); | 548 EXPECT_FALSE(result); |
549 #if defined(ENABLE_PEPPER_CDMS) | 549 #if defined(ENABLE_PEPPER_CDMS) |
550 std::string type; | 550 std::string type; |
551 EXPECT_DEBUG_DEATH(type = GetPepperType(kExternalParent), | 551 EXPECT_DEBUG_DEATH(type = GetPepperType(kExternalParent), |
552 "com.example is not a known concrete system"); | 552 "com.example is not a known concrete system"); |
553 EXPECT_TRUE(type.empty()); | 553 EXPECT_TRUE(type.empty()); |
554 #endif | 554 #endif |
555 } | 555 } |
556 | 556 |
557 TEST_F( | 557 TEST_F( |
558 KeySystemsTest, | 558 KeySystemsTest, |
559 IsSupportedKeySystemWithMediaMimeType_ExternalDecryptor_TypesContainer1) { | 559 IsSupportedKeySystemWithMediaMimeType_ExternalDecryptor_TypesContainer1) { |
560 // Valid video types. | 560 // Valid video types. |
561 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 561 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
562 kVideoWebM, no_codecs(), kExternal)); | 562 kVideoWebM, no_codecs(), kExternal, false)); |
563 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 563 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
564 kVideoWebM, vp8_codec(), kExternal)); | 564 kVideoWebM, vp8_codec(), kExternal, false)); |
565 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 565 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
566 kVideoWebM, vp80_codec(), kExternal)); | 566 kVideoWebM, vp80_codec(), kExternal, false)); |
567 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 567 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
568 kVideoWebM, vp8_and_vorbis_codecs(), kExternal)); | 568 kVideoWebM, vp8_and_vorbis_codecs(), kExternal, false)); |
569 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 569 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
570 kVideoWebM, vp9_codec(), kExternal)); | 570 kVideoWebM, vp9_codec(), kExternal, false)); |
571 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 571 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
572 kVideoWebM, vp90_codec(), kExternal)); | 572 kVideoWebM, vp90_codec(), kExternal, false)); |
573 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 573 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
574 kVideoWebM, vp9_and_vorbis_codecs(), kExternal)); | 574 kVideoWebM, vp9_and_vorbis_codecs(), kExternal, false)); |
575 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 575 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
576 kVideoWebM, vorbis_codec(), kExternal)); | 576 kVideoWebM, vorbis_codec(), kExternal, false)); |
577 | 577 |
578 // Valid video types - parent key system. | 578 // Valid video types - parent key system. |
579 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 579 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
580 kVideoWebM, no_codecs(), kExternalParent)); | 580 kVideoWebM, no_codecs(), kExternalParent, false)); |
581 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 581 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
582 kVideoWebM, vp8_codec(), kExternalParent)); | 582 kVideoWebM, vp8_codec(), kExternalParent, false)); |
583 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 583 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
584 kVideoWebM, vp80_codec(), kExternalParent)); | 584 kVideoWebM, vp80_codec(), kExternalParent, false)); |
585 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 585 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
586 kVideoWebM, vp8_and_vorbis_codecs(), kExternalParent)); | 586 kVideoWebM, vp8_and_vorbis_codecs(), kExternalParent, false)); |
587 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 587 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
588 kVideoWebM, vp9_codec(), kExternalParent)); | 588 kVideoWebM, vp9_codec(), kExternalParent, false)); |
589 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 589 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
590 kVideoWebM, vp90_codec(), kExternalParent)); | 590 kVideoWebM, vp90_codec(), kExternalParent, false)); |
591 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 591 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
592 kVideoWebM, vp9_and_vorbis_codecs(), kExternalParent)); | 592 kVideoWebM, vp9_and_vorbis_codecs(), kExternalParent, false)); |
593 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 593 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
594 kVideoWebM, vorbis_codec(), kExternalParent)); | 594 kVideoWebM, vorbis_codec(), kExternalParent, false)); |
595 | 595 |
596 // Non-Webm codecs. | 596 // Non-Webm codecs. |
597 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 597 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
598 kVideoWebM, foovideo_codec(), kExternal)); | 598 kVideoWebM, foovideo_codec(), kExternal, false)); |
599 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 599 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
600 kVideoWebM, unknown_codec(), kExternal)); | 600 kVideoWebM, unknown_codec(), kExternal, false)); |
601 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 601 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
602 kVideoWebM, mixed_codecs(), kExternal)); | 602 kVideoWebM, mixed_codecs(), kExternal, false)); |
603 | 603 |
604 // Valid audio types. | 604 // Valid audio types. |
605 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 605 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
606 kAudioWebM, no_codecs(), kExternal)); | 606 kAudioWebM, no_codecs(), kExternal, false)); |
607 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 607 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
608 kAudioWebM, vorbis_codec(), kExternal)); | 608 kAudioWebM, vorbis_codec(), kExternal, false)); |
609 | 609 |
610 // Valid audio types - parent key system. | 610 // Valid audio types - parent key system. |
611 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 611 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
612 kAudioWebM, no_codecs(), kExternalParent)); | 612 kAudioWebM, no_codecs(), kExternalParent, false)); |
613 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 613 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
614 kAudioWebM, vorbis_codec(), kExternalParent)); | 614 kAudioWebM, vorbis_codec(), kExternalParent, false)); |
615 | 615 |
616 // Non-audio codecs. | 616 // Non-audio codecs. |
617 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 617 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
618 kAudioWebM, vp8_codec(), kExternal)); | 618 kAudioWebM, vp8_codec(), kExternal, false)); |
619 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 619 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
620 kAudioWebM, vp8_and_vorbis_codecs(), kExternal)); | 620 kAudioWebM, vp8_and_vorbis_codecs(), kExternal, false)); |
621 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 621 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
622 kAudioWebM, vp9_codec(), kExternal)); | 622 kAudioWebM, vp9_codec(), kExternal, false)); |
623 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 623 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
624 kAudioWebM, vp9_and_vorbis_codecs(), kExternal)); | 624 kAudioWebM, vp9_and_vorbis_codecs(), kExternal, false)); |
625 | 625 |
626 // Non-Webm codec. | 626 // Non-Webm codec. |
627 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 627 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
628 kAudioWebM, fooaudio_codec(), kExternal)); | 628 kAudioWebM, fooaudio_codec(), kExternal, false)); |
629 } | 629 } |
630 | 630 |
631 TEST_F( | 631 TEST_F( |
632 KeySystemsTest, | 632 KeySystemsTest, |
633 IsSupportedKeySystemWithMediaMimeType_ExternalDecryptor_TypesContainer2) { | 633 IsSupportedKeySystemWithMediaMimeType_ExternalDecryptor_TypesContainer2) { |
634 // Valid video types. | 634 // Valid video types. |
635 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 635 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
636 kVideoFoo, no_codecs(), kExternal)); | 636 kVideoFoo, no_codecs(), kExternal, false)); |
637 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 637 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
638 kVideoFoo, foovideo_codec(), kExternal)); | 638 kVideoFoo, foovideo_codec(), kExternal, false)); |
639 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 639 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
640 kVideoFoo, foovideo_and_fooaudio_codecs(), kExternal)); | 640 kVideoFoo, foovideo_and_fooaudio_codecs(), kExternal, false)); |
641 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 641 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
642 kVideoFoo, fooaudio_codec(), kExternal)); | 642 kVideoFoo, fooaudio_codec(), kExternal, false)); |
643 | 643 |
644 // Valid video types - parent key system. | 644 // Valid video types - parent key system. |
645 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 645 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
646 kVideoFoo, no_codecs(), kExternalParent)); | 646 kVideoFoo, no_codecs(), kExternalParent, false)); |
647 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 647 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
648 kVideoFoo, foovideo_codec(), kExternalParent)); | 648 kVideoFoo, foovideo_codec(), kExternalParent, false)); |
649 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 649 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
650 kVideoFoo, foovideo_and_fooaudio_codecs(), kExternalParent)); | 650 kVideoFoo, foovideo_and_fooaudio_codecs(), kExternalParent, false)); |
651 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 651 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
652 kVideoFoo, fooaudio_codec(), kExternalParent)); | 652 kVideoFoo, fooaudio_codec(), kExternalParent, false)); |
653 | 653 |
654 // Extended codecs fail because this is handled by SimpleWebMimeRegistryImpl. | 654 // Extended codecs fail because this is handled by SimpleWebMimeRegistryImpl. |
655 // They should really pass canPlayType(). | 655 // They should really pass canPlayType(). |
656 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 656 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
657 kVideoFoo, foovideo_extended_codec(), kExternal)); | 657 kVideoFoo, foovideo_extended_codec(), kExternal, false)); |
658 | 658 |
659 // Invalid codec format. | 659 // Invalid codec format. |
660 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 660 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
661 kVideoFoo, foovideo_dot_codec(), kExternal)); | 661 kVideoFoo, foovideo_dot_codec(), kExternal, false)); |
662 | 662 |
663 // Non-container2 codecs. | 663 // Non-container2 codecs. |
664 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 664 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
665 kVideoFoo, vp8_codec(), kExternal)); | 665 kVideoFoo, vp8_codec(), kExternal, false)); |
666 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 666 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
667 kVideoFoo, unknown_codec(), kExternal)); | 667 kVideoFoo, unknown_codec(), kExternal, false)); |
668 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 668 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
669 kVideoFoo, mixed_codecs(), kExternal)); | 669 kVideoFoo, mixed_codecs(), kExternal, false)); |
670 | 670 |
671 // Valid audio types. | 671 // Valid audio types. |
672 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 672 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
673 kAudioFoo, no_codecs(), kExternal)); | 673 kAudioFoo, no_codecs(), kExternal, false)); |
674 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 674 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
675 kAudioFoo, fooaudio_codec(), kExternal)); | 675 kAudioFoo, fooaudio_codec(), kExternal, false)); |
676 | 676 |
677 // Valid audio types - parent key system. | 677 // Valid audio types - parent key system. |
678 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 678 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
679 kAudioFoo, no_codecs(), kExternalParent)); | 679 kAudioFoo, no_codecs(), kExternalParent, false)); |
680 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 680 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
681 kAudioFoo, fooaudio_codec(), kExternalParent)); | 681 kAudioFoo, fooaudio_codec(), kExternalParent, false)); |
682 | 682 |
683 // Non-audio codecs. | 683 // Non-audio codecs. |
684 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 684 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
685 kAudioFoo, foovideo_codec(), kExternal)); | 685 kAudioFoo, foovideo_codec(), kExternal, false)); |
686 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 686 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
687 kAudioFoo, foovideo_and_fooaudio_codecs(), kExternal)); | 687 kAudioFoo, foovideo_and_fooaudio_codecs(), kExternal, false)); |
688 | 688 |
689 // Non-container2 codec. | 689 // Non-container2 codec. |
690 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 690 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
691 kAudioFoo, vorbis_codec(), kExternal)); | 691 kAudioFoo, vorbis_codec(), kExternal, false)); |
692 } | 692 } |
693 | 693 |
694 TEST_F(KeySystemsTest, KeySystemNameForUMA) { | 694 TEST_F(KeySystemsTest, KeySystemNameForUMA) { |
695 EXPECT_EQ("ClearKey", GetKeySystemNameForUMA(kClearKey)); | 695 EXPECT_EQ("ClearKey", GetKeySystemNameForUMA(kClearKey)); |
696 // Prefixed is not supported internally. | 696 // Prefixed is not supported internally. |
697 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kPrefixedClearKey)); | 697 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kPrefixedClearKey)); |
698 | 698 |
699 // External Clear Key never has a UMA name. | 699 // External Clear Key never has a UMA name. |
700 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kExternalClearKey)); | 700 EXPECT_EQ("Unknown", GetKeySystemNameForUMA(kExternalClearKey)); |
701 } | 701 } |
702 | 702 |
703 TEST_F(KeySystemsTest, KeySystemsUpdate) { | 703 TEST_F(KeySystemsTest, KeySystemsUpdate) { |
704 EXPECT_TRUE(IsConcreteSupportedKeySystem(kUsesAes)); | 704 EXPECT_TRUE(IsConcreteSupportedKeySystem(kUsesAes)); |
705 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 705 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
706 kVideoWebM, no_codecs(), kUsesAes)); | 706 kVideoWebM, no_codecs(), kUsesAes, false)); |
707 EXPECT_TRUE(IsConcreteSupportedKeySystem(kExternal)); | 707 EXPECT_TRUE(IsConcreteSupportedKeySystem(kExternal)); |
708 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 708 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
709 kVideoWebM, no_codecs(), kExternal)); | 709 kVideoWebM, no_codecs(), kExternal, false)); |
710 | 710 |
711 UpdateClientKeySystems(); | 711 UpdateClientKeySystems(); |
712 | 712 |
713 EXPECT_TRUE(IsConcreteSupportedKeySystem(kUsesAes)); | 713 EXPECT_TRUE(IsConcreteSupportedKeySystem(kUsesAes)); |
714 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( | 714 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
715 kVideoWebM, no_codecs(), kUsesAes)); | 715 kVideoWebM, no_codecs(), kUsesAes, false)); |
716 EXPECT_FALSE(IsConcreteSupportedKeySystem(kExternal)); | 716 EXPECT_FALSE(IsConcreteSupportedKeySystem(kExternal)); |
717 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 717 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
718 kVideoWebM, no_codecs(), kExternal)); | 718 kVideoWebM, no_codecs(), kExternal, false)); |
| 719 } |
| 720 |
| 721 TEST_F(KeySystemsTest, KeySystemsUpdateWithUMA) { |
| 722 EXPECT_TRUE(IsConcreteSupportedKeySystem(kUsesAes)); |
| 723 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 724 kVideoWebM, no_codecs(), kUsesAes, true)); |
| 725 EXPECT_TRUE(IsConcreteSupportedKeySystem(kExternal)); |
| 726 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 727 kVideoWebM, no_codecs(), kExternal, true)); |
| 728 |
| 729 UpdateClientKeySystems(); |
| 730 |
| 731 EXPECT_TRUE(IsConcreteSupportedKeySystem(kUsesAes)); |
| 732 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( |
| 733 kVideoWebM, no_codecs(), kUsesAes, true)); |
| 734 EXPECT_FALSE(IsConcreteSupportedKeySystem(kExternal)); |
| 735 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
| 736 kVideoWebM, no_codecs(), kExternal, true)); |
719 } | 737 } |
720 | 738 |
721 } // namespace media | 739 } // namespace media |
OLD | NEW |