| 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 #include "media/base/media.h" | 13 #include "media/base/media.h" |
| 14 #include "media/base/media_switches.h" | 14 #include "media/base/media_switches.h" |
| 15 | 15 |
| 16 #if defined(OS_ANDROID) | 16 #if defined(OS_ANDROID) |
| 17 #include "base/android/build_info.h" | 17 #include "base/android/build_info.h" |
| 18 #endif | 18 #endif |
| 19 | 19 |
| 20 // MojoCdm supports Clear Key, but currently MojoRenderer cannot use it. | |
| 21 // See http://crbug.com/441957 for details. | |
| 22 #if !(defined(ENABLE_MOJO_CDM) && defined(ENABLE_MOJO_RENDERER)) | |
| 23 #define SUPPORTS_CLEAR_KEY_IN_CONTENT_SHELL | |
| 24 #endif | |
| 25 | |
| 26 #if defined(ENABLE_MOJO_CDM) | 20 #if defined(ENABLE_MOJO_CDM) |
| 27 // When mojo CDM is enabled, External Clear Key is supported in //content/shell/ | 21 // When mojo CDM is enabled, External Clear Key is supported in //content/shell/ |
| 28 // by using mojo CDM with AesDecryptor running in the remote (e.g. GPU or | 22 // by using mojo CDM with AesDecryptor running in the remote (e.g. GPU or |
| 29 // Browser) process. | 23 // Browser) process. |
| 30 // Note that External Clear Key is also supported in chrome/ when pepper CDM is | 24 // Note that External Clear Key is also supported in chrome/ when pepper CDM is |
| 31 // used, which is tested in browser_tests. | 25 // used, which is tested in browser_tests. |
| 32 #define SUPPORTS_EXTERNAL_CLEAR_KEY_IN_CONTENT_SHELL | 26 #define SUPPORTS_EXTERNAL_CLEAR_KEY_IN_CONTENT_SHELL |
| 33 #endif | 27 #endif |
| 34 | 28 |
| 35 // Available key systems. | 29 // Available key systems. |
| 36 #if defined(SUPPORTS_CLEAR_KEY_IN_CONTENT_SHELL) | |
| 37 const char kClearKeyKeySystem[] = "org.w3.clearkey"; | 30 const char kClearKeyKeySystem[] = "org.w3.clearkey"; |
| 38 #endif | |
| 39 | 31 |
| 40 #if defined(SUPPORTS_EXTERNAL_CLEAR_KEY_IN_CONTENT_SHELL) | 32 #if defined(SUPPORTS_EXTERNAL_CLEAR_KEY_IN_CONTENT_SHELL) |
| 41 const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; | 33 const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; |
| 42 #endif | 34 #endif |
| 43 | 35 |
| 44 // Supported media types. | 36 // Supported media types. |
| 45 const char kWebMVorbisAudioOnly[] = "audio/webm; codecs=\"vorbis\""; | 37 const char kWebMVorbisAudioOnly[] = "audio/webm; codecs=\"vorbis\""; |
| 46 const char kWebMOpusAudioOnly[] = "audio/webm; codecs=\"opus\""; | 38 const char kWebMOpusAudioOnly[] = "audio/webm; codecs=\"opus\""; |
| 47 const char kWebMVP8VideoOnly[] = "video/webm; codecs=\"vp8\""; | 39 const char kWebMVP8VideoOnly[] = "video/webm; codecs=\"vp8\""; |
| 48 const char kWebMVP9VideoOnly[] = "video/webm; codecs=\"vp9\""; | 40 const char kWebMVP9VideoOnly[] = "video/webm; codecs=\"vp9\""; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 #if defined(SUPPORTS_EXTERNAL_CLEAR_KEY_IN_CONTENT_SHELL) | 134 #if defined(SUPPORTS_EXTERNAL_CLEAR_KEY_IN_CONTENT_SHELL) |
| 143 command_line->AppendSwitchASCII(switches::kEnableFeatures, | 135 command_line->AppendSwitchASCII(switches::kEnableFeatures, |
| 144 media::kExternalClearKeyForTesting.name); | 136 media::kExternalClearKeyForTesting.name); |
| 145 #endif | 137 #endif |
| 146 } | 138 } |
| 147 }; | 139 }; |
| 148 | 140 |
| 149 using ::testing::Combine; | 141 using ::testing::Combine; |
| 150 using ::testing::Values; | 142 using ::testing::Values; |
| 151 | 143 |
| 152 #if defined(SUPPORTS_CLEAR_KEY_IN_CONTENT_SHELL) | |
| 153 INSTANTIATE_TEST_CASE_P(SRC_ClearKey, EncryptedMediaTest, | 144 INSTANTIATE_TEST_CASE_P(SRC_ClearKey, EncryptedMediaTest, |
| 154 Combine(Values(kClearKeyKeySystem), Values(SRC))); | 145 Combine(Values(kClearKeyKeySystem), Values(SRC))); |
| 155 | 146 |
| 156 INSTANTIATE_TEST_CASE_P(MSE_ClearKey, EncryptedMediaTest, | 147 INSTANTIATE_TEST_CASE_P(MSE_ClearKey, EncryptedMediaTest, |
| 157 Combine(Values(kClearKeyKeySystem), Values(MSE))); | 148 Combine(Values(kClearKeyKeySystem), Values(MSE))); |
| 158 #endif | |
| 159 | 149 |
| 160 #if defined(SUPPORTS_EXTERNAL_CLEAR_KEY_IN_CONTENT_SHELL) | 150 #if defined(SUPPORTS_EXTERNAL_CLEAR_KEY_IN_CONTENT_SHELL) |
| 161 INSTANTIATE_TEST_CASE_P(SRC_ExternalClearKey, | 151 INSTANTIATE_TEST_CASE_P(SRC_ExternalClearKey, |
| 162 EncryptedMediaTest, | 152 EncryptedMediaTest, |
| 163 Combine(Values(kExternalClearKeyKeySystem), | 153 Combine(Values(kExternalClearKeyKeySystem), |
| 164 Values(SRC))); | 154 Values(SRC))); |
| 165 | 155 |
| 166 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey, | 156 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey, |
| 167 EncryptedMediaTest, | 157 EncryptedMediaTest, |
| 168 Combine(Values(kExternalClearKeyKeySystem), | 158 Combine(Values(kExternalClearKeyKeySystem), |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 TestFrameSizeChange(); | 222 TestFrameSizeChange(); |
| 233 } | 223 } |
| 234 | 224 |
| 235 IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, UnknownKeySystemThrowsException) { | 225 IN_PROC_BROWSER_TEST_F(EncryptedMediaTest, UnknownKeySystemThrowsException) { |
| 236 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm", | 226 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm", |
| 237 kWebMVorbisAudioOnly, "com.example.foo", MSE, | 227 kWebMVorbisAudioOnly, "com.example.foo", MSE, |
| 238 kEmeNotSupportedError); | 228 kEmeNotSupportedError); |
| 239 } | 229 } |
| 240 | 230 |
| 241 } // namespace content | 231 } // namespace content |
| OLD | NEW |