Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: chrome/browser/media/encrypted_media_browsertest.cc

Issue 2543623003: media: Allow config change between clear and encrypted streams (Closed)
Patch Set: comments addressed Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/media/media_browsertest.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "build/build_config.h" 12 #include "build/build_config.h"
12 #include "chrome/browser/media/media_browsertest.h" 13 #include "chrome/browser/media/media_browsertest.h"
13 #include "chrome/browser/media/test_license_server.h" 14 #include "chrome/browser/media/test_license_server.h"
14 #include "chrome/browser/media/wv_test_license_server_config.h" 15 #include "chrome/browser/media/wv_test_license_server_config.h"
15 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.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/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
(...skipping 16 matching lines...) Expand all
36 #endif 37 #endif
37 38
38 #if BUILDFLAG(ENABLE_PEPPER_CDMS) 39 #if BUILDFLAG(ENABLE_PEPPER_CDMS)
39 #include "chrome/browser/media/pepper_cdm_test_constants.h" 40 #include "chrome/browser/media/pepper_cdm_test_constants.h"
40 #include "chrome/browser/media/pepper_cdm_test_helper.h" 41 #include "chrome/browser/media/pepper_cdm_test_helper.h"
41 #include "media/base/media_switches.h" 42 #include "media/base/media_switches.h"
42 #endif 43 #endif
43 44
44 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 45 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
45 46
47 namespace chrome {
48
46 // Available key systems. 49 // Available key systems.
47 const char kClearKeyKeySystem[] = "org.w3.clearkey"; 50 const char kClearKeyKeySystem[] = "org.w3.clearkey";
48 const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; 51 const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey";
49 52
50 // Variants of External Clear Key key system to test different scenarios. 53 // Variants of External Clear Key key system to test different scenarios.
51 // To add a new variant, make sure you also update: 54 // To add a new variant, make sure you also update:
52 // - media/test/data/eme_player_js/globals.js 55 // - media/test/data/eme_player_js/globals.js
53 // - AddExternalClearKey() in chrome_key_systems.cc 56 // - AddExternalClearKey() in chrome_key_systems.cc
54 // - CreateCdmInstance() in clear_key_cdm.cc 57 // - CreateCdmInstance() in clear_key_cdm.cc
55 const char kExternalClearKeyRenewalKeySystem[] = 58 const char kExternalClearKeyRenewalKeySystem[] =
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 const char kEmeLoadFailed[] = "EME_LOAD_FAILED"; 97 const char kEmeLoadFailed[] = "EME_LOAD_FAILED";
95 const char kEmeUpdateFailed[] = "EME_UPDATE_FAILED"; 98 const char kEmeUpdateFailed[] = "EME_UPDATE_FAILED";
96 const char kEmeErrorEvent[] = "EME_ERROR_EVENT"; 99 const char kEmeErrorEvent[] = "EME_ERROR_EVENT";
97 const char kEmeMessageUnexpectedType[] = "EME_MESSAGE_UNEXPECTED_TYPE"; 100 const char kEmeMessageUnexpectedType[] = "EME_MESSAGE_UNEXPECTED_TYPE";
98 const char kEmeRenewalMissingHeader[] = "EME_RENEWAL_MISSING_HEADER"; 101 const char kEmeRenewalMissingHeader[] = "EME_RENEWAL_MISSING_HEADER";
99 const char kEmeSessionClosedAndError[] = "EME_SESSION_CLOSED_AND_ERROR"; 102 const char kEmeSessionClosedAndError[] = "EME_SESSION_CLOSED_AND_ERROR";
100 103
101 const char kDefaultEmePlayer[] = "eme_player.html"; 104 const char kDefaultEmePlayer[] = "eme_player.html";
102 105
103 // The type of video src used to load media. 106 // The type of video src used to load media.
104 enum SrcType { 107 enum class SrcType { SRC, MSE };
105 SRC, 108
106 MSE 109 // Must be in sync with CONFIG_CHANGE_TYPE in eme_player_js/global.js
110 enum class ConfigChangeType {
111 CLEAR_TO_CLEAR = 0,
112 CLEAR_TO_ENCRYPTED = 1,
113 ENCRYPTED_TO_CLEAR = 2,
114 ENCRYPTED_TO_ENCRYPTED = 3,
107 }; 115 };
108 116
109 // Whether the video should be played once or twice. 117 // Whether the video should be played once or twice.
110 enum class PlayCount { ONCE, TWICE }; 118 enum class PlayCount { ONCE, TWICE };
111 119
112 // Format of a container when testing different streams. 120 // Format of a container when testing different streams.
113 enum class EncryptedContainer { 121 enum class EncryptedContainer {
114 CLEAR_WEBM, 122 CLEAR_WEBM,
115 CLEAR_MP4, 123 CLEAR_MP4,
116 ENCRYPTED_WEBM, 124 ENCRYPTED_WEBM,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 const std::string& key_system, 165 const std::string& key_system,
158 SrcType src_type, 166 SrcType src_type,
159 const std::string& session_to_load, 167 const std::string& session_to_load,
160 bool force_invalid_response, 168 bool force_invalid_response,
161 PlayCount play_count, 169 PlayCount play_count,
162 const std::string& expected_title) { 170 const std::string& expected_title) {
163 base::StringPairs query_params; 171 base::StringPairs query_params;
164 query_params.push_back(std::make_pair("mediaFile", media_file)); 172 query_params.push_back(std::make_pair("mediaFile", media_file));
165 query_params.push_back(std::make_pair("mediaType", media_type)); 173 query_params.push_back(std::make_pair("mediaType", media_type));
166 query_params.push_back(std::make_pair("keySystem", key_system)); 174 query_params.push_back(std::make_pair("keySystem", key_system));
167 if (src_type == MSE) 175 if (src_type == SrcType::MSE)
168 query_params.push_back(std::make_pair("useMSE", "1")); 176 query_params.push_back(std::make_pair("useMSE", "1"));
169 if (force_invalid_response) 177 if (force_invalid_response)
170 query_params.push_back(std::make_pair("forceInvalidResponse", "1")); 178 query_params.push_back(std::make_pair("forceInvalidResponse", "1"));
171 if (!session_to_load.empty()) 179 if (!session_to_load.empty())
172 query_params.push_back(std::make_pair("sessionToLoad", session_to_load)); 180 query_params.push_back(std::make_pair("sessionToLoad", session_to_load));
173 if (play_count == PlayCount::TWICE) 181 if (play_count == PlayCount::TWICE)
174 query_params.push_back(std::make_pair("playTwice", "1")); 182 query_params.push_back(std::make_pair("playTwice", "1"));
175 RunEncryptedMediaTestPage(html_page, key_system, query_params, 183 RunEncryptedMediaTestPage(html_page, key_system, query_params,
176 expected_title); 184 expected_title);
177 } 185 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 // decrypt-and-decode mode. 302 // decrypt-and-decode mode.
295 class ECKEncryptedMediaTest : public EncryptedMediaTestBase { 303 class ECKEncryptedMediaTest : public EncryptedMediaTestBase {
296 public: 304 public:
297 // We use special |key_system| names to do non-playback related tests, e.g. 305 // We use special |key_system| names to do non-playback related tests, e.g.
298 // kExternalClearKeyFileIOTestKeySystem is used to test file IO. 306 // kExternalClearKeyFileIOTestKeySystem is used to test file IO.
299 void TestNonPlaybackCases(const std::string& key_system, 307 void TestNonPlaybackCases(const std::string& key_system,
300 const std::string& expected_title) { 308 const std::string& expected_title) {
301 // Since we do not test playback, arbitrarily choose a test file and source 309 // Since we do not test playback, arbitrarily choose a test file and source
302 // type. 310 // type.
303 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm", 311 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm",
304 kWebMVorbisAudioOnly, key_system, SRC, 312 kWebMVorbisAudioOnly, key_system, SrcType::SRC,
305 kNoSessionToLoad, false, PlayCount::ONCE, 313 kNoSessionToLoad, false, PlayCount::ONCE,
306 expected_title); 314 expected_title);
307 } 315 }
308 316
309 void TestPlaybackCase(const std::string& key_system, 317 void TestPlaybackCase(const std::string& key_system,
310 const std::string& session_to_load, 318 const std::string& session_to_load,
311 const std::string& expected_title) { 319 const std::string& expected_title) {
312 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-320x240-v_enc-v.webm", 320 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-320x240-v_enc-v.webm",
313 kWebMVP8VideoOnly, key_system, SRC, session_to_load, 321 kWebMVP8VideoOnly, key_system, SrcType::SRC,
314 false, PlayCount::ONCE, expected_title); 322 session_to_load, false, PlayCount::ONCE,
323 expected_title);
315 } 324 }
316 325
317 protected: 326 protected:
318 void SetUpCommandLine(base::CommandLine* command_line) override { 327 void SetUpCommandLine(base::CommandLine* command_line) override {
319 EncryptedMediaTestBase::SetUpCommandLine(command_line); 328 EncryptedMediaTestBase::SetUpCommandLine(command_line);
320 SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, command_line); 329 SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, command_line);
321 } 330 }
322 }; 331 };
323 332
324 #if defined(WIDEVINE_CDM_AVAILABLE) 333 #if defined(WIDEVINE_CDM_AVAILABLE)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 PlayCount::ONCE, kEmeUpdateFailed); 383 PlayCount::ONCE, kEmeUpdateFailed);
375 } 384 }
376 385
377 void TestFrameSizeChange() { 386 void TestFrameSizeChange() {
378 RunEncryptedMediaTest( 387 RunEncryptedMediaTest(
379 "encrypted_frame_size_change.html", "frame_size_change-av_enc-v.webm", 388 "encrypted_frame_size_change.html", "frame_size_change-av_enc-v.webm",
380 kWebMVorbisAudioVP8Video, CurrentKeySystem(), CurrentSourceType(), 389 kWebMVorbisAudioVP8Video, CurrentKeySystem(), CurrentSourceType(),
381 kNoSessionToLoad, false, PlayCount::ONCE, kEnded); 390 kNoSessionToLoad, false, PlayCount::ONCE, kEnded);
382 } 391 }
383 392
384 void TestConfigChange() { 393 void TestConfigChange(ConfigChangeType config_change_type) {
394 // TODO(xhwang): Even when config change or playback is not supported we
ddorwin 2017/02/16 20:26:21 bug #?
xhwang 2017/02/17 00:47:20 Done.
395 // still start chrome only to return directly here. We probably should not
ddorwin 2017/02/16 20:26:21 nit: Chrome
xhwang 2017/02/17 00:47:20 Done.
396 // run these test cases at all.
397 if (CurrentSourceType() != SrcType::MSE) {
398 DVLOG(0) << "Config change only happens when using MSE.";
399 return;
400 }
401 if (!IsPlayBackPossible(CurrentKeySystem())) {
402 DVLOG(0) << "Skipping test - ConfigChange test requires video playback.";
403 return;
404 }
405
385 base::StringPairs query_params; 406 base::StringPairs query_params;
386 query_params.push_back(std::make_pair("keySystem", CurrentKeySystem())); 407 query_params.push_back(std::make_pair("keySystem", CurrentKeySystem()));
387 query_params.push_back(std::make_pair("runEncrypted", "1")); 408 query_params.push_back(std::make_pair(
388 RunEncryptedMediaTestPage("mse_config_change.html", 409 "configChangeType",
389 CurrentKeySystem(), 410 base::IntToString(static_cast<int>(config_change_type))));
390 query_params, 411 RunEncryptedMediaTestPage("mse_config_change.html", CurrentKeySystem(),
391 kEnded); 412 query_params, kEnded);
392 } 413 }
393 414
394 std::string ConvertContainerFormat(EncryptedContainer format) { 415 std::string ConvertContainerFormat(EncryptedContainer format) {
395 switch (format) { 416 switch (format) {
396 case EncryptedContainer::CLEAR_MP4: 417 case EncryptedContainer::CLEAR_MP4:
397 return "CLEAR_MP4"; 418 return "CLEAR_MP4";
398 case EncryptedContainer::CLEAR_WEBM: 419 case EncryptedContainer::CLEAR_WEBM:
399 return "CLEAR_WEBM"; 420 return "CLEAR_WEBM";
400 case EncryptedContainer::ENCRYPTED_MP4: 421 case EncryptedContainer::ENCRYPTED_MP4:
401 return "ENCRYPTED_MP4"; 422 return "ENCRYPTED_MP4";
(...skipping 28 matching lines...) Expand all
430 SetUpCommandLineForKeySystem(CurrentKeySystem(), command_line); 451 SetUpCommandLineForKeySystem(CurrentKeySystem(), command_line);
431 } 452 }
432 }; 453 };
433 454
434 using ::testing::Combine; 455 using ::testing::Combine;
435 using ::testing::Values; 456 using ::testing::Values;
436 457
437 #if !defined(OS_ANDROID) 458 #if !defined(OS_ANDROID)
438 INSTANTIATE_TEST_CASE_P(SRC_ClearKey, 459 INSTANTIATE_TEST_CASE_P(SRC_ClearKey,
439 EncryptedMediaTest, 460 EncryptedMediaTest,
440 Combine(Values(kClearKeyKeySystem), Values(SRC))); 461 Combine(Values(kClearKeyKeySystem),
462 Values(SrcType::SRC)));
441 #endif // !defined(OS_ANDROID) 463 #endif // !defined(OS_ANDROID)
442 464
443 INSTANTIATE_TEST_CASE_P(MSE_ClearKey, 465 INSTANTIATE_TEST_CASE_P(MSE_ClearKey,
444 EncryptedMediaTest, 466 EncryptedMediaTest,
445 Combine(Values(kClearKeyKeySystem), Values(MSE))); 467 Combine(Values(kClearKeyKeySystem),
468 Values(SrcType::MSE)));
446 469
447 // External Clear Key is currently only used on platforms that use Pepper CDMs. 470 // External Clear Key is currently only used on platforms that use Pepper CDMs.
448 #if BUILDFLAG(ENABLE_PEPPER_CDMS) 471 #if BUILDFLAG(ENABLE_PEPPER_CDMS)
449 INSTANTIATE_TEST_CASE_P(SRC_ExternalClearKey, 472 INSTANTIATE_TEST_CASE_P(SRC_ExternalClearKey,
450 EncryptedMediaTest, 473 EncryptedMediaTest,
451 Combine(Values(kExternalClearKeyKeySystem), 474 Combine(Values(kExternalClearKeyKeySystem),
452 Values(SRC))); 475 Values(SrcType::SRC)));
453 476
454 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey, 477 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKey,
455 EncryptedMediaTest, 478 EncryptedMediaTest,
456 Combine(Values(kExternalClearKeyKeySystem), 479 Combine(Values(kExternalClearKeyKeySystem),
457 Values(MSE))); 480 Values(SrcType::MSE)));
458 481
459 const char kExternalClearKeyDecryptOnlyKeySystem[] = 482 const char kExternalClearKeyDecryptOnlyKeySystem[] =
460 "org.chromium.externalclearkey.decryptonly"; 483 "org.chromium.externalclearkey.decryptonly";
461 484
462 // To reduce test time, only run ExternalClearKeyDecryptOnly with MSE. 485 // To reduce test time, only run ExternalClearKeyDecryptOnly with MSE.
463 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKeyDecryptOnly, 486 INSTANTIATE_TEST_CASE_P(MSE_ExternalClearKeyDecryptOnly,
464 EncryptedMediaTest, 487 EncryptedMediaTest,
465 Combine(Values(kExternalClearKeyDecryptOnlyKeySystem), 488 Combine(Values(kExternalClearKeyDecryptOnlyKeySystem),
466 Values(MSE))); 489 Values(SrcType::MSE)));
467 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) 490 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS)
468 491
469 #if defined(WIDEVINE_CDM_AVAILABLE) 492 #if defined(WIDEVINE_CDM_AVAILABLE)
470 #if !defined(OS_CHROMEOS) 493 #if !defined(OS_CHROMEOS)
471 INSTANTIATE_TEST_CASE_P(MSE_Widevine, 494 INSTANTIATE_TEST_CASE_P(MSE_Widevine,
472 EncryptedMediaTest, 495 EncryptedMediaTest,
473 Combine(Values(kWidevineKeySystem), Values(MSE))); 496 Combine(Values(kWidevineKeySystem),
497 Values(SrcType::MSE)));
474 #endif // !defined(OS_CHROMEOS) 498 #endif // !defined(OS_CHROMEOS)
475 #endif // defined(WIDEVINE_CDM_AVAILABLE) 499 #endif // defined(WIDEVINE_CDM_AVAILABLE)
476 500
477 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) { 501 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_WebM) {
478 TestSimplePlayback("bear-a_enc-a.webm", kWebMVorbisAudioOnly); 502 TestSimplePlayback("bear-a_enc-a.webm", kWebMVorbisAudioOnly);
479 } 503 }
480 504
481 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioClearVideo_WebM) { 505 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioClearVideo_WebM) {
482 TestSimplePlayback("bear-320x240-av_enc-a.webm", kWebMVorbisAudioVP8Video); 506 TestSimplePlayback("bear-320x240-av_enc-a.webm", kWebMVorbisAudioVP8Video);
483 } 507 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 DVLOG(0) << "Skipping test - Playback_Multiple test requires playback."; 546 DVLOG(0) << "Skipping test - Playback_Multiple test requires playback.";
523 return; 547 return;
524 } 548 }
525 TestMultiplePlayback("bear-320x240-av_enc-av.webm", kWebMVorbisAudioVP8Video); 549 TestMultiplePlayback("bear-320x240-av_enc-av.webm", kWebMVorbisAudioVP8Video);
526 } 550 }
527 551
528 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, InvalidResponseKeyError) { 552 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, InvalidResponseKeyError) {
529 RunInvalidResponseTest(); 553 RunInvalidResponseTest();
530 } 554 }
531 555
532 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, ConfigChangeVideo) { 556 // Strictly speaking this is not an "encrypted" media test. Keep it here for
533 if (!IsPlayBackPossible(CurrentKeySystem())) { 557 // completeness.
534 DVLOG(0) << "Skipping test - ConfigChange test requires video playback."; 558 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, ConfigChangeVideo_ClearToClear) {
535 return; 559 TestConfigChange(ConfigChangeType::CLEAR_TO_CLEAR);
536 } 560 }
537 TestConfigChange(); 561
562 // TODO(xhwang): Support switching from clear to encrypted and fix the test
563 // expectation. Currently this test passes when we do decrypt-and-decode but
564 // fails when we do decrypt-only due to how decoder reselection during config
565 // change is handled. See http://crbug.com/597443
566 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest,
567 DISABLED_ConfigChangeVideo_ClearToEncrypted) {
568 TestConfigChange(ConfigChangeType::CLEAR_TO_ENCRYPTED);
569 }
570
571 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, ConfigChangeVideo_EncryptedToClear) {
572 TestConfigChange(ConfigChangeType::ENCRYPTED_TO_CLEAR);
573 }
574
575 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest,
576 ConfigChangeVideo_EncryptedToEncrypted) {
577 TestConfigChange(ConfigChangeType::ENCRYPTED_TO_ENCRYPTED);
538 } 578 }
539 579
540 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, FrameSizeChangeVideo) { 580 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, FrameSizeChangeVideo) {
541 if (!IsPlayBackPossible(CurrentKeySystem())) { 581 if (!IsPlayBackPossible(CurrentKeySystem())) {
542 DVLOG(0) << "Skipping test - FrameSizeChange test requires video playback."; 582 DVLOG(0) << "Skipping test - FrameSizeChange test requires video playback.";
543 return; 583 return;
544 } 584 }
545 TestFrameSizeChange(); 585 TestFrameSizeChange();
546 } 586 }
547 587
(...skipping 12 matching lines...) Expand all
560 600
561 #if BUILDFLAG(USE_PROPRIETARY_CODECS) 601 #if BUILDFLAG(USE_PROPRIETARY_CODECS)
562 // Crashes on Mac only. http://crbug.com/621857 602 // Crashes on Mac only. http://crbug.com/621857
563 #if defined(OS_MACOSX) 603 #if defined(OS_MACOSX)
564 #define MAYBE_Playback_VideoOnly_MP4 DISABLED_Playback_VideoOnly_MP4 604 #define MAYBE_Playback_VideoOnly_MP4 DISABLED_Playback_VideoOnly_MP4
565 #else 605 #else
566 #define MAYBE_Playback_VideoOnly_MP4 Playback_VideoOnly_MP4 606 #define MAYBE_Playback_VideoOnly_MP4 Playback_VideoOnly_MP4
567 #endif 607 #endif
568 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, MAYBE_Playback_VideoOnly_MP4) { 608 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, MAYBE_Playback_VideoOnly_MP4) {
569 // MP4 without MSE is not support yet, http://crbug.com/170793. 609 // MP4 without MSE is not support yet, http://crbug.com/170793.
570 if (CurrentSourceType() != MSE) { 610 if (CurrentSourceType() != SrcType::MSE) {
571 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; 611 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE.";
572 return; 612 return;
573 } 613 }
574 TestSimplePlayback("bear-640x360-v_frag-cenc.mp4", kMP4VideoOnly); 614 TestSimplePlayback("bear-640x360-v_frag-cenc.mp4", kMP4VideoOnly);
575 } 615 }
576 616
577 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_MP4) { 617 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_MP4) {
578 // MP4 without MSE is not support yet, http://crbug.com/170793. 618 // MP4 without MSE is not support yet, http://crbug.com/170793.
579 if (CurrentSourceType() != MSE) { 619 if (CurrentSourceType() != SrcType::MSE) {
580 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; 620 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE.";
581 return; 621 return;
582 } 622 }
583 TestSimplePlayback("bear-640x360-a_frag-cenc.mp4", kMP4AudioOnly); 623 TestSimplePlayback("bear-640x360-a_frag-cenc.mp4", kMP4AudioOnly);
584 } 624 }
585 625
586 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoOnly_MP4_VP9) { 626 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoOnly_MP4_VP9) {
587 // MP4 without MSE is not support yet, http://crbug.com/170793. 627 // MP4 without MSE is not support yet, http://crbug.com/170793.
588 if (CurrentSourceType() != MSE) { 628 if (CurrentSourceType() != SrcType::MSE) {
589 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; 629 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE.";
590 return; 630 return;
591 } 631 }
592 TestSimplePlayback("bear-320x240-v_frag-vp9-cenc.mp4", kMP4VideoVp9Only); 632 TestSimplePlayback("bear-320x240-v_frag-vp9-cenc.mp4", kMP4VideoVp9Only);
593 } 633 }
594 634
595 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, 635 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest,
596 Playback_EncryptedVideo_MP4_ClearAudio_WEBM) { 636 Playback_EncryptedVideo_MP4_ClearAudio_WEBM) {
597 // MP4 without MSE is not support yet, http://crbug.com/170793. 637 // MP4 without MSE is not support yet, http://crbug.com/170793.
598 if (CurrentSourceType() != MSE) { 638 if (CurrentSourceType() != SrcType::MSE) {
599 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; 639 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE.";
600 return; 640 return;
601 } 641 }
602 if (!IsPlayBackPossible(CurrentKeySystem())) { 642 if (!IsPlayBackPossible(CurrentKeySystem())) {
603 DVLOG(0) << "Skipping test - Test requires video playback."; 643 DVLOG(0) << "Skipping test - Test requires video playback.";
604 return; 644 return;
605 } 645 }
606 TestDifferentContainers(EncryptedContainer::ENCRYPTED_MP4, 646 TestDifferentContainers(EncryptedContainer::ENCRYPTED_MP4,
607 EncryptedContainer::CLEAR_WEBM); 647 EncryptedContainer::CLEAR_WEBM);
608 } 648 }
609 649
610 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, 650 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest,
611 Playback_ClearVideo_WEBM_EncryptedAudio_MP4) { 651 Playback_ClearVideo_WEBM_EncryptedAudio_MP4) {
612 // MP4 without MSE is not support yet, http://crbug.com/170793. 652 // MP4 without MSE is not support yet, http://crbug.com/170793.
613 if (CurrentSourceType() != MSE) { 653 if (CurrentSourceType() != SrcType::MSE) {
614 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; 654 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE.";
615 return; 655 return;
616 } 656 }
617 if (!IsPlayBackPossible(CurrentKeySystem())) { 657 if (!IsPlayBackPossible(CurrentKeySystem())) {
618 DVLOG(0) << "Skipping test - Test requires video playback."; 658 DVLOG(0) << "Skipping test - Test requires video playback.";
619 return; 659 return;
620 } 660 }
621 TestDifferentContainers(EncryptedContainer::CLEAR_WEBM, 661 TestDifferentContainers(EncryptedContainer::CLEAR_WEBM,
622 EncryptedContainer::ENCRYPTED_MP4); 662 EncryptedContainer::ENCRYPTED_MP4);
623 } 663 }
624 664
625 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, 665 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest,
626 Playback_EncryptedVideo_WEBM_EncryptedAudio_MP4) { 666 Playback_EncryptedVideo_WEBM_EncryptedAudio_MP4) {
627 // MP4 without MSE is not support yet, http://crbug.com/170793. 667 // MP4 without MSE is not support yet, http://crbug.com/170793.
628 if (CurrentSourceType() != MSE) { 668 if (CurrentSourceType() != SrcType::MSE) {
629 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; 669 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE.";
630 return; 670 return;
631 } 671 }
632 if (!IsPlayBackPossible(CurrentKeySystem())) { 672 if (!IsPlayBackPossible(CurrentKeySystem())) {
633 DVLOG(0) << "Skipping test - Test requires video playback."; 673 DVLOG(0) << "Skipping test - Test requires video playback.";
634 return; 674 return;
635 } 675 }
636 TestDifferentContainers(EncryptedContainer::ENCRYPTED_WEBM, 676 TestDifferentContainers(EncryptedContainer::ENCRYPTED_WEBM,
637 EncryptedContainer::ENCRYPTED_MP4); 677 EncryptedContainer::ENCRYPTED_MP4);
638 } 678 }
639 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) 679 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
640 680
641 #if defined(WIDEVINE_CDM_AVAILABLE) 681 #if defined(WIDEVINE_CDM_AVAILABLE)
642 // The parent key system cannot be used when creating MediaKeys. 682 // The parent key system cannot be used when creating MediaKeys.
643 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException) { 683 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException) {
644 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm", 684 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm",
645 kWebMVorbisAudioOnly, "com.widevine", MSE, 685 kWebMVorbisAudioOnly, "com.widevine", SrcType::MSE,
646 kNoSessionToLoad, false, PlayCount::ONCE, 686 kNoSessionToLoad, false, PlayCount::ONCE,
647 kEmeNotSupportedError); 687 kEmeNotSupportedError);
648 } 688 }
649 #endif // defined(WIDEVINE_CDM_AVAILABLE) 689 #endif // defined(WIDEVINE_CDM_AVAILABLE)
650 690
651 #if BUILDFLAG(ENABLE_PEPPER_CDMS) 691 #if BUILDFLAG(ENABLE_PEPPER_CDMS)
652 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, InitializeCDMFail) { 692 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, InitializeCDMFail) {
653 TestNonPlaybackCases(kExternalClearKeyInitializeFailKeySystem, 693 TestNonPlaybackCases(kExternalClearKeyInitializeFailKeySystem,
654 kEmeNotSupportedError); 694 kEmeNotSupportedError);
655 } 695 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 TestPlaybackCase(kExternalClearKeyKeySystem, kUnknownSession, 738 TestPlaybackCase(kExternalClearKeyKeySystem, kUnknownSession,
699 kEmeSessionNotFound); 739 kEmeSessionNotFound);
700 } 740 }
701 741
702 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, VerifyCdmHostTest) { 742 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, VerifyCdmHostTest) {
703 TestNonPlaybackCases(kExternalClearKeyVerifyCdmHostTestKeySystem, 743 TestNonPlaybackCases(kExternalClearKeyVerifyCdmHostTestKeySystem,
704 kUnitTestSuccess); 744 kUnitTestSuccess);
705 } 745 }
706 746
707 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) 747 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS)
748
749 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/media/media_browsertest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698