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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
10 #include "chrome/browser/media/media_browsertest.h" | 10 #include "chrome/browser/media/media_browsertest.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 // Whether to use prefixed or unprefixed EME. | 79 // Whether to use prefixed or unprefixed EME. |
80 enum EmeVersion { | 80 enum EmeVersion { |
81 PREFIXED, | 81 PREFIXED, |
82 UNPREFIXED | 82 UNPREFIXED |
83 }; | 83 }; |
84 | 84 |
85 // MSE is available on all desktop platforms and on Android 4.1 and later. | 85 // MSE is available on all desktop platforms and on Android 4.1 and later. |
86 static bool IsMSESupported() { | 86 static bool IsMSESupported() { |
87 #if defined(OS_ANDROID) | 87 #if defined(OS_ANDROID) |
88 if (base::android::BuildInfo::GetInstance()->sdk_int() < 16) { | 88 if (base::android::BuildInfo::GetInstance()->sdk_int() < 16) { |
89 VLOG(0) << "MSE is only supported in Android 4.1 and later."; | 89 DVLOG(0) << "MSE is only supported in Android 4.1 and later."; |
90 return false; | 90 return false; |
91 } | 91 } |
92 #endif // defined(OS_ANDROID) | 92 #endif // defined(OS_ANDROID) |
93 return true; | 93 return true; |
94 } | 94 } |
95 | 95 |
96 static bool IsParentKeySystemOf(const std::string& parent_key_system, | 96 static bool IsParentKeySystemOf(const std::string& parent_key_system, |
97 const std::string& key_system) { | 97 const std::string& key_system) { |
98 std::string prefix = parent_key_system + '.'; | 98 std::string prefix = parent_key_system + '.'; |
99 return key_system.substr(0, prefix.size()) == prefix; | 99 return key_system.substr(0, prefix.size()) == prefix; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 void RunEncryptedMediaTest(const std::string& html_page, | 136 void RunEncryptedMediaTest(const std::string& html_page, |
137 const std::string& media_file, | 137 const std::string& media_file, |
138 const std::string& media_type, | 138 const std::string& media_type, |
139 const std::string& key_system, | 139 const std::string& key_system, |
140 SrcType src_type, | 140 SrcType src_type, |
141 EmeVersion eme_version, | 141 EmeVersion eme_version, |
142 const std::string& session_to_load, | 142 const std::string& session_to_load, |
143 bool force_invalid_response, | 143 bool force_invalid_response, |
144 const std::string& expected_title) { | 144 const std::string& expected_title) { |
145 if (src_type == MSE && !IsMSESupported()) { | 145 if (src_type == MSE && !IsMSESupported()) { |
146 VLOG(0) << "Skipping test - MSE not supported."; | 146 DVLOG(0) << "Skipping test - MSE not supported."; |
147 return; | 147 return; |
148 } | 148 } |
149 base::StringPairs query_params; | 149 base::StringPairs query_params; |
150 query_params.push_back(std::make_pair("mediaFile", media_file)); | 150 query_params.push_back(std::make_pair("mediaFile", media_file)); |
151 query_params.push_back(std::make_pair("mediaType", media_type)); | 151 query_params.push_back(std::make_pair("mediaType", media_type)); |
152 query_params.push_back(std::make_pair("keySystem", key_system)); | 152 query_params.push_back(std::make_pair("keySystem", key_system)); |
153 if (src_type == MSE) | 153 if (src_type == MSE) |
154 query_params.push_back(std::make_pair("useMSE", "1")); | 154 query_params.push_back(std::make_pair("useMSE", "1")); |
155 if (eme_version == PREFIXED) | 155 if (eme_version == PREFIXED) |
156 query_params.push_back(std::make_pair("usePrefixedEME", "1")); | 156 query_params.push_back(std::make_pair("usePrefixedEME", "1")); |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VP9Video_WebM) { | 549 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VP9Video_WebM) { |
550 TestSimplePlayback("bear-320x240-v-vp9_enc-v.webm", kWebMVP9VideoOnly); | 550 TestSimplePlayback("bear-320x240-v-vp9_enc-v.webm", kWebMVP9VideoOnly); |
551 } | 551 } |
552 | 552 |
553 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, InvalidResponseKeyError) { | 553 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, InvalidResponseKeyError) { |
554 RunInvalidResponseTest(); | 554 RunInvalidResponseTest(); |
555 } | 555 } |
556 | 556 |
557 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, ConfigChangeVideo) { | 557 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, ConfigChangeVideo) { |
558 if (CurrentSourceType() != MSE || !IsMSESupported()) { | 558 if (CurrentSourceType() != MSE || !IsMSESupported()) { |
559 VLOG(0) << "Skipping test - ConfigChange test requires MSE."; | 559 DVLOG(0) << "Skipping test - ConfigChange test requires MSE."; |
560 return; | 560 return; |
561 } | 561 } |
562 if (!IsPlayBackPossible(CurrentKeySystem())) { | 562 if (!IsPlayBackPossible(CurrentKeySystem())) { |
563 VLOG(0) << "Skipping test - ConfigChange test requires video playback."; | 563 DVLOG(0) << "Skipping test - ConfigChange test requires video playback."; |
564 return; | 564 return; |
565 } | 565 } |
566 TestConfigChange(); | 566 TestConfigChange(); |
567 } | 567 } |
568 | 568 |
569 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, FrameSizeChangeVideo) { | 569 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, FrameSizeChangeVideo) { |
570 // Times out on Windows XP. http://crbug.com/171937 | 570 // Times out on Windows XP. http://crbug.com/171937 |
571 #if defined(OS_WIN) | 571 #if defined(OS_WIN) |
572 if (base::win::GetVersion() < base::win::VERSION_VISTA) | 572 if (base::win::GetVersion() < base::win::VERSION_VISTA) |
573 return; | 573 return; |
574 #endif | 574 #endif |
575 if (!IsPlayBackPossible(CurrentKeySystem())) { | 575 if (!IsPlayBackPossible(CurrentKeySystem())) { |
576 VLOG(0) << "Skipping test - FrameSizeChange test requires video playback."; | 576 DVLOG(0) << "Skipping test - FrameSizeChange test requires video playback."; |
577 return; | 577 return; |
578 } | 578 } |
579 TestFrameSizeChange(); | 579 TestFrameSizeChange(); |
580 } | 580 } |
581 | 581 |
582 #if defined(USE_PROPRIETARY_CODECS) | 582 #if defined(USE_PROPRIETARY_CODECS) |
583 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoOnly_MP4) { | 583 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoOnly_MP4) { |
584 // MP4 without MSE is not support yet, http://crbug.com/170793. | 584 // MP4 without MSE is not support yet, http://crbug.com/170793. |
585 if (CurrentSourceType() != MSE) { | 585 if (CurrentSourceType() != MSE) { |
586 VLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; | 586 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; |
587 return; | 587 return; |
588 } | 588 } |
589 TestSimplePlayback("bear-640x360-v_frag-cenc.mp4", kMP4VideoOnly); | 589 TestSimplePlayback("bear-640x360-v_frag-cenc.mp4", kMP4VideoOnly); |
590 } | 590 } |
591 | 591 |
592 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_MP4) { | 592 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_MP4) { |
593 // MP4 without MSE is not support yet, http://crbug.com/170793. | 593 // MP4 without MSE is not support yet, http://crbug.com/170793. |
594 if (CurrentSourceType() != MSE) { | 594 if (CurrentSourceType() != MSE) { |
595 VLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; | 595 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; |
596 return; | 596 return; |
597 } | 597 } |
598 TestSimplePlayback("bear-640x360-a_frag-cenc.mp4", kMP4AudioOnly); | 598 TestSimplePlayback("bear-640x360-a_frag-cenc.mp4", kMP4AudioOnly); |
599 } | 599 } |
600 #endif // defined(USE_PROPRIETARY_CODECS) | 600 #endif // defined(USE_PROPRIETARY_CODECS) |
601 | 601 |
602 #if defined(WIDEVINE_CDM_AVAILABLE) | 602 #if defined(WIDEVINE_CDM_AVAILABLE) |
603 // The parent key system cannot be used in generateKeyRequest. | 603 // The parent key system cannot be used in generateKeyRequest. |
604 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException_Prefixed) { | 604 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException_Prefixed) { |
605 RunEncryptedMediaTest(kDefaultEmePlayer, | 605 RunEncryptedMediaTest(kDefaultEmePlayer, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 "bear-320x240-v_enc-v.webm", | 697 "bear-320x240-v_enc-v.webm", |
698 kWebMVideoOnly, | 698 kWebMVideoOnly, |
699 kExternalClearKeyKeySystem, | 699 kExternalClearKeyKeySystem, |
700 SRC, | 700 SRC, |
701 UNPREFIXED, | 701 UNPREFIXED, |
702 kUnknownSession, | 702 kUnknownSession, |
703 false, | 703 false, |
704 kEmeKeyError); | 704 kEmeKeyError); |
705 } | 705 } |
706 #endif // defined(ENABLE_PEPPER_CDMS) | 706 #endif // defined(ENABLE_PEPPER_CDMS) |
OLD | NEW |