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/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "base/win/windows_version.h" | 8 #include "base/win/windows_version.h" |
9 #include "chrome/browser/media/media_browsertest.h" | 9 #include "chrome/browser/media/media_browsertest.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 11 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
13 #include "content/public/test/browser_test_utils.h" | 13 #include "content/public/test/browser_test_utils.h" |
14 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | |
xhwang
2013/10/14 20:12:47
This violates DEPS rules [1]. But since we set Web
qinmin
2013/10/14 20:59:45
Maybe add a function IsMSESupported() somewhere in
ddorwin
2013/10/14 21:30:34
I would rather run the tests unless we explicitly
xhwang
2013/10/16 07:58:40
Instead of checking android version, we can just c
ddorwin
2013/10/16 20:17:17
If the MediaCodecBridge availability code breaks,
| |
14 | 15 |
15 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | 16 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
16 | 17 |
17 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(OS_LINUX) | 18 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(OS_LINUX) |
18 #include <gnu/libc-version.h> | 19 #include <gnu/libc-version.h> |
19 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(OS_LINUX) | 20 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(OS_LINUX) |
20 | 21 |
21 #if defined(ENABLE_PEPPER_CDMS) | 22 #if defined(ENABLE_PEPPER_CDMS) |
22 // Platform-specific filename relative to the chrome executable. | 23 // Platform-specific filename relative to the chrome executable. |
23 const char kClearKeyCdmAdapterFileName[] = | 24 const char kClearKeyCdmAdapterFileName[] = |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 LOG(INFO) << "FrameSizeChange test cannot run with Widevine."; | 90 LOG(INFO) << "FrameSizeChange test cannot run with Widevine."; |
90 return; | 91 return; |
91 } | 92 } |
92 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 93 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
93 RunEncryptedMediaTest("encrypted_frame_size_change.html", | 94 RunEncryptedMediaTest("encrypted_frame_size_change.html", |
94 "frame_size_change-av-enc-v.webm", kWebMAudioVideo, | 95 "frame_size_change-av-enc-v.webm", kWebMAudioVideo, |
95 CurrentKeySystem(), CurrentSourceType(), kEnded); | 96 CurrentKeySystem(), CurrentSourceType(), kEnded); |
96 } | 97 } |
97 | 98 |
98 void TestConfigChange() { | 99 void TestConfigChange() { |
100 if (CurrentSourceType() != MSE) { | |
101 LOG(INFO) << "Skipping test - config change only applies to MSE."; | |
102 return; | |
103 } | |
104 | |
105 // TODO(xhwang): Update this to check for unprefixed MSE API when | |
ddorwin
2013/10/14 21:30:34
A helper function also allows this to be encapsula
xhwang
2013/10/16 07:58:40
Done.
| |
106 // http://crbug.com/307107 is fixed. | |
107 if (!WebKit::WebRuntimeFeatures::isWebKitMediaSourceEnabled()) { | |
108 LOG(INFO) << "Could not run test - prefixed MSE not supported."; | |
109 return; | |
110 } | |
111 | |
99 #if defined(WIDEVINE_CDM_AVAILABLE) | 112 #if defined(WIDEVINE_CDM_AVAILABLE) |
100 if (IsWidevine(CurrentKeySystem())) { | 113 if (IsWidevine(CurrentKeySystem())) { |
101 LOG(INFO) << "ConfigChange test cannot run with Widevine."; | 114 LOG(INFO) << "ConfigChange test cannot run with Widevine."; |
102 return; | 115 return; |
103 } | 116 } |
104 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 117 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
118 | |
105 std::vector<StringPair> query_params; | 119 std::vector<StringPair> query_params; |
106 query_params.push_back(std::make_pair("keysystem", CurrentKeySystem())); | 120 query_params.push_back(std::make_pair("keysystem", CurrentKeySystem())); |
107 query_params.push_back(std::make_pair("runencrypted", "1")); | 121 query_params.push_back(std::make_pair("runencrypted", "1")); |
108 RunMediaTestPage("mse_config_change.html", &query_params, kEnded, true); | 122 RunMediaTestPage("mse_config_change.html", &query_params, kEnded, true); |
109 } | 123 } |
110 | 124 |
111 void RunEncryptedMediaTest(const char* html_page, | 125 void RunEncryptedMediaTest(const char* html_page, |
112 const char* media_file, | 126 const char* media_file, |
113 const char* media_type, | 127 const char* media_type, |
114 const char* key_system, | 128 const char* key_system, |
115 SrcType src_type, | 129 SrcType src_type, |
116 const char* expectation) { | 130 const char* expectation) { |
131 // TODO(xhwang): Update this to check for unprefixed MSE API when | |
132 // http://crbug.com/307107 is fixed. | |
133 if (src_type == MSE && | |
ddorwin
2013/10/14 21:30:34
Where do we prevent SRC tests from running on Andr
xhwang
2013/10/16 07:58:40
I only fixed content_browsertest and haven't fixed
ddorwin
2013/10/16 20:17:17
Should we drop the MSE check then? It seems EME wo
xhwang
2013/10/16 21:41:17
Done. I also fixed browser_tests to support Androi
| |
134 !WebKit::WebRuntimeFeatures::isWebKitMediaSourceEnabled()) { | |
135 LOG(INFO) << "Could not run test - prefixed MSE not supported."; | |
136 return; | |
137 } | |
138 | |
117 std::vector<StringPair> query_params; | 139 std::vector<StringPair> query_params; |
118 query_params.push_back(std::make_pair("mediafile", media_file)); | 140 query_params.push_back(std::make_pair("mediafile", media_file)); |
119 query_params.push_back(std::make_pair("mediatype", media_type)); | 141 query_params.push_back(std::make_pair("mediatype", media_type)); |
120 query_params.push_back(std::make_pair("keysystem", key_system)); | 142 query_params.push_back(std::make_pair("keysystem", key_system)); |
121 if (src_type == MSE) | 143 if (src_type == MSE) |
122 query_params.push_back(std::make_pair("usemse", "1")); | 144 query_params.push_back(std::make_pair("usemse", "1")); |
123 RunMediaTestPage(html_page, &query_params, expectation, true); | 145 RunMediaTestPage(html_page, &query_params, expectation, true); |
124 } | 146 } |
125 | 147 |
126 void RunSimpleEncryptedMediaTest(const char* media_file, | 148 void RunSimpleEncryptedMediaTest(const char* media_file, |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
299 } | 321 } |
300 #endif // defined(USE_PROPRIETARY_CODECS) | 322 #endif // defined(USE_PROPRIETARY_CODECS) |
301 | 323 |
302 #if defined(WIDEVINE_CDM_AVAILABLE) | 324 #if defined(WIDEVINE_CDM_AVAILABLE) |
303 // The parent key system cannot be used in generateKeyRequest. | 325 // The parent key system cannot be used in generateKeyRequest. |
304 IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, WVParentThrowsException) { | 326 IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, WVParentThrowsException) { |
305 RunEncryptedMediaTest("encrypted_media_player.html", "bear-a-enc_a.webm", | 327 RunEncryptedMediaTest("encrypted_media_player.html", "bear-a-enc_a.webm", |
306 kWebMAudioOnly, "com.widevine", SRC, kEmeGkrException); | 328 kWebMAudioOnly, "com.widevine", SRC, kEmeGkrException); |
307 } | 329 } |
308 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 330 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
OLD | NEW |