| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
| 10 #include "chrome/browser/media/media_browsertest.h" | 10 #include "chrome/browser/media/media_browsertest.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 protected: | 230 protected: |
| 231 scoped_ptr<TestLicenseServer> license_server_; | 231 scoped_ptr<TestLicenseServer> license_server_; |
| 232 | 232 |
| 233 // We want to fail quickly when a test fails because an error is encountered. | 233 // We want to fail quickly when a test fails because an error is encountered. |
| 234 void AddWaitForTitles(content::TitleWatcher* title_watcher) override { | 234 void AddWaitForTitles(content::TitleWatcher* title_watcher) override { |
| 235 MediaBrowserTest::AddWaitForTitles(title_watcher); | 235 MediaBrowserTest::AddWaitForTitles(title_watcher); |
| 236 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeNotSupportedError)); | 236 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeNotSupportedError)); |
| 237 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeKeyError)); | 237 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeKeyError)); |
| 238 } | 238 } |
| 239 | 239 |
| 240 void SetUpCommandLine(CommandLine* command_line) override { | 240 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 241 #if defined(OS_ANDROID) | 241 #if defined(OS_ANDROID) |
| 242 command_line->AppendSwitch( | 242 command_line->AppendSwitch( |
| 243 switches::kDisableGestureRequirementForMediaPlayback); | 243 switches::kDisableGestureRequirementForMediaPlayback); |
| 244 #endif // defined(OS_ANDROID) | 244 #endif // defined(OS_ANDROID) |
| 245 } | 245 } |
| 246 | 246 |
| 247 void SetUpCommandLineForKeySystem(const std::string& key_system, | 247 void SetUpCommandLineForKeySystem(const std::string& key_system, |
| 248 CommandLine* command_line) { | 248 base::CommandLine* command_line) { |
| 249 if (GetServerConfig(key_system)) | 249 if (GetServerConfig(key_system)) |
| 250 // Since the web and license servers listen on different ports, we need to | 250 // Since the web and license servers listen on different ports, we need to |
| 251 // disable web-security to send license requests to the license server. | 251 // disable web-security to send license requests to the license server. |
| 252 // TODO(shadi): Add port forwarding to the test web server configuration. | 252 // TODO(shadi): Add port forwarding to the test web server configuration. |
| 253 command_line->AppendSwitch(switches::kDisableWebSecurity); | 253 command_line->AppendSwitch(switches::kDisableWebSecurity); |
| 254 | 254 |
| 255 #if defined(ENABLE_PEPPER_CDMS) | 255 #if defined(ENABLE_PEPPER_CDMS) |
| 256 if (IsExternalClearKey(key_system)) { | 256 if (IsExternalClearKey(key_system)) { |
| 257 RegisterPepperCdm(command_line, kClearKeyCdmAdapterFileName, key_system); | 257 RegisterPepperCdm(command_line, kClearKeyCdmAdapterFileName, key_system); |
| 258 } | 258 } |
| 259 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 259 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
| 260 else if (IsWidevine(key_system)) { // NOLINT | 260 else if (IsWidevine(key_system)) { // NOLINT |
| 261 RegisterPepperCdm(command_line, kWidevineCdmAdapterFileName, key_system); | 261 RegisterPepperCdm(command_line, kWidevineCdmAdapterFileName, key_system); |
| 262 } | 262 } |
| 263 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) | 263 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) |
| 264 #endif // defined(ENABLE_PEPPER_CDMS) | 264 #endif // defined(ENABLE_PEPPER_CDMS) |
| 265 } | 265 } |
| 266 | 266 |
| 267 private: | 267 private: |
| 268 #if defined(ENABLE_PEPPER_CDMS) | 268 #if defined(ENABLE_PEPPER_CDMS) |
| 269 void RegisterPepperCdm(CommandLine* command_line, | 269 void RegisterPepperCdm(base::CommandLine* command_line, |
| 270 const std::string& adapter_name, | 270 const std::string& adapter_name, |
| 271 const std::string& key_system) { | 271 const std::string& key_system) { |
| 272 DCHECK(!is_pepper_cdm_registered_) | 272 DCHECK(!is_pepper_cdm_registered_) |
| 273 << "RegisterPepperCdm() can only be called once."; | 273 << "RegisterPepperCdm() can only be called once."; |
| 274 is_pepper_cdm_registered_ = true; | 274 is_pepper_cdm_registered_ = true; |
| 275 | 275 |
| 276 // Append the switch to register the Clear Key CDM Adapter. | 276 // Append the switch to register the Clear Key CDM Adapter. |
| 277 base::FilePath plugin_dir; | 277 base::FilePath plugin_dir; |
| 278 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir)); | 278 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir)); |
| 279 base::FilePath plugin_lib = plugin_dir.AppendASCII(adapter_name); | 279 base::FilePath plugin_lib = plugin_dir.AppendASCII(adapter_name); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 kWebMAudioOnly, | 322 kWebMAudioOnly, |
| 323 key_system, | 323 key_system, |
| 324 SRC, | 324 SRC, |
| 325 PREFIXED, | 325 PREFIXED, |
| 326 kNoSessionToLoad, | 326 kNoSessionToLoad, |
| 327 false, | 327 false, |
| 328 expected_title); | 328 expected_title); |
| 329 } | 329 } |
| 330 | 330 |
| 331 protected: | 331 protected: |
| 332 void SetUpCommandLine(CommandLine* command_line) override { | 332 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 333 EncryptedMediaTestBase::SetUpCommandLine(command_line); | 333 EncryptedMediaTestBase::SetUpCommandLine(command_line); |
| 334 SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, command_line); | 334 SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, command_line); |
| 335 } | 335 } |
| 336 }; | 336 }; |
| 337 | 337 |
| 338 // Tests encrypted media playback using ExternalClearKey key system in | 338 // Tests encrypted media playback using ExternalClearKey key system in |
| 339 // decrypt-and-decode mode for unprefixed EME. | 339 // decrypt-and-decode mode for unprefixed EME. |
| 340 // TODO(jrummell): Merge with ECKEncryptedMediaTest once unprefixed is | 340 // TODO(jrummell): Merge with ECKEncryptedMediaTest once unprefixed is |
| 341 // enabled by default. | 341 // enabled by default. |
| 342 class ECKUnprefixedEncryptedMediaTest : public EncryptedMediaTestBase { | 342 class ECKUnprefixedEncryptedMediaTest : public EncryptedMediaTestBase { |
| 343 protected: | 343 protected: |
| 344 void SetUpCommandLine(CommandLine* command_line) override { | 344 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 345 EncryptedMediaTestBase::SetUpCommandLine(command_line); | 345 EncryptedMediaTestBase::SetUpCommandLine(command_line); |
| 346 command_line->AppendSwitch(switches::kEnableEncryptedMedia); | 346 command_line->AppendSwitch(switches::kEnableEncryptedMedia); |
| 347 SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, command_line); | 347 SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, command_line); |
| 348 } | 348 } |
| 349 }; | 349 }; |
| 350 | 350 |
| 351 #if defined(WIDEVINE_CDM_AVAILABLE) | 351 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 352 // Tests encrypted media playback using Widevine key system. | 352 // Tests encrypted media playback using Widevine key system. |
| 353 class WVEncryptedMediaTest : public EncryptedMediaTestBase { | 353 class WVEncryptedMediaTest : public EncryptedMediaTestBase { |
| 354 protected: | 354 protected: |
| 355 virtual void SetUpCommandLine(CommandLine* command_line) override { | 355 virtual void SetUpCommandLine(base::CommandLine* command_line) override { |
| 356 EncryptedMediaTestBase::SetUpCommandLine(command_line); | 356 EncryptedMediaTestBase::SetUpCommandLine(command_line); |
| 357 command_line->AppendSwitch(switches::kEnableEncryptedMedia); | 357 command_line->AppendSwitch(switches::kEnableEncryptedMedia); |
| 358 SetUpCommandLineForKeySystem(kWidevineKeySystem, command_line); | 358 SetUpCommandLineForKeySystem(kWidevineKeySystem, command_line); |
| 359 } | 359 } |
| 360 }; | 360 }; |
| 361 | 361 |
| 362 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 362 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
| 363 #endif // defined(ENABLE_PEPPER_CDMS) | 363 #endif // defined(ENABLE_PEPPER_CDMS) |
| 364 | 364 |
| 365 // Tests encrypted media playback with a combination of parameters: | 365 // Tests encrypted media playback with a combination of parameters: |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 query_params.push_back(std::make_pair("runEncrypted", "1")); | 427 query_params.push_back(std::make_pair("runEncrypted", "1")); |
| 428 if (CurrentEmeVersion() == PREFIXED) | 428 if (CurrentEmeVersion() == PREFIXED) |
| 429 query_params.push_back(std::make_pair("usePrefixedEME", "1")); | 429 query_params.push_back(std::make_pair("usePrefixedEME", "1")); |
| 430 RunEncryptedMediaTestPage("mse_config_change.html", | 430 RunEncryptedMediaTestPage("mse_config_change.html", |
| 431 CurrentKeySystem(), | 431 CurrentKeySystem(), |
| 432 query_params, | 432 query_params, |
| 433 kEnded); | 433 kEnded); |
| 434 } | 434 } |
| 435 | 435 |
| 436 protected: | 436 protected: |
| 437 void SetUpCommandLine(CommandLine* command_line) override { | 437 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 438 EncryptedMediaTestBase::SetUpCommandLine(command_line); | 438 EncryptedMediaTestBase::SetUpCommandLine(command_line); |
| 439 SetUpCommandLineForKeySystem(CurrentKeySystem(), command_line); | 439 SetUpCommandLineForKeySystem(CurrentKeySystem(), command_line); |
| 440 | 440 |
| 441 if (CurrentEmeVersion() == UNPREFIXED) | 441 if (CurrentEmeVersion() == UNPREFIXED) |
| 442 command_line->AppendSwitch(switches::kEnableEncryptedMedia); | 442 command_line->AppendSwitch(switches::kEnableEncryptedMedia); |
| 443 } | 443 } |
| 444 }; | 444 }; |
| 445 | 445 |
| 446 using ::testing::Combine; | 446 using ::testing::Combine; |
| 447 using ::testing::Values; | 447 using ::testing::Values; |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 "bear-320x240-v_enc-v.webm", | 715 "bear-320x240-v_enc-v.webm", |
| 716 kWebMVideoOnly, | 716 kWebMVideoOnly, |
| 717 kExternalClearKeyKeySystem, | 717 kExternalClearKeyKeySystem, |
| 718 SRC, | 718 SRC, |
| 719 UNPREFIXED, | 719 UNPREFIXED, |
| 720 kUnknownSession, | 720 kUnknownSession, |
| 721 false, | 721 false, |
| 722 kEmeKeyError); | 722 kEmeKeyError); |
| 723 } | 723 } |
| 724 #endif // defined(ENABLE_PEPPER_CDMS) | 724 #endif // defined(ENABLE_PEPPER_CDMS) |
| OLD | NEW |