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

Side by Side Diff: chrome/browser/media/encrypted_media_istypesupported_browsertest.cc

Issue 254983006: Fix: Adding list of supported codecs for MP4 containers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adding check for std::string::npos Created 6 years, 6 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
« no previous file with comments | « no previous file | content/browser/media/media_canplaytype_browsertest.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 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/base_switches.h" 8 #include "base/base_switches.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 avc1_codec_.push_back("avc1"); 115 avc1_codec_.push_back("avc1");
116 116
117 avc1_extended_codec_.push_back("avc1.4D400C"); 117 avc1_extended_codec_.push_back("avc1.4D400C");
118 118
119 avc1_dot_codec_.push_back("avc1."); 119 avc1_dot_codec_.push_back("avc1.");
120 120
121 avc2_codec_.push_back("avc2"); 121 avc2_codec_.push_back("avc2");
122 122
123 avc3_codec_.push_back("avc3"); 123 avc3_codec_.push_back("avc3");
124 124
125 avc3_extended_codec_.push_back("avc3.64001f"); 125 avc3_extended_codec_.push_back("avc3.64001F");
126 126
127 aac_codec_.push_back("mp4a"); 127 aac_codec_.push_back("mp4a.40.2");
128
129 mp4a_invalid_no_extension_.push_back("mp4a");
128 130
129 avc1_and_aac_codecs_.push_back("avc1"); 131 avc1_and_aac_codecs_.push_back("avc1");
130 avc1_and_aac_codecs_.push_back("mp4a"); 132 avc1_and_aac_codecs_.push_back("mp4a.40.2");
133
134 avc3_and_aac_codecs_.push_back("avc3");
135 avc3_and_aac_codecs_.push_back("mp4a.40.2");
131 136
132 unknown_codec_.push_back("foo"); 137 unknown_codec_.push_back("foo");
133 138
134 mixed_codecs_.push_back("vorbis"); 139 mixed_codecs_.push_back("vorbis");
135 mixed_codecs_.push_back("avc1"); 140 mixed_codecs_.push_back("avc1");
141
142 vp8_invalid_extension_codec_.push_back("vp8.1");
136 } 143 }
137 144
138 typedef std::vector<std::string> CodecVector; 145 typedef std::vector<std::string> CodecVector;
139 146
140 const CodecVector& no_codecs() const { return no_codecs_; } 147 const CodecVector& no_codecs() const { return no_codecs_; }
141 const CodecVector& vp8_codec() const { return vp8_codec_; } 148 const CodecVector& vp8_codec() const { return vp8_codec_; }
142 const CodecVector& vp80_codec() const { return vp80_codec_; } 149 const CodecVector& vp80_codec() const { return vp80_codec_; }
143 const CodecVector& vp9_codec() const { return vp9_codec_; } 150 const CodecVector& vp9_codec() const { return vp9_codec_; }
144 const CodecVector& vp90_codec() const { return vp90_codec_; } 151 const CodecVector& vp90_codec() const { return vp90_codec_; }
145 const CodecVector& vorbis_codec() const { return vorbis_codec_; } 152 const CodecVector& vorbis_codec() const { return vorbis_codec_; }
146 const CodecVector& vp8_and_vorbis_codecs() const { 153 const CodecVector& vp8_and_vorbis_codecs() const {
147 return vp8_and_vorbis_codecs_; 154 return vp8_and_vorbis_codecs_;
148 } 155 }
149 const CodecVector& vp9_and_vorbis_codecs() const { 156 const CodecVector& vp9_and_vorbis_codecs() const {
150 return vp9_and_vorbis_codecs_; 157 return vp9_and_vorbis_codecs_;
151 } 158 }
152 const CodecVector& avc1_codec() const { return avc1_codec_; } 159 const CodecVector& avc1_codec() const { return avc1_codec_; }
153 const CodecVector& avc1_extended_codec() const { 160 const CodecVector& avc1_extended_codec() const {
154 return avc1_extended_codec_; 161 return avc1_extended_codec_;
155 } 162 }
156 const CodecVector& avc1_dot_codec() const { return avc1_dot_codec_; } 163 const CodecVector& avc1_dot_codec() const { return avc1_dot_codec_; }
157 const CodecVector& avc2_codec() const { return avc2_codec_; } 164 const CodecVector& avc2_codec() const { return avc2_codec_; }
158 const CodecVector& avc3_codec() const { return avc3_codec_; } 165 const CodecVector& avc3_codec() const { return avc3_codec_; }
159 const CodecVector& avc3_extended_codec() const { 166 const CodecVector& avc3_extended_codec() const {
160 return avc3_extended_codec_; 167 return avc3_extended_codec_;
161 } 168 }
162 const CodecVector& aac_codec() const { return aac_codec_; } 169 const CodecVector& aac_codec() const { return aac_codec_; }
170 const CodecVector& mp4a_invalid_no_extension() const {
171 return mp4a_invalid_no_extension_;
172 }
163 const CodecVector& avc1_and_aac_codecs() const { 173 const CodecVector& avc1_and_aac_codecs() const {
164 return avc1_and_aac_codecs_; 174 return avc1_and_aac_codecs_;
165 } 175 }
176 const CodecVector& avc3_and_aac_codecs() const {
177 return avc3_and_aac_codecs_;
178 }
166 const CodecVector& unknown_codec() const { return unknown_codec_; } 179 const CodecVector& unknown_codec() const { return unknown_codec_; }
167 const CodecVector& mixed_codecs() const { return mixed_codecs_; } 180 const CodecVector& mixed_codecs() const { return mixed_codecs_; }
181 const CodecVector& vp8_invalid_extension_codec() const {
182 return vp8_invalid_extension_codec_;
183 }
168 184
169 // Update the command line to load |adapter_name| for 185 // Update the command line to load |adapter_name| for
170 // |pepper_type_for_key_system|. 186 // |pepper_type_for_key_system|.
171 void RegisterPepperCdm(CommandLine* command_line, 187 void RegisterPepperCdm(CommandLine* command_line,
172 const std::string& adapter_name, 188 const std::string& adapter_name,
173 const std::string& pepper_type_for_key_system, 189 const std::string& pepper_type_for_key_system,
174 bool expect_adapter_exists = true) { 190 bool expect_adapter_exists = true) {
175 DCHECK(!is_pepper_cdm_registered_) 191 DCHECK(!is_pepper_cdm_registered_)
176 << "RegisterPepperCdm() can only be called once."; 192 << "RegisterPepperCdm() can only be called once.";
177 is_pepper_cdm_registered_ = true; 193 is_pepper_cdm_registered_ = true;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 CodecVector vorbis_codec_; 283 CodecVector vorbis_codec_;
268 CodecVector vp8_and_vorbis_codecs_; 284 CodecVector vp8_and_vorbis_codecs_;
269 CodecVector vp9_and_vorbis_codecs_; 285 CodecVector vp9_and_vorbis_codecs_;
270 CodecVector avc1_codec_; 286 CodecVector avc1_codec_;
271 CodecVector avc1_extended_codec_; 287 CodecVector avc1_extended_codec_;
272 CodecVector avc1_dot_codec_; 288 CodecVector avc1_dot_codec_;
273 CodecVector avc2_codec_; 289 CodecVector avc2_codec_;
274 CodecVector avc3_codec_; 290 CodecVector avc3_codec_;
275 CodecVector avc3_extended_codec_; 291 CodecVector avc3_extended_codec_;
276 CodecVector aac_codec_; 292 CodecVector aac_codec_;
293 CodecVector mp4a_invalid_no_extension_;
277 CodecVector avc1_and_aac_codecs_; 294 CodecVector avc1_and_aac_codecs_;
295 CodecVector avc3_and_aac_codecs_;
278 CodecVector unknown_codec_; 296 CodecVector unknown_codec_;
279 CodecVector mixed_codecs_; 297 CodecVector mixed_codecs_;
298 CodecVector vp8_invalid_extension_codec_;
280 bool is_test_page_loaded_; 299 bool is_test_page_loaded_;
281 bool is_pepper_cdm_registered_; 300 bool is_pepper_cdm_registered_;
282 }; 301 };
283 302
284 // For ExternalClearKey tests, ensure that the ClearKey adapter is loaded. 303 // For ExternalClearKey tests, ensure that the ClearKey adapter is loaded.
285 class EncryptedMediaIsTypeSupportedExternalClearKeyTest 304 class EncryptedMediaIsTypeSupportedExternalClearKeyTest
286 : public EncryptedMediaIsTypeSupportedTest { 305 : public EncryptedMediaIsTypeSupportedTest {
287 #if defined(ENABLE_PEPPER_CDMS) 306 #if defined(ENABLE_PEPPER_CDMS)
288 protected: 307 protected:
289 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 308 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 "video/webm", vp90_codec(), kPrefixedClearKey)); 468 "video/webm", vp90_codec(), kPrefixedClearKey));
450 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( 469 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
451 "video/webm", vp9_and_vorbis_codecs(), kPrefixedClearKey)); 470 "video/webm", vp9_and_vorbis_codecs(), kPrefixedClearKey));
452 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( 471 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
453 "video/webm", vorbis_codec(), kPrefixedClearKey)); 472 "video/webm", vorbis_codec(), kPrefixedClearKey));
454 473
455 // Non-Webm codecs. 474 // Non-Webm codecs.
456 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 475 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
457 "video/webm", avc1_codec(), kPrefixedClearKey)); 476 "video/webm", avc1_codec(), kPrefixedClearKey));
458 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 477 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
478 "video/webm", avc3_codec(), kPrefixedClearKey));
479 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
459 "video/webm", unknown_codec(), kPrefixedClearKey)); 480 "video/webm", unknown_codec(), kPrefixedClearKey));
460 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 481 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
461 "video/webm", mixed_codecs(), kPrefixedClearKey)); 482 "video/webm", mixed_codecs(), kPrefixedClearKey));
483 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
484 "video/webm", vp8_invalid_extension_codec(), kPrefixedClearKey));
462 485
463 // Valid audio types. 486 // Valid audio types.
464 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( 487 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
465 "audio/webm", no_codecs(), kPrefixedClearKey)); 488 "audio/webm", no_codecs(), kPrefixedClearKey));
466 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType( 489 EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
467 "audio/webm", vorbis_codec(), kPrefixedClearKey)); 490 "audio/webm", vorbis_codec(), kPrefixedClearKey));
468 491
469 // Non-audio codecs. 492 // Non-audio codecs.
470 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 493 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
471 "audio/webm", vp8_codec(), kPrefixedClearKey)); 494 "audio/webm", vp8_codec(), kPrefixedClearKey));
(...skipping 17 matching lines...) Expand all
489 // The parent should be supported but is not. See http://crbug.com/164303. 512 // The parent should be supported but is not. See http://crbug.com/164303.
490 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 513 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
491 "video/mp4", no_codecs(), kPrefixedClearKeyParent)); 514 "video/mp4", no_codecs(), kPrefixedClearKeyParent));
492 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType( 515 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
493 "video/mp4", avc1_codec(), kPrefixedClearKey)); 516 "video/mp4", avc1_codec(), kPrefixedClearKey));
494 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType( 517 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
495 "video/mp4", avc1_and_aac_codecs(), kPrefixedClearKey)); 518 "video/mp4", avc1_and_aac_codecs(), kPrefixedClearKey));
496 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType( 519 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
497 "video/mp4", avc3_codec(), kPrefixedClearKey)); 520 "video/mp4", avc3_codec(), kPrefixedClearKey));
498 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType( 521 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
522 "video/mp4", avc3_and_aac_codecs(), kPrefixedClearKey));
523 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
499 "video/mp4", aac_codec(), kPrefixedClearKey)); 524 "video/mp4", aac_codec(), kPrefixedClearKey));
500 525
501 // Extended codecs. 526 // Extended codecs.
502 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType( 527 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
503 "video/mp4", avc1_extended_codec(), kPrefixedClearKey)); 528 "video/mp4", avc1_extended_codec(), kPrefixedClearKey));
504 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType( 529 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
505 "video/mp4", avc3_extended_codec(), kPrefixedClearKey)); 530 "video/mp4", avc3_extended_codec(), kPrefixedClearKey));
506 531
507 // Invalid codec format, but canPlayType() strips away the period. 532 // Invalid codec format: profile parameter must be present after the period.
508 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType( 533 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
509 "video/mp4", avc1_dot_codec(), kPrefixedClearKey)); 534 "video/mp4", avc1_dot_codec(), kPrefixedClearKey));
510 535
511 // Non-MP4 codecs. 536 // Invalid or Non-MP4 codecs.
512 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 537 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
513 "video/mp4", avc2_codec(), kPrefixedClearKey)); 538 "video/mp4", avc2_codec(), kPrefixedClearKey));
514 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 539 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
540 "video/mp4", mp4a_invalid_no_extension(), kPrefixedClearKey));
541 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
515 "video/mp4", vp8_codec(), kPrefixedClearKey)); 542 "video/mp4", vp8_codec(), kPrefixedClearKey));
516 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 543 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
517 "video/mp4", unknown_codec(), kPrefixedClearKey)); 544 "video/mp4", unknown_codec(), kPrefixedClearKey));
518 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 545 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
519 "video/mp4", mixed_codecs(), kPrefixedClearKey)); 546 "video/mp4", mixed_codecs(), kPrefixedClearKey));
547 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
548 "video/mp4", vp8_invalid_extension_codec(), kPrefixedClearKey));
520 549
521 // Valid audio types. 550 // Valid audio types.
522 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType( 551 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
523 "audio/mp4", no_codecs(), kPrefixedClearKey)); 552 "audio/mp4", no_codecs(), kPrefixedClearKey));
524 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType( 553 EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
525 "audio/mp4", aac_codec(), kPrefixedClearKey)); 554 "audio/mp4", aac_codec(), kPrefixedClearKey));
526 555
527 // Non-audio codecs. 556 // Non-audio codecs.
528 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 557 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
529 "audio/mp4", avc1_codec(), kPrefixedClearKey)); 558 "audio/mp4", avc1_codec(), kPrefixedClearKey));
530 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 559 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
531 "audio/mp4", avc1_and_aac_codecs(), kPrefixedClearKey)); 560 "audio/mp4", avc1_and_aac_codecs(), kPrefixedClearKey));
532 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 561 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
533 "audio/mp4", avc3_codec(), kPrefixedClearKey)); 562 "audio/mp4", avc3_codec(), kPrefixedClearKey));
534 563
535 // Non-MP4 codec. 564 // Invalid or Non-MP4 codec.
536 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 565 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
537 "audio/mp4", vorbis_codec(), kPrefixedClearKey)); 566 "audio/mp4", vorbis_codec(), kPrefixedClearKey));
567 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
568 "audio/mp4", mp4a_invalid_no_extension(), kPrefixedClearKey));
538 } 569 }
539 570
540 // 571 //
541 // External Clear Key 572 // External Clear Key
542 // 573 //
543 574
544 // When defined(ENABLE_PEPPER_CDMS), this also tests the Pepper CDM check. 575 // When defined(ENABLE_PEPPER_CDMS), this also tests the Pepper CDM check.
545 IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedExternalClearKeyTest, 576 IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedExternalClearKeyTest,
546 ExternalClearKey_Basic) { 577 ExternalClearKey_Basic) {
547 EXPECT_ECK(IsConcreteSupportedKeySystem(kExternalClearKey)); 578 EXPECT_ECK(IsConcreteSupportedKeySystem(kExternalClearKey));
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 "video/webm", vp90_codec(), kExternalClearKey)); 665 "video/webm", vp90_codec(), kExternalClearKey));
635 EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType( 666 EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType(
636 "video/webm", vp9_and_vorbis_codecs(), kExternalClearKey)); 667 "video/webm", vp9_and_vorbis_codecs(), kExternalClearKey));
637 EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType( 668 EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType(
638 "video/webm", vorbis_codec(), kExternalClearKey)); 669 "video/webm", vorbis_codec(), kExternalClearKey));
639 670
640 // Non-Webm codecs. 671 // Non-Webm codecs.
641 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 672 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
642 "video/webm", avc1_codec(), kExternalClearKey)); 673 "video/webm", avc1_codec(), kExternalClearKey));
643 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 674 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
675 "video/webm", avc3_codec(), kExternalClearKey));
676 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
644 "video/webm", unknown_codec(), kExternalClearKey)); 677 "video/webm", unknown_codec(), kExternalClearKey));
645 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 678 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
646 "video/webm", mixed_codecs(), kExternalClearKey)); 679 "video/webm", mixed_codecs(), kExternalClearKey));
680 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
681 "video/webm", vp8_invalid_extension_codec(), kExternalClearKey));
647 682
648 // Valid audio types. 683 // Valid audio types.
649 EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType( 684 EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType(
650 "audio/webm", no_codecs(), kExternalClearKey)); 685 "audio/webm", no_codecs(), kExternalClearKey));
651 EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType( 686 EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType(
652 "audio/webm", vorbis_codec(), kExternalClearKey)); 687 "audio/webm", vorbis_codec(), kExternalClearKey));
653 688
654 // Non-audio codecs. 689 // Non-audio codecs.
655 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 690 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
656 "audio/webm", vp8_codec(), kExternalClearKey)); 691 "audio/webm", vp8_codec(), kExternalClearKey));
(...skipping 18 matching lines...) Expand all
675 // The parent should be supported but is not. See http://crbug.com/164303. 710 // The parent should be supported but is not. See http://crbug.com/164303.
676 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 711 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
677 "video/mp4", no_codecs(), "org.chromium")); 712 "video/mp4", no_codecs(), "org.chromium"));
678 EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType( 713 EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
679 "video/mp4", avc1_codec(), kExternalClearKey)); 714 "video/mp4", avc1_codec(), kExternalClearKey));
680 EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType( 715 EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
681 "video/mp4", avc1_and_aac_codecs(), kExternalClearKey)); 716 "video/mp4", avc1_and_aac_codecs(), kExternalClearKey));
682 EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType( 717 EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
683 "video/mp4", avc3_codec(), kExternalClearKey)); 718 "video/mp4", avc3_codec(), kExternalClearKey));
684 EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType( 719 EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
720 "video/mp4", avc3_and_aac_codecs(), kExternalClearKey));
721 EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
685 "video/mp4", aac_codec(), kExternalClearKey)); 722 "video/mp4", aac_codec(), kExternalClearKey));
686 723
687 // Extended codecs. 724 // Extended codecs.
688 EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType( 725 EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
689 "video/mp4", avc1_extended_codec(), kExternalClearKey)); 726 "video/mp4", avc1_extended_codec(), kExternalClearKey));
690 EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType( 727 EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
691 "video/mp4", avc3_extended_codec(), kExternalClearKey)); 728 "video/mp4", avc3_extended_codec(), kExternalClearKey));
692 729
693 // Invalid codec format, but canPlayType() strips away the period. 730 // Invalid codec format: profile parameter must be present after the period.
694 EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType( 731 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
695 "video/mp4", avc1_dot_codec(), kExternalClearKey)); 732 "video/mp4", avc1_dot_codec(), kExternalClearKey));
696 733
697 // Non-MP4 codecs. 734 // Invalid or Non-MP4 codecs.
698 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 735 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
699 "video/mp4", avc2_codec(), kExternalClearKey)); 736 "video/mp4", avc2_codec(), kExternalClearKey));
700 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 737 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
738 "video/mp4", mp4a_invalid_no_extension(), kExternalClearKey));
739 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
701 "video/mp4", vp8_codec(), kExternalClearKey)); 740 "video/mp4", vp8_codec(), kExternalClearKey));
702 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 741 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
703 "video/mp4", unknown_codec(), kExternalClearKey)); 742 "video/mp4", unknown_codec(), kExternalClearKey));
704 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 743 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
705 "video/mp4", mixed_codecs(), kExternalClearKey)); 744 "video/mp4", mixed_codecs(), kExternalClearKey));
745 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
746 "video/mp4", vp8_invalid_extension_codec(), kExternalClearKey));
706 747
707 // Valid audio types. 748 // Valid audio types.
708 EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType( 749 EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
709 "audio/mp4", no_codecs(), kExternalClearKey)); 750 "audio/mp4", no_codecs(), kExternalClearKey));
710 EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType( 751 EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
711 "audio/mp4", aac_codec(), kExternalClearKey)); 752 "audio/mp4", aac_codec(), kExternalClearKey));
712 753
713 // Non-audio codecs. 754 // Non-audio codecs.
714 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 755 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
715 "audio/mp4", avc1_codec(), kExternalClearKey)); 756 "audio/mp4", avc1_codec(), kExternalClearKey));
716 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 757 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
717 "audio/mp4", avc1_and_aac_codecs(), kExternalClearKey)); 758 "audio/mp4", avc1_and_aac_codecs(), kExternalClearKey));
718 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 759 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
719 "audio/mp4", avc3_codec(), kExternalClearKey)); 760 "audio/mp4", avc3_codec(), kExternalClearKey));
761 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
762 "audio/mp4", avc3_and_aac_codecs(), kExternalClearKey));
720 763
721 // Non-MP4 codec. 764 // Invalid or Non-MP4 codec.
722 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 765 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
723 "audio/mp4", vorbis_codec(), kExternalClearKey)); 766 "audio/mp4", vorbis_codec(), kExternalClearKey));
767 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
768 "audio/mp4", mp4a_invalid_no_extension(), kExternalClearKey));
724 } 769 }
725 770
726 // 771 //
727 // Widevine 772 // Widevine
728 // 773 //
729 774
730 IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedWidevineTest, 775 IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedWidevineTest,
731 Widevine_Basic) { 776 Widevine_Basic) {
732 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) 777 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
733 EXPECT_TRUE(IsConcreteSupportedKeySystem(kWidevineAlpha)); 778 EXPECT_TRUE(IsConcreteSupportedKeySystem(kWidevineAlpha));
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 "video/webm", vp80_codec(), kWidevine)); 869 "video/webm", vp80_codec(), kWidevine));
825 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType( 870 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
826 "video/webm", vp8_and_vorbis_codecs(), kWidevine)); 871 "video/webm", vp8_and_vorbis_codecs(), kWidevine));
827 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType( 872 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
828 "video/webm", vorbis_codec(), kWidevine)); 873 "video/webm", vorbis_codec(), kWidevine));
829 874
830 // Non-Webm codecs. 875 // Non-Webm codecs.
831 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 876 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
832 "video/webm", avc1_codec(), kWidevineAlpha)); 877 "video/webm", avc1_codec(), kWidevineAlpha));
833 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 878 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
879 "video/webm", avc3_codec(), kWidevineAlpha));
880 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
834 "video/webm", unknown_codec(), kWidevineAlpha)); 881 "video/webm", unknown_codec(), kWidevineAlpha));
835 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 882 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
836 "video/webm", mixed_codecs(), kWidevineAlpha)); 883 "video/webm", mixed_codecs(), kWidevineAlpha));
884 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
885 "video/webm", vp8_invalid_extension_codec(), kWidevineAlpha));
837 886
838 // Valid audio types. 887 // Valid audio types.
839 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType( 888 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
840 "audio/webm", no_codecs(), kWidevineAlpha)); 889 "audio/webm", no_codecs(), kWidevineAlpha));
841 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType( 890 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
842 "audio/webm", vorbis_codec(), kWidevineAlpha)); 891 "audio/webm", vorbis_codec(), kWidevineAlpha));
843 892
844 // Valid audio types - parent key system. 893 // Valid audio types - parent key system.
845 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType( 894 EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
846 "audio/webm", no_codecs(), kWidevine)); 895 "audio/webm", no_codecs(), kWidevine));
(...skipping 16 matching lines...) Expand all
863 // Valid video types. 912 // Valid video types.
864 EXPECT_WVMP4(IsSupportedKeySystemWithMediaMimeType( 913 EXPECT_WVMP4(IsSupportedKeySystemWithMediaMimeType(
865 "video/mp4", no_codecs(), kWidevineAlpha)); 914 "video/mp4", no_codecs(), kWidevineAlpha));
866 EXPECT_WVAVC1(IsSupportedKeySystemWithMediaMimeType( 915 EXPECT_WVAVC1(IsSupportedKeySystemWithMediaMimeType(
867 "video/mp4", avc1_codec(), kWidevineAlpha)); 916 "video/mp4", avc1_codec(), kWidevineAlpha));
868 EXPECT_WVAVC1AAC(IsSupportedKeySystemWithMediaMimeType( 917 EXPECT_WVAVC1AAC(IsSupportedKeySystemWithMediaMimeType(
869 "video/mp4", avc1_and_aac_codecs(), kWidevineAlpha)); 918 "video/mp4", avc1_and_aac_codecs(), kWidevineAlpha));
870 EXPECT_WVAVC1(IsSupportedKeySystemWithMediaMimeType( 919 EXPECT_WVAVC1(IsSupportedKeySystemWithMediaMimeType(
871 "video/mp4", avc3_codec(), kWidevineAlpha)); 920 "video/mp4", avc3_codec(), kWidevineAlpha));
872 EXPECT_WVAVC1AAC(IsSupportedKeySystemWithMediaMimeType( 921 EXPECT_WVAVC1AAC(IsSupportedKeySystemWithMediaMimeType(
922 "video/mp4", avc3_and_aac_codecs(), kWidevineAlpha));
923 EXPECT_WVAVC1AAC(IsSupportedKeySystemWithMediaMimeType(
873 "video/mp4", aac_codec(), kWidevineAlpha)); 924 "video/mp4", aac_codec(), kWidevineAlpha));
874 925
875 // Valid video types - parent key system. 926 // Valid video types - parent key system.
876 EXPECT_WVMP4(IsSupportedKeySystemWithMediaMimeType( 927 EXPECT_WVMP4(IsSupportedKeySystemWithMediaMimeType(
877 "video/mp4", no_codecs(), kWidevine)); 928 "video/mp4", no_codecs(), kWidevine));
878 EXPECT_WVAVC1(IsSupportedKeySystemWithMediaMimeType( 929 EXPECT_WVAVC1(IsSupportedKeySystemWithMediaMimeType(
879 "video/mp4", avc1_codec(), kWidevine)); 930 "video/mp4", avc1_codec(), kWidevine));
880 EXPECT_WVAVC1AAC(IsSupportedKeySystemWithMediaMimeType( 931 EXPECT_WVAVC1AAC(IsSupportedKeySystemWithMediaMimeType(
881 "video/mp4", avc1_and_aac_codecs(), kWidevine)); 932 "video/mp4", avc1_and_aac_codecs(), kWidevine));
933 EXPECT_WVAVC1(IsSupportedKeySystemWithMediaMimeType(
934 "video/mp4", avc3_codec(), kWidevine));
935 EXPECT_WVAVC1AAC(IsSupportedKeySystemWithMediaMimeType(
936 "video/mp4", avc3_and_aac_codecs(), kWidevine));
882 EXPECT_WVAVC1AAC(IsSupportedKeySystemWithMediaMimeType( 937 EXPECT_WVAVC1AAC(IsSupportedKeySystemWithMediaMimeType(
883 "video/mp4", aac_codec(), kWidevine)); 938 "video/mp4", aac_codec(), kWidevine));
884 939
885 // Extended codecs. 940 // Extended codecs.
886 EXPECT_WVAVC1(IsSupportedKeySystemWithMediaMimeType( 941 EXPECT_WVAVC1(IsSupportedKeySystemWithMediaMimeType(
887 "video/mp4", avc1_extended_codec(), kWidevineAlpha)); 942 "video/mp4", avc1_extended_codec(), kWidevineAlpha));
888 EXPECT_WVAVC1(IsSupportedKeySystemWithMediaMimeType( 943 EXPECT_WVAVC1(IsSupportedKeySystemWithMediaMimeType(
889 "video/mp4", avc3_extended_codec(), kWidevineAlpha)); 944 "video/mp4", avc3_extended_codec(), kWidevineAlpha));
890 945
891 // Invalid codec format, but canPlayType() strips away the period. 946 // Invalid codec format: profile paramter must be present after the period.
892 EXPECT_WVAVC1(IsSupportedKeySystemWithMediaMimeType( 947 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
893 "video/mp4", avc1_dot_codec(), kWidevineAlpha)); 948 "video/mp4", avc1_dot_codec(), kWidevineAlpha));
894 949
895 // Non-MP4 codecs. 950 // Invalid or Non-MP4 codecs.
896 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 951 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
897 "video/mp4", avc2_codec(), kWidevineAlpha)); 952 "video/mp4", avc2_codec(), kWidevineAlpha));
898 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 953 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
954 "video/mp4", mp4a_invalid_no_extension(), kWidevineAlpha));
955 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
899 "video/mp4", vp8_codec(), kWidevineAlpha)); 956 "video/mp4", vp8_codec(), kWidevineAlpha));
900 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 957 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
901 "video/mp4", unknown_codec(), kWidevineAlpha)); 958 "video/mp4", unknown_codec(), kWidevineAlpha));
902 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 959 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
903 "video/mp4", mixed_codecs(), kWidevineAlpha)); 960 "video/mp4", mixed_codecs(), kWidevineAlpha));
961 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
962 "video/mp4", vp8_invalid_extension_codec(), kWidevineAlpha));
904 963
905 // Valid audio types. 964 // Valid audio types.
906 EXPECT_WVMP4(IsSupportedKeySystemWithMediaMimeType( 965 EXPECT_WVMP4(IsSupportedKeySystemWithMediaMimeType(
907 "audio/mp4", no_codecs(), kWidevineAlpha)); 966 "audio/mp4", no_codecs(), kWidevineAlpha));
908 EXPECT_WVAAC(IsSupportedKeySystemWithMediaMimeType( 967 EXPECT_WVAAC(IsSupportedKeySystemWithMediaMimeType(
909 "audio/mp4", aac_codec(), kWidevineAlpha)); 968 "audio/mp4", aac_codec(), kWidevineAlpha));
910 969
911 // Valid audio types - parent key system. 970 // Valid audio types - parent key system.
912 EXPECT_WVMP4(IsSupportedKeySystemWithMediaMimeType( 971 EXPECT_WVMP4(IsSupportedKeySystemWithMediaMimeType(
913 "audio/mp4", no_codecs(), kWidevine)); 972 "audio/mp4", no_codecs(), kWidevine));
914 EXPECT_WVAAC(IsSupportedKeySystemWithMediaMimeType( 973 EXPECT_WVAAC(IsSupportedKeySystemWithMediaMimeType(
915 "audio/mp4", aac_codec(), kWidevine)); 974 "audio/mp4", aac_codec(), kWidevine));
916 975
917 // Non-audio codecs. 976 // Non-audio codecs.
918 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 977 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
919 "audio/mp4", avc1_codec(), kWidevineAlpha)); 978 "audio/mp4", avc1_codec(), kWidevineAlpha));
920 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 979 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
921 "audio/mp4", avc1_and_aac_codecs(), kWidevineAlpha)); 980 "audio/mp4", avc1_and_aac_codecs(), kWidevineAlpha));
922 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 981 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
923 "audio/mp4", avc3_codec(), kWidevineAlpha)); 982 "audio/mp4", avc3_codec(), kWidevineAlpha));
983 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
984 "audio/mp4", avc3_and_aac_codecs(), kWidevineAlpha));
924 985
925 // Non-MP4 codec. 986 // Invalid or Non-MP4 codec.
926 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 987 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
927 "audio/mp4", vorbis_codec(), kWidevineAlpha)); 988 "audio/mp4", vorbis_codec(), kWidevineAlpha));
989 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
990 "audio/mp4", mp4a_invalid_no_extension(), kWidevineAlpha));
928 } 991 }
929 992
930 IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedWidevineTest, 993 IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedWidevineTest,
931 Widevine_HR_Basic) { 994 Widevine_HR_Basic) {
932 // HR support cannot be detected in tests, so this is expected to fail 995 // HR support cannot be detected in tests, so this is expected to fail
933 // everywhere. 996 // everywhere.
934 EXPECT_FALSE(IsConcreteSupportedKeySystem(kWidevineAlphaHr)); 997 EXPECT_FALSE(IsConcreteSupportedKeySystem(kWidevineAlphaHr));
935 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 998 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
936 "video/webm", no_codecs(), kWidevineAlphaHr)); 999 "video/webm", no_codecs(), kWidevineAlphaHr));
937 } 1000 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 EncryptedMediaIsTypeSupportedWidevineCDMRegisteredWithWrongPathTest, 1066 EncryptedMediaIsTypeSupportedWidevineCDMRegisteredWithWrongPathTest,
1004 PepperCDMsRegisteredButAdapterNotPresent) { 1067 PepperCDMsRegisteredButAdapterNotPresent) {
1005 EXPECT_FALSE(IsConcreteSupportedKeySystem(kWidevineAlpha)); 1068 EXPECT_FALSE(IsConcreteSupportedKeySystem(kWidevineAlpha));
1006 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( 1069 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
1007 "video/webm", no_codecs(), kWidevineAlpha)); 1070 "video/webm", no_codecs(), kWidevineAlpha));
1008 } 1071 }
1009 #endif // !defined(WIDEVINE_CDM_AVAILABLE) || defined(WIDEVINE_CDM_IS_COMPONENT ) 1072 #endif // !defined(WIDEVINE_CDM_AVAILABLE) || defined(WIDEVINE_CDM_IS_COMPONENT )
1010 #endif // defined(ENABLE_PEPPER_CDMS) 1073 #endif // defined(ENABLE_PEPPER_CDMS)
1011 1074
1012 } // namespace chrome 1075 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | content/browser/media/media_canplaytype_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698