| 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 <memory> | 5 #include <memory> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 DVLOG(0) << "MSE is only supported in Android 4.1 and later."; | 91 DVLOG(0) << "MSE is only supported in Android 4.1 and later."; |
| 92 return false; | 92 return false; |
| 93 } | 93 } |
| 94 #endif // defined(OS_ANDROID) | 94 #endif // defined(OS_ANDROID) |
| 95 return true; | 95 return true; |
| 96 } | 96 } |
| 97 | 97 |
| 98 // Base class for encrypted media tests. | 98 // Base class for encrypted media tests. |
| 99 class EncryptedMediaTestBase : public MediaBrowserTest { | 99 class EncryptedMediaTestBase : public MediaBrowserTest { |
| 100 public: | 100 public: |
| 101 EncryptedMediaTestBase() {} | 101 EncryptedMediaTestBase() { |
| 102 #if defined(ENABLE_PEPPER_CDMS) |
| 103 enable_component_update(); |
| 104 #endif // defined(ENABLE_PEPPER_CDMS) |
| 105 } |
| 102 | 106 |
| 103 bool IsExternalClearKey(const std::string& key_system) { | 107 bool IsExternalClearKey(const std::string& key_system) { |
| 104 if (key_system == kExternalClearKeyKeySystem) | 108 if (key_system == kExternalClearKeyKeySystem) |
| 105 return true; | 109 return true; |
| 106 std::string prefix = std::string(kExternalClearKeyKeySystem) + '.'; | 110 std::string prefix = std::string(kExternalClearKeyKeySystem) + '.'; |
| 107 return key_system.substr(0, prefix.size()) == prefix; | 111 return key_system.substr(0, prefix.size()) == prefix; |
| 108 } | 112 } |
| 109 | 113 |
| 110 #if defined(WIDEVINE_CDM_AVAILABLE) | 114 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 111 bool IsWidevine(const std::string& key_system) { | 115 bool IsWidevine(const std::string& key_system) { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 // disable web-security to send license requests to the license server. | 252 // disable web-security to send license requests to the license server. |
| 249 // TODO(shadi): Add port forwarding to the test web server configuration. | 253 // TODO(shadi): Add port forwarding to the test web server configuration. |
| 250 command_line->AppendSwitch(switches::kDisableWebSecurity); | 254 command_line->AppendSwitch(switches::kDisableWebSecurity); |
| 251 | 255 |
| 252 #if defined(ENABLE_PEPPER_CDMS) | 256 #if defined(ENABLE_PEPPER_CDMS) |
| 253 if (IsExternalClearKey(key_system)) { | 257 if (IsExternalClearKey(key_system)) { |
| 254 RegisterPepperCdm(command_line, kClearKeyCdmBaseDirectory, | 258 RegisterPepperCdm(command_line, kClearKeyCdmBaseDirectory, |
| 255 kClearKeyCdmAdapterFileName, kClearKeyCdmDisplayName, | 259 kClearKeyCdmAdapterFileName, kClearKeyCdmDisplayName, |
| 256 kClearKeyCdmPepperMimeType); | 260 kClearKeyCdmPepperMimeType); |
| 257 } | 261 } |
| 258 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | |
| 259 else if (IsWidevine(key_system)) { // NOLINT | |
| 260 RegisterPepperCdm(command_line, kWidevineCdmBaseDirectory, | |
| 261 kWidevineCdmAdapterFileName, kWidevineCdmDisplayName, | |
| 262 kWidevineCdmPluginMimeType); | |
| 263 } | |
| 264 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | |
| 265 #endif // defined(ENABLE_PEPPER_CDMS) | 262 #endif // defined(ENABLE_PEPPER_CDMS) |
| 266 } | 263 } |
| 267 }; | 264 }; |
| 268 | 265 |
| 269 #if defined(ENABLE_PEPPER_CDMS) | 266 #if defined(ENABLE_PEPPER_CDMS) |
| 270 // Tests encrypted media playback using ExternalClearKey key system in | 267 // Tests encrypted media playback using ExternalClearKey key system in |
| 271 // decrypt-and-decode mode. | 268 // decrypt-and-decode mode. |
| 272 class ECKEncryptedMediaTest : public EncryptedMediaTestBase { | 269 class ECKEncryptedMediaTest : public EncryptedMediaTestBase { |
| 273 public: | 270 public: |
| 274 // We use special |key_system| names to do non-playback related tests, e.g. | 271 // We use special |key_system| names to do non-playback related tests, e.g. |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 | 620 |
| 624 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { | 621 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { |
| 625 TestPlaybackCase(kLoadableSession, kEnded); | 622 TestPlaybackCase(kLoadableSession, kEnded); |
| 626 } | 623 } |
| 627 | 624 |
| 628 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { | 625 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { |
| 629 TestPlaybackCase(kUnknownSession, kEmeSessionNotFound); | 626 TestPlaybackCase(kUnknownSession, kEmeSessionNotFound); |
| 630 } | 627 } |
| 631 | 628 |
| 632 #endif // defined(ENABLE_PEPPER_CDMS) | 629 #endif // defined(ENABLE_PEPPER_CDMS) |
| OLD | NEW |