Chromium Code Reviews| 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/string_number_conversions.h" | |
| 10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 11 #include "base/win/windows_version.h" | 12 #include "base/win/windows_version.h" |
| 12 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 13 #include "chrome/browser/media/media_browsertest.h" | 14 #include "chrome/browser/media/media_browsertest.h" |
| 14 #include "chrome/browser/media/test_license_server.h" | 15 #include "chrome/browser/media/test_license_server.h" |
| 15 #include "chrome/browser/media/wv_test_license_server_config.h" | 16 #include "chrome/browser/media/wv_test_license_server_config.h" |
| 16 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 18 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 19 #include "chrome/test/base/test_launcher_utils.h" | 20 #include "chrome/test/base/test_launcher_utils.h" |
| 20 #include "content/public/common/content_switches.h" | 21 #include "content/public/common/content_switches.h" |
| 21 #include "content/public/test/browser_test_utils.h" | 22 #include "content/public/test/browser_test_utils.h" |
| 22 #include "media/base/media_switches.h" | 23 #include "media/base/media_switches.h" |
| 23 #include "ppapi/features/features.h" | 24 #include "ppapi/features/features.h" |
| 24 #include "testing/gtest/include/gtest/gtest-spi.h" | 25 #include "testing/gtest/include/gtest/gtest-spi.h" |
| 25 | 26 |
| 26 #if defined(OS_ANDROID) | 27 #if defined(OS_ANDROID) |
| 27 #include "base/android/build_info.h" | 28 #include "base/android/build_info.h" |
| 28 #endif | 29 #endif |
| 29 | 30 |
| 30 #if BUILDFLAG(ENABLE_PEPPER_CDMS) | 31 #if BUILDFLAG(ENABLE_PEPPER_CDMS) |
| 31 #include "chrome/browser/media/pepper_cdm_test_constants.h" | 32 #include "chrome/browser/media/pepper_cdm_test_constants.h" |
| 32 #include "chrome/browser/media/pepper_cdm_test_helper.h" | 33 #include "chrome/browser/media/pepper_cdm_test_helper.h" |
| 33 #include "media/base/media_switches.h" | 34 #include "media/base/media_switches.h" |
| 34 #endif | 35 #endif |
| 35 | 36 |
| 36 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | 37 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
| 37 | 38 |
| 38 // Available key systems. | 39 // Available key systems. |
|
ddorwin
2017/02/12 04:28:52
It's interesting that none of this test is in a na
xhwang
2017/02/14 23:59:32
Traditionally chrome/ files are not in "chrome" na
| |
| 39 const char kClearKeyKeySystem[] = "org.w3.clearkey"; | 40 const char kClearKeyKeySystem[] = "org.w3.clearkey"; |
| 40 const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; | 41 const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; |
| 41 | 42 |
| 42 // Variants of External Clear Key key system to test different scenarios. | 43 // Variants of External Clear Key key system to test different scenarios. |
| 43 // To add a new variant, make sure you also update: | 44 // To add a new variant, make sure you also update: |
| 44 // - media/test/data/eme_player_js/globals.js | 45 // - media/test/data/eme_player_js/globals.js |
| 45 // - AddExternalClearKey() in chrome_key_systems.cc | 46 // - AddExternalClearKey() in chrome_key_systems.cc |
| 46 // - CreateCdmInstance() in clear_key_cdm.cc | 47 // - CreateCdmInstance() in clear_key_cdm.cc |
| 47 const char kExternalClearKeyRenewalKeySystem[] = | 48 const char kExternalClearKeyRenewalKeySystem[] = |
| 48 "org.chromium.externalclearkey.renewal"; | 49 "org.chromium.externalclearkey.renewal"; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 const char kEmeLoadFailed[] = "EME_LOAD_FAILED"; | 85 const char kEmeLoadFailed[] = "EME_LOAD_FAILED"; |
| 85 const char kEmeUpdateFailed[] = "EME_UPDATE_FAILED"; | 86 const char kEmeUpdateFailed[] = "EME_UPDATE_FAILED"; |
| 86 const char kEmeErrorEvent[] = "EME_ERROR_EVENT"; | 87 const char kEmeErrorEvent[] = "EME_ERROR_EVENT"; |
| 87 const char kEmeMessageUnexpectedType[] = "EME_MESSAGE_UNEXPECTED_TYPE"; | 88 const char kEmeMessageUnexpectedType[] = "EME_MESSAGE_UNEXPECTED_TYPE"; |
| 88 const char kEmeRenewalMissingHeader[] = "EME_RENEWAL_MISSING_HEADER"; | 89 const char kEmeRenewalMissingHeader[] = "EME_RENEWAL_MISSING_HEADER"; |
| 89 const char kEmeSessionClosedAndError[] = "EME_SESSION_CLOSED_AND_ERROR"; | 90 const char kEmeSessionClosedAndError[] = "EME_SESSION_CLOSED_AND_ERROR"; |
| 90 | 91 |
| 91 const char kDefaultEmePlayer[] = "eme_player.html"; | 92 const char kDefaultEmePlayer[] = "eme_player.html"; |
| 92 | 93 |
| 93 // The type of video src used to load media. | 94 // The type of video src used to load media. |
| 94 enum SrcType { | 95 enum class SrcType { SRC, MSE }; |
| 95 SRC, | 96 |
| 96 MSE | 97 // Must be in sync with CONFIG_CHANGE_TYPE in eme_player_js/global.js |
| 98 enum class ConfigChangeType { | |
| 99 CLEAR_TO_CLEAR = 0, | |
| 100 CLEAR_TO_ENCRYPTED = 1, | |
| 101 ENCRYPTED_TO_CLEAR = 2, | |
| 102 ENCRYPTED_TO_ENCRYPTED = 3, | |
| 97 }; | 103 }; |
| 98 | 104 |
| 99 // Whether the video should be played once or twice. | 105 // Whether the video should be played once or twice. |
| 100 enum class PlayTwice { NO, YES }; | 106 enum class PlayTwice { NO, YES }; |
| 101 | 107 |
| 102 // Format of a container when testing different streams. | 108 // Format of a container when testing different streams. |
| 103 enum class EncryptedContainer { | 109 enum class EncryptedContainer { |
| 104 CLEAR_WEBM, | 110 CLEAR_WEBM, |
| 105 CLEAR_MP4, | 111 CLEAR_MP4, |
| 106 ENCRYPTED_WEBM, | 112 ENCRYPTED_WEBM, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 147 const std::string& key_system, | 153 const std::string& key_system, |
| 148 SrcType src_type, | 154 SrcType src_type, |
| 149 const std::string& session_to_load, | 155 const std::string& session_to_load, |
| 150 bool force_invalid_response, | 156 bool force_invalid_response, |
| 151 PlayTwice play_twice, | 157 PlayTwice play_twice, |
| 152 const std::string& expected_title) { | 158 const std::string& expected_title) { |
| 153 base::StringPairs query_params; | 159 base::StringPairs query_params; |
| 154 query_params.push_back(std::make_pair("mediaFile", media_file)); | 160 query_params.push_back(std::make_pair("mediaFile", media_file)); |
| 155 query_params.push_back(std::make_pair("mediaType", media_type)); | 161 query_params.push_back(std::make_pair("mediaType", media_type)); |
| 156 query_params.push_back(std::make_pair("keySystem", key_system)); | 162 query_params.push_back(std::make_pair("keySystem", key_system)); |
| 157 if (src_type == MSE) | 163 if (src_type == SrcType::MSE) |
| 158 query_params.push_back(std::make_pair("useMSE", "1")); | 164 query_params.push_back(std::make_pair("useMSE", "1")); |
| 159 if (force_invalid_response) | 165 if (force_invalid_response) |
| 160 query_params.push_back(std::make_pair("forceInvalidResponse", "1")); | 166 query_params.push_back(std::make_pair("forceInvalidResponse", "1")); |
| 161 if (!session_to_load.empty()) | 167 if (!session_to_load.empty()) |
| 162 query_params.push_back(std::make_pair("sessionToLoad", session_to_load)); | 168 query_params.push_back(std::make_pair("sessionToLoad", session_to_load)); |
| 163 if (play_twice == PlayTwice::YES) | 169 if (play_twice == PlayTwice::YES) |
| 164 query_params.push_back(std::make_pair("playTwice", "1")); | 170 query_params.push_back(std::make_pair("playTwice", "1")); |
| 165 RunEncryptedMediaTestPage(html_page, key_system, query_params, | 171 RunEncryptedMediaTestPage(html_page, key_system, query_params, |
| 166 expected_title); | 172 expected_title); |
| 167 } | 173 } |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 // decrypt-and-decode mode. | 288 // decrypt-and-decode mode. |
| 283 class ECKEncryptedMediaTest : public EncryptedMediaTestBase { | 289 class ECKEncryptedMediaTest : public EncryptedMediaTestBase { |
| 284 public: | 290 public: |
| 285 // We use special |key_system| names to do non-playback related tests, e.g. | 291 // We use special |key_system| names to do non-playback related tests, e.g. |
| 286 // kExternalClearKeyFileIOTestKeySystem is used to test file IO. | 292 // kExternalClearKeyFileIOTestKeySystem is used to test file IO. |
| 287 void TestNonPlaybackCases(const std::string& key_system, | 293 void TestNonPlaybackCases(const std::string& key_system, |
| 288 const std::string& expected_title) { | 294 const std::string& expected_title) { |
| 289 // Since we do not test playback, arbitrarily choose a test file and source | 295 // Since we do not test playback, arbitrarily choose a test file and source |
| 290 // type. | 296 // type. |
| 291 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm", | 297 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm", |
| 292 kWebMVorbisAudioOnly, key_system, SRC, | 298 kWebMVorbisAudioOnly, key_system, SrcType::SRC, |
| 293 kNoSessionToLoad, false, PlayTwice::NO, | 299 kNoSessionToLoad, false, PlayTwice::NO, |
| 294 expected_title); | 300 expected_title); |
| 295 } | 301 } |
| 296 | 302 |
| 297 void TestPlaybackCase(const std::string& key_system, | 303 void TestPlaybackCase(const std::string& key_system, |
| 298 const std::string& session_to_load, | 304 const std::string& session_to_load, |
| 299 const std::string& expected_title) { | 305 const std::string& expected_title) { |
| 300 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-320x240-v_enc-v.webm", | 306 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-320x240-v_enc-v.webm", |
| 301 kWebMVP8VideoOnly, key_system, SRC, session_to_load, | 307 kWebMVP8VideoOnly, key_system, SrcType::SRC, |
| 302 false, PlayTwice::NO, expected_title); | 308 session_to_load, false, PlayTwice::NO, |
| 309 expected_title); | |
| 303 } | 310 } |
| 304 | 311 |
| 305 protected: | 312 protected: |
| 306 void SetUpCommandLine(base::CommandLine* command_line) override { | 313 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 307 EncryptedMediaTestBase::SetUpCommandLine(command_line); | 314 EncryptedMediaTestBase::SetUpCommandLine(command_line); |
| 308 SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, command_line); | 315 SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, command_line); |
| 309 } | 316 } |
| 310 }; | 317 }; |
| 311 | 318 |
| 312 #if defined(WIDEVINE_CDM_AVAILABLE) | 319 #if defined(WIDEVINE_CDM_AVAILABLE) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 362 PlayTwice::NO, kEmeUpdateFailed); | 369 PlayTwice::NO, kEmeUpdateFailed); |
| 363 } | 370 } |
| 364 | 371 |
| 365 void TestFrameSizeChange() { | 372 void TestFrameSizeChange() { |
| 366 RunEncryptedMediaTest( | 373 RunEncryptedMediaTest( |
| 367 "encrypted_frame_size_change.html", "frame_size_change-av_enc-v.webm", | 374 "encrypted_frame_size_change.html", "frame_size_change-av_enc-v.webm", |
| 368 kWebMVorbisAudioVP8Video, CurrentKeySystem(), CurrentSourceType(), | 375 kWebMVorbisAudioVP8Video, CurrentKeySystem(), CurrentSourceType(), |
| 369 kNoSessionToLoad, false, PlayTwice::NO, kEnded); | 376 kNoSessionToLoad, false, PlayTwice::NO, kEnded); |
| 370 } | 377 } |
| 371 | 378 |
| 372 void TestConfigChange() { | 379 void TestConfigChange(ConfigChangeType config_change_type, |
| 380 const std::string& expectation = kEnded) { | |
|
ddorwin
2017/02/12 04:28:52
There are only 3 call sites where this is used. Ma
xhwang
2017/02/14 23:59:32
Dropped now the failing test is disabled.
| |
| 381 if (CurrentSourceType() != SrcType::MSE) { | |
| 382 DVLOG(0) << "Config change only happens when using MSE."; | |
|
ddorwin
2017/02/12 04:28:52
Each one of these tests involves invoking an insta
xhwang
2017/02/14 23:59:32
Added TODO. We probably should have more details c
| |
| 383 return; | |
| 384 } | |
| 385 | |
| 386 if (!IsPlayBackPossible(CurrentKeySystem())) { | |
|
ddorwin
2017/02/12 04:28:52
One solution to the above problem would be to have
xhwang
2017/02/14 23:59:32
But this also depends on whether we have a license
ddorwin
2017/02/16 20:26:21
Right. We would #ifdef the list appropriately.
xhwang
2017/02/17 00:47:20
Acknowledged.
| |
| 387 DVLOG(0) << "Skipping test - ConfigChange test requires video playback."; | |
| 388 return; | |
| 389 } | |
| 390 | |
| 373 base::StringPairs query_params; | 391 base::StringPairs query_params; |
| 374 query_params.push_back(std::make_pair("keySystem", CurrentKeySystem())); | 392 query_params.push_back(std::make_pair("keySystem", CurrentKeySystem())); |
| 375 query_params.push_back(std::make_pair("runEncrypted", "1")); | 393 query_params.push_back(std::make_pair( |
| 376 RunEncryptedMediaTestPage("mse_config_change.html", | 394 "configChangeType", |
| 377 CurrentKeySystem(), | 395 base::IntToString(static_cast<int>(config_change_type)))); |
| 378 query_params, | 396 RunEncryptedMediaTestPage("mse_config_change.html", CurrentKeySystem(), |
| 379 kEnded); | 397 query_params, expectation); |
| 380 } | 398 } |
| 381 | 399 |
| 382 std::string ConvertContainerFormat(EncryptedContainer format) { | 400 std::string ConvertContainerFormat(EncryptedContainer format) { |
| 383 switch (format) { | 401 switch (format) { |
| 384 case EncryptedContainer::CLEAR_MP4: | 402 case EncryptedContainer::CLEAR_MP4: |
| 385 return "CLEAR_MP4"; | 403 return "CLEAR_MP4"; |
| 386 case EncryptedContainer::CLEAR_WEBM: | 404 case EncryptedContainer::CLEAR_WEBM: |
| 387 return "CLEAR_WEBM"; | 405 return "CLEAR_WEBM"; |
| 388 case EncryptedContainer::ENCRYPTED_MP4: | 406 case EncryptedContainer::ENCRYPTED_MP4: |
| 389 return "ENCRYPTED_MP4"; | 407 return "ENCRYPTED_MP4"; |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 413 SetUpCommandLineForKeySystem(CurrentKeySystem(), command_line); | 431 SetUpCommandLineForKeySystem(CurrentKeySystem(), command_line); |
| 414 } | 432 } |
| 415 }; | 433 }; |
| 416 | 434 |
| 417 using ::testing::Combine; | 435 using ::testing::Combine; |
| 418 using ::testing::Values; | 436 using ::testing::Values; |
| 419 | 437 |
| 420 #if !defined(OS_ANDROID) | 438 #if !defined(OS_ANDROID) |
| 421 INSTANTIATE_TEST_CASE_P(SRC_ClearKey, | 439 INSTANTIATE_TEST_CASE_P(SRC_ClearKey, |
| 422 EncryptedMediaTest, | 440 EncryptedMediaTest, |
| 423 Combine(Values(kClearKeyKeySystem), Values(SRC))); | 441 Combine(Values(kClearKeyKeySystem), |
| 442 Values(SrcType::SRC))); | |
| 424 #endif // !defined(OS_ANDROID) | 443 #endif // !defined(OS_ANDROID) |
| 425 | 444 |
| 426 INSTANTIATE_TEST_CASE_P(MSE_ClearKey, | 445 INSTANTIATE_TEST_CASE_P(MSE_ClearKey, |
| 427 EncryptedMediaTest, | 446 EncryptedMediaTest, |
| 428 Combine(Values(kClearKeyKeySystem), Values(MSE))); | 447 Combine(Values(kClearKeyKeySystem), |
| 448 Values(SrcType::MSE))); | |
| 429 | 449 |
| 430 // External Clear Key is currently only used on platforms that use Pepper CDMs. | 450 // External Clear Key is currently only used on platforms that use Pepper CDMs. |
| 431 #if BUILDFLAG(ENABLE_PEPPER_CDMS) | 451 #if BUILDFLAG(ENABLE_PEPPER_CDMS) |
| 432 INSTANTIATE_TEST_CASE_P(SRC_ExternalClearKey, | 452 INSTANTIATE_TEST_CASE_P(SRC_ExternalClearKey, |
| 433 EncryptedMediaTest, | 453 EncryptedMediaTest, |
| 434 Combine(Values(kExternalClearKeyKeySystem), | 454 Combine(Values(kExternalClearKeyKeySystem), |
| 435 Values(SRC))); | 455 Values(SrcType::SRC))); |
| 436 | 456 |
| 437 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey, | 457 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey, |
| 438 EncryptedMediaTest, | 458 EncryptedMediaTest, |
| 439 Combine(Values(kExternalClearKeyKeySystem), | 459 Combine(Values(kExternalClearKeyKeySystem), |
| 440 Values(MSE))); | 460 Values(SrcType::MSE))); |
| 441 | 461 |
| 442 const char kExternalClearKeyDecryptOnlyKeySystem[] = | 462 const char kExternalClearKeyDecryptOnlyKeySystem[] = |
| 443 "org.chromium.externalclearkey.decryptonly"; | 463 "org.chromium.externalclearkey.decryptonly"; |
| 444 | 464 |
| 445 // To reduce test time, only run ExternalClearKeyDecryptOnly with MSE. | 465 // To reduce test time, only run ExternalClearKeyDecryptOnly with MSE. |
| 446 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKeyDecryptOnly, | 466 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKeyDecryptOnly, |
| 447 EncryptedMediaTest, | 467 EncryptedMediaTest, |
| 448 Combine(Values(kExternalClearKeyDecryptOnlyKeySystem), | 468 Combine(Values(kExternalClearKeyDecryptOnlyKeySystem), |
| 449 Values(MSE))); | 469 Values(SrcType::MSE))); |
| 450 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) | 470 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) |
| 451 | 471 |
| 452 #if defined(WIDEVINE_CDM_AVAILABLE) | 472 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 453 #if !defined(OS_CHROMEOS) | 473 #if !defined(OS_CHROMEOS) |
| 454 INSTANTIATE_TEST_CASE_P(MSE_Widevine, | 474 INSTANTIATE_TEST_CASE_P(MSE_Widevine, |
| 455 EncryptedMediaTest, | 475 EncryptedMediaTest, |
| 456 Combine(Values(kWidevineKeySystem), Values(MSE))); | 476 Combine(Values(kWidevineKeySystem), |
| 477 Values(SrcType::MSE))); | |
| 457 #endif // !defined(OS_CHROMEOS) | 478 #endif // !defined(OS_CHROMEOS) |
| 458 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 479 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
| 459 | 480 |
| 460 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) { | 481 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) { |
| 461 TestSimplePlayback("bear-a_enc-a.webm", kWebMVorbisAudioOnly); | 482 TestSimplePlayback("bear-a_enc-a.webm", kWebMVorbisAudioOnly); |
| 462 } | 483 } |
| 463 | 484 |
| 464 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioClearVideo_WebM) { | 485 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioClearVideo_WebM) { |
| 465 TestSimplePlayback("bear-320x240-av_enc-a.webm", kWebMVorbisAudioVP8Video); | 486 TestSimplePlayback("bear-320x240-av_enc-a.webm", kWebMVorbisAudioVP8Video); |
| 466 } | 487 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 505 DVLOG(0) << "Skipping test - Playback_Multiple test requires playback."; | 526 DVLOG(0) << "Skipping test - Playback_Multiple test requires playback."; |
| 506 return; | 527 return; |
| 507 } | 528 } |
| 508 TestMultiplePlayback("bear-320x240-av_enc-av.webm", kWebMVorbisAudioVP8Video); | 529 TestMultiplePlayback("bear-320x240-av_enc-av.webm", kWebMVorbisAudioVP8Video); |
| 509 } | 530 } |
| 510 | 531 |
| 511 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, InvalidResponseKeyError) { | 532 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, InvalidResponseKeyError) { |
| 512 RunInvalidResponseTest(); | 533 RunInvalidResponseTest(); |
| 513 } | 534 } |
| 514 | 535 |
| 515 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, ConfigChangeVideo) { | 536 // Strictly speaking this is not an "encrypted" media test. Keep it here for |
| 516 if (!IsPlayBackPossible(CurrentKeySystem())) { | 537 // completeness. |
| 517 DVLOG(0) << "Skipping test - ConfigChange test requires video playback."; | 538 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, ConfigChangeVideo_ClearToClear) { |
| 518 return; | 539 TestConfigChange(ConfigChangeType::CLEAR_TO_CLEAR); |
| 519 } | 540 } |
| 520 TestConfigChange(); | 541 |
| 542 // TODO(xhwang): Support switching from clear to encrypted and fix the test | |
| 543 // expectation. See http://crbug.com/597443 | |
| 544 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, ConfigChangeVideo_ClearToEncrypted) { | |
| 545 TestConfigChange(ConfigChangeType::CLEAR_TO_ENCRYPTED, kError); | |
| 546 } | |
| 547 | |
| 548 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, ConfigChangeVideo_EncryptedToClear) { | |
| 549 TestConfigChange(ConfigChangeType::ENCRYPTED_TO_CLEAR); | |
| 550 } | |
| 551 | |
| 552 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, | |
| 553 ConfigChangeVideo_EncryptedToEncrypted) { | |
| 554 TestConfigChange(ConfigChangeType::ENCRYPTED_TO_ENCRYPTED); | |
| 521 } | 555 } |
| 522 | 556 |
| 523 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, FrameSizeChangeVideo) { | 557 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, FrameSizeChangeVideo) { |
| 524 if (!IsPlayBackPossible(CurrentKeySystem())) { | 558 if (!IsPlayBackPossible(CurrentKeySystem())) { |
| 525 DVLOG(0) << "Skipping test - FrameSizeChange test requires video playback."; | 559 DVLOG(0) << "Skipping test - FrameSizeChange test requires video playback."; |
| 526 return; | 560 return; |
| 527 } | 561 } |
| 528 TestFrameSizeChange(); | 562 TestFrameSizeChange(); |
| 529 } | 563 } |
| 530 | 564 |
| 531 #if defined(USE_PROPRIETARY_CODECS) | 565 #if defined(USE_PROPRIETARY_CODECS) |
| 532 // Crashes on Mac only. http://crbug.com/621857 | 566 // Crashes on Mac only. http://crbug.com/621857 |
| 533 #if defined(OS_MACOSX) | 567 #if defined(OS_MACOSX) |
| 534 #define MAYBE_Playback_VideoOnly_MP4 DISABLED_Playback_VideoOnly_MP4 | 568 #define MAYBE_Playback_VideoOnly_MP4 DISABLED_Playback_VideoOnly_MP4 |
| 535 #else | 569 #else |
| 536 #define MAYBE_Playback_VideoOnly_MP4 Playback_VideoOnly_MP4 | 570 #define MAYBE_Playback_VideoOnly_MP4 Playback_VideoOnly_MP4 |
| 537 #endif | 571 #endif |
| 538 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, MAYBE_Playback_VideoOnly_MP4) { | 572 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, MAYBE_Playback_VideoOnly_MP4) { |
| 539 // MP4 without MSE is not support yet, http://crbug.com/170793. | 573 // MP4 without MSE is not support yet, http://crbug.com/170793. |
| 540 if (CurrentSourceType() != MSE) { | 574 if (CurrentSourceType() != SrcType::MSE) { |
| 541 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; | 575 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; |
| 542 return; | 576 return; |
| 543 } | 577 } |
| 544 TestSimplePlayback("bear-640x360-v_frag-cenc.mp4", kMP4VideoOnly); | 578 TestSimplePlayback("bear-640x360-v_frag-cenc.mp4", kMP4VideoOnly); |
| 545 } | 579 } |
| 546 | 580 |
| 547 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_MP4) { | 581 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_MP4) { |
| 548 // MP4 without MSE is not support yet, http://crbug.com/170793. | 582 // MP4 without MSE is not support yet, http://crbug.com/170793. |
| 549 if (CurrentSourceType() != MSE) { | 583 if (CurrentSourceType() != SrcType::MSE) { |
| 550 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; | 584 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; |
| 551 return; | 585 return; |
| 552 } | 586 } |
| 553 TestSimplePlayback("bear-640x360-a_frag-cenc.mp4", kMP4AudioOnly); | 587 TestSimplePlayback("bear-640x360-a_frag-cenc.mp4", kMP4AudioOnly); |
| 554 } | 588 } |
| 555 | 589 |
| 556 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoOnly_MP4_VP9) { | 590 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoOnly_MP4_VP9) { |
| 557 // MP4 without MSE is not support yet, http://crbug.com/170793. | 591 // MP4 without MSE is not support yet, http://crbug.com/170793. |
| 558 if (CurrentSourceType() != MSE) { | 592 if (CurrentSourceType() != SrcType::MSE) { |
| 559 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; | 593 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; |
| 560 return; | 594 return; |
| 561 } | 595 } |
| 562 TestSimplePlayback("bear-320x240-v_frag-vp9-cenc.mp4", kMP4VideoVp9Only); | 596 TestSimplePlayback("bear-320x240-v_frag-vp9-cenc.mp4", kMP4VideoVp9Only); |
| 563 } | 597 } |
| 564 | 598 |
| 565 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, | 599 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, |
| 566 Playback_EncryptedVideo_MP4_ClearAudio_WEBM) { | 600 Playback_EncryptedVideo_MP4_ClearAudio_WEBM) { |
| 567 // MP4 without MSE is not support yet, http://crbug.com/170793. | 601 // MP4 without MSE is not support yet, http://crbug.com/170793. |
| 568 if (CurrentSourceType() != MSE) { | 602 if (CurrentSourceType() != SrcType::MSE) { |
| 569 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; | 603 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; |
| 570 return; | 604 return; |
| 571 } | 605 } |
| 572 if (!IsPlayBackPossible(CurrentKeySystem())) { | 606 if (!IsPlayBackPossible(CurrentKeySystem())) { |
| 573 DVLOG(0) << "Skipping test - Test requires video playback."; | 607 DVLOG(0) << "Skipping test - Test requires video playback."; |
| 574 return; | 608 return; |
| 575 } | 609 } |
| 576 TestDifferentContainers(EncryptedContainer::ENCRYPTED_MP4, | 610 TestDifferentContainers(EncryptedContainer::ENCRYPTED_MP4, |
| 577 EncryptedContainer::CLEAR_WEBM); | 611 EncryptedContainer::CLEAR_WEBM); |
| 578 } | 612 } |
| 579 | 613 |
| 580 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, | 614 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, |
| 581 Playback_ClearVideo_WEBM_EncryptedAudio_MP4) { | 615 Playback_ClearVideo_WEBM_EncryptedAudio_MP4) { |
| 582 // MP4 without MSE is not support yet, http://crbug.com/170793. | 616 // MP4 without MSE is not support yet, http://crbug.com/170793. |
| 583 if (CurrentSourceType() != MSE) { | 617 if (CurrentSourceType() != SrcType::MSE) { |
| 584 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; | 618 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; |
| 585 return; | 619 return; |
| 586 } | 620 } |
| 587 if (!IsPlayBackPossible(CurrentKeySystem())) { | 621 if (!IsPlayBackPossible(CurrentKeySystem())) { |
| 588 DVLOG(0) << "Skipping test - Test requires video playback."; | 622 DVLOG(0) << "Skipping test - Test requires video playback."; |
| 589 return; | 623 return; |
| 590 } | 624 } |
| 591 TestDifferentContainers(EncryptedContainer::CLEAR_WEBM, | 625 TestDifferentContainers(EncryptedContainer::CLEAR_WEBM, |
| 592 EncryptedContainer::ENCRYPTED_MP4); | 626 EncryptedContainer::ENCRYPTED_MP4); |
| 593 } | 627 } |
| 594 | 628 |
| 595 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, | 629 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, |
| 596 Playback_EncryptedVideo_WEBM_EncryptedAudio_MP4) { | 630 Playback_EncryptedVideo_WEBM_EncryptedAudio_MP4) { |
| 597 // MP4 without MSE is not support yet, http://crbug.com/170793. | 631 // MP4 without MSE is not support yet, http://crbug.com/170793. |
| 598 if (CurrentSourceType() != MSE) { | 632 if (CurrentSourceType() != SrcType::MSE) { |
| 599 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; | 633 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; |
| 600 return; | 634 return; |
| 601 } | 635 } |
| 602 if (!IsPlayBackPossible(CurrentKeySystem())) { | 636 if (!IsPlayBackPossible(CurrentKeySystem())) { |
| 603 DVLOG(0) << "Skipping test - Test requires video playback."; | 637 DVLOG(0) << "Skipping test - Test requires video playback."; |
| 604 return; | 638 return; |
| 605 } | 639 } |
| 606 TestDifferentContainers(EncryptedContainer::ENCRYPTED_WEBM, | 640 TestDifferentContainers(EncryptedContainer::ENCRYPTED_WEBM, |
| 607 EncryptedContainer::ENCRYPTED_MP4); | 641 EncryptedContainer::ENCRYPTED_MP4); |
| 608 } | 642 } |
| 609 #endif // defined(USE_PROPRIETARY_CODECS) | 643 #endif // defined(USE_PROPRIETARY_CODECS) |
| 610 | 644 |
| 611 #if defined(WIDEVINE_CDM_AVAILABLE) | 645 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 612 // The parent key system cannot be used when creating MediaKeys. | 646 // The parent key system cannot be used when creating MediaKeys. |
| 613 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException) { | 647 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException) { |
| 614 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm", | 648 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm", |
| 615 kWebMVorbisAudioOnly, "com.widevine", MSE, | 649 kWebMVorbisAudioOnly, "com.widevine", SrcType::MSE, |
| 616 kNoSessionToLoad, false, PlayTwice::NO, | 650 kNoSessionToLoad, false, PlayTwice::NO, |
| 617 kEmeNotSupportedError); | 651 kEmeNotSupportedError); |
| 618 } | 652 } |
| 619 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 653 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
| 620 | 654 |
| 621 #if BUILDFLAG(ENABLE_PEPPER_CDMS) | 655 #if BUILDFLAG(ENABLE_PEPPER_CDMS) |
| 622 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, InitializeCDMFail) { | 656 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, InitializeCDMFail) { |
| 623 TestNonPlaybackCases(kExternalClearKeyInitializeFailKeySystem, | 657 TestNonPlaybackCases(kExternalClearKeyInitializeFailKeySystem, |
| 624 kEmeNotSupportedError); | 658 kEmeNotSupportedError); |
| 625 } | 659 } |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 663 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { | 697 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { |
| 664 TestPlaybackCase(kExternalClearKeyKeySystem, kLoadableSession, kEnded); | 698 TestPlaybackCase(kExternalClearKeyKeySystem, kLoadableSession, kEnded); |
| 665 } | 699 } |
| 666 | 700 |
| 667 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { | 701 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { |
| 668 TestPlaybackCase(kExternalClearKeyKeySystem, kUnknownSession, | 702 TestPlaybackCase(kExternalClearKeyKeySystem, kUnknownSession, |
| 669 kEmeSessionNotFound); | 703 kEmeSessionNotFound); |
| 670 } | 704 } |
| 671 | 705 |
| 672 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) | 706 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) |
| OLD | NEW |