OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "base/win/windows_version.h" | 7 #include "base/win/windows_version.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "content/browser/media/media_browsertest.h" | 9 #include "content/browser/media/media_browsertest.h" |
10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
11 #include "content/public/test/browser_test_utils.h" | 11 #include "content/public/test/browser_test_utils.h" |
12 #include "content/shell/browser/shell.h" | 12 #include "content/shell/browser/shell.h" |
13 #if defined(OS_ANDROID) | 13 #if defined(OS_ANDROID) |
14 #include "base/android/build_info.h" | 14 #include "base/android/build_info.h" |
15 #include "media/base/media.h" | 15 #include "media/base/media.h" |
16 #endif | 16 #endif |
17 | 17 |
| 18 #if defined(ENABLE_MOJO_RENDERER) |
| 19 // TODO(xhwang): Enable tests by running AesDecryptor in remote mojo CDM and |
| 20 // using ExternalClearKey instead of ClearKey: crbug.com/641559 |
| 21 #define DISABLE_ENCRYPTED_MEDIA_PLAYBACK_TESTS 1 |
| 22 #endif |
| 23 |
18 // Available key systems. | 24 // Available key systems. |
19 const char kClearKeyKeySystem[] = "org.w3.clearkey"; | 25 const char kClearKeyKeySystem[] = "org.w3.clearkey"; |
20 | 26 |
21 // Supported media types. | 27 // Supported media types. |
22 const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\""; | 28 const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\""; |
| 29 #if !defined(DISABLE_ENCRYPTED_MEDIA_PLAYBACK_TESTS) |
23 const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\""; | 30 const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\""; |
| 31 #endif |
24 const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\""; | 32 const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\""; |
25 | 33 |
26 // EME-specific test results and errors. | 34 // EME-specific test results and errors. |
27 const char kEmeKeyError[] = "KEYERROR"; | 35 const char kEmeKeyError[] = "KEYERROR"; |
28 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR"; | 36 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR"; |
29 | 37 |
30 const char kDefaultEmePlayer[] = "eme_player.html"; | 38 const char kDefaultEmePlayer[] = "eme_player.html"; |
31 | 39 |
32 // The type of video src used to load media. | 40 // The type of video src used to load media. |
33 enum SrcType { | 41 enum SrcType { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 144 |
137 using ::testing::Combine; | 145 using ::testing::Combine; |
138 using ::testing::Values; | 146 using ::testing::Values; |
139 | 147 |
140 INSTANTIATE_TEST_CASE_P(SRC_ClearKey, EncryptedMediaTest, | 148 INSTANTIATE_TEST_CASE_P(SRC_ClearKey, EncryptedMediaTest, |
141 Combine(Values(kClearKeyKeySystem), Values(SRC))); | 149 Combine(Values(kClearKeyKeySystem), Values(SRC))); |
142 | 150 |
143 INSTANTIATE_TEST_CASE_P(MSE_ClearKey, EncryptedMediaTest, | 151 INSTANTIATE_TEST_CASE_P(MSE_ClearKey, EncryptedMediaTest, |
144 Combine(Values(kClearKeyKeySystem), Values(MSE))); | 152 Combine(Values(kClearKeyKeySystem), Values(MSE))); |
145 | 153 |
| 154 #if !defined(DISABLE_ENCRYPTED_MEDIA_PLAYBACK_TESTS) |
146 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) { | 155 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) { |
147 TestSimplePlayback("bear-a_enc-a.webm", kWebMAudioOnly); | 156 TestSimplePlayback("bear-a_enc-a.webm", kWebMAudioOnly); |
148 } | 157 } |
149 | 158 |
150 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioClearVideo_WebM) { | 159 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioClearVideo_WebM) { |
151 TestSimplePlayback("bear-320x240-av_enc-a.webm", kWebMAudioVideo); | 160 TestSimplePlayback("bear-320x240-av_enc-a.webm", kWebMAudioVideo); |
152 } | 161 } |
153 | 162 |
154 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoAudio_WebM) { | 163 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoAudio_WebM) { |
155 TestSimplePlayback("bear-320x240-av_enc-av.webm", kWebMAudioVideo); | 164 TestSimplePlayback("bear-320x240-av_enc-av.webm", kWebMAudioVideo); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 TestSimplePlayback("bear-320x240-opus-av_enc-v.webm", kWebMAudioVideo); | 196 TestSimplePlayback("bear-320x240-opus-av_enc-v.webm", kWebMAudioVideo); |
188 } | 197 } |
189 | 198 |
190 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, ConfigChangeVideo) { | 199 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, ConfigChangeVideo) { |
191 TestConfigChange(); | 200 TestConfigChange(); |
192 } | 201 } |
193 | 202 |
194 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, FrameSizeChangeVideo) { | 203 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, FrameSizeChangeVideo) { |
195 TestFrameSizeChange(); | 204 TestFrameSizeChange(); |
196 } | 205 } |
| 206 #endif // !defined(DISABLE_ENCRYPTED_MEDIA_PLAYBACK_TESTS) |
197 | 207 |
198 IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, UnknownKeySystemThrowsException) { | 208 IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, UnknownKeySystemThrowsException) { |
199 RunEncryptedMediaTest(kDefaultEmePlayer, | 209 RunEncryptedMediaTest(kDefaultEmePlayer, |
200 "bear-a_enc-a.webm", | 210 "bear-a_enc-a.webm", |
201 kWebMAudioOnly, | 211 kWebMAudioOnly, |
202 "com.example.foo", | 212 "com.example.foo", |
203 MSE, | 213 MSE, |
204 kEmeNotSupportedError); | 214 kEmeNotSupportedError); |
205 } | 215 } |
206 | 216 |
207 } // namespace content | 217 } // namespace content |
OLD | NEW |