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/string_number_conversions.h" | 6 #include "base/strings/string_number_conversions.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "base/test/scoped_feature_list.h" | |
9 #include "build/build_config.h" | 8 #include "build/build_config.h" |
10 #include "content/browser/media/media_browsertest.h" | 9 #include "content/browser/media/media_browsertest.h" |
11 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
12 #include "content/public/test/browser_test_utils.h" | 11 #include "content/public/test/browser_test_utils.h" |
13 #include "content/shell/browser/shell.h" | 12 #include "content/shell/browser/shell.h" |
14 #include "media/base/media.h" | 13 #include "media/base/media.h" |
15 #include "media/base/media_switches.h" | 14 #include "media/base/media_switches.h" |
16 #include "media/mojo/features.h" | 15 #include "media/mojo/features.h" |
17 #include "ppapi/features/features.h" | |
18 | 16 |
19 #if defined(OS_ANDROID) | 17 #if defined(OS_ANDROID) |
20 #include "base/android/build_info.h" | 18 #include "base/android/build_info.h" |
21 #endif | 19 #endif |
22 | 20 |
23 #if defined(OS_WIN) | 21 #if defined(OS_WIN) |
24 #include "base/win/windows_version.h" | 22 #include "base/win/windows_version.h" |
25 #endif | 23 #endif |
26 | 24 |
27 #if BUILDFLAG(ENABLE_MOJO_CDM) && !BUILDFLAG(ENABLE_PEPPER_CDMS) | 25 #if BUILDFLAG(ENABLE_MOJO_CDM) |
28 // When mojo CDM is enabled, External Clear Key is supported in //content/shell/ | 26 // When mojo CDM is enabled, External Clear Key is supported in //content/shell/ |
29 // by using mojo CDM with AesDecryptor running in the remote (e.g. GPU or | 27 // by using mojo CDM with AesDecryptor running in the remote (e.g. GPU or |
30 // Browser) process. When pepper CDM is supported, External Clear Key is | 28 // Browser) process. |
31 // supported in chrome/, which is tested in browser_tests. | 29 // Note that External Clear Key is also supported in chrome/ when pepper CDM is |
| 30 // used, which is tested in browser_tests. |
32 #define SUPPORTS_EXTERNAL_CLEAR_KEY_IN_CONTENT_SHELL | 31 #define SUPPORTS_EXTERNAL_CLEAR_KEY_IN_CONTENT_SHELL |
33 #endif | 32 #endif |
34 | 33 |
35 namespace content { | 34 namespace content { |
36 | 35 |
37 // Available key systems. | 36 // Available key systems. |
38 const char kClearKeyKeySystem[] = "org.w3.clearkey"; | 37 const char kClearKeyKeySystem[] = "org.w3.clearkey"; |
39 | 38 |
40 #if defined(SUPPORTS_EXTERNAL_CLEAR_KEY_IN_CONTENT_SHELL) | 39 #if defined(SUPPORTS_EXTERNAL_CLEAR_KEY_IN_CONTENT_SHELL) |
41 const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; | 40 const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // We want to fail quickly when a test fails because an error is encountered. | 145 // We want to fail quickly when a test fails because an error is encountered. |
147 void AddTitlesToAwait(content::TitleWatcher* title_watcher) override { | 146 void AddTitlesToAwait(content::TitleWatcher* title_watcher) override { |
148 MediaBrowserTest::AddTitlesToAwait(title_watcher); | 147 MediaBrowserTest::AddTitlesToAwait(title_watcher); |
149 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeNotSupportedError)); | 148 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeNotSupportedError)); |
150 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeKeyError)); | 149 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeKeyError)); |
151 } | 150 } |
152 | 151 |
153 void SetUpCommandLine(base::CommandLine* command_line) override { | 152 void SetUpCommandLine(base::CommandLine* command_line) override { |
154 command_line->AppendSwitch(switches::kIgnoreAutoplayRestrictionsForTests); | 153 command_line->AppendSwitch(switches::kIgnoreAutoplayRestrictionsForTests); |
155 #if defined(SUPPORTS_EXTERNAL_CLEAR_KEY_IN_CONTENT_SHELL) | 154 #if defined(SUPPORTS_EXTERNAL_CLEAR_KEY_IN_CONTENT_SHELL) |
156 scoped_feature_list_.InitWithFeatures({media::kExternalClearKeyForTesting}, | 155 command_line->AppendSwitchASCII(switches::kEnableFeatures, |
157 {}); | 156 media::kExternalClearKeyForTesting.name); |
158 #endif | 157 #endif |
159 } | 158 } |
160 | |
161 base::test::ScopedFeatureList scoped_feature_list_; | |
162 }; | 159 }; |
163 | 160 |
164 using ::testing::Combine; | 161 using ::testing::Combine; |
165 using ::testing::Values; | 162 using ::testing::Values; |
166 | 163 |
167 INSTANTIATE_TEST_CASE_P(SRC_ClearKey, | 164 INSTANTIATE_TEST_CASE_P(SRC_ClearKey, |
168 EncryptedMediaTest, | 165 EncryptedMediaTest, |
169 Combine(Values(kClearKeyKeySystem), | 166 Combine(Values(kClearKeyKeySystem), |
170 Values(SrcType::SRC))); | 167 Values(SrcType::SRC))); |
171 | 168 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 TestFrameSizeChange(); | 261 TestFrameSizeChange(); |
265 } | 262 } |
266 | 263 |
267 IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, UnknownKeySystemThrowsException) { | 264 IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, UnknownKeySystemThrowsException) { |
268 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm", | 265 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm", |
269 kWebMVorbisAudioOnly, "com.example.foo", SrcType::MSE, | 266 kWebMVorbisAudioOnly, "com.example.foo", SrcType::MSE, |
270 kEmeNotSupportedError); | 267 kEmeNotSupportedError); |
271 } | 268 } |
272 | 269 |
273 } // namespace content | 270 } // namespace content |
OLD | NEW |