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