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" |
11 #include "base/win/windows_version.h" | 11 #include "base/win/windows_version.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "chrome/browser/media/media_browsertest.h" | 13 #include "chrome/browser/media/media_browsertest.h" |
14 #include "chrome/browser/media/test_license_server.h" | 14 #include "chrome/browser/media/test_license_server.h" |
15 #include "chrome/browser/media/wv_test_license_server_config.h" | 15 #include "chrome/browser/media/wv_test_license_server_config.h" |
16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/test/base/test_launcher_utils.h" | 19 #include "chrome/test/base/test_launcher_utils.h" |
20 #include "content/public/common/content_switches.h" | 20 #include "content/public/common/content_switches.h" |
21 #include "content/public/test/browser_test_utils.h" | 21 #include "content/public/test/browser_test_utils.h" |
22 #include "media/base/media_switches.h" | 22 #include "media/base/media_switches.h" |
| 23 #include "media/media_features.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" |
(...skipping 24 matching lines...) Expand all Loading... |
57 const char kExternalClearKeyCrashKeySystem[] = | 58 const char kExternalClearKeyCrashKeySystem[] = |
58 "org.chromium.externalclearkey.crash"; | 59 "org.chromium.externalclearkey.crash"; |
59 | 60 |
60 // Supported media types. | 61 // Supported media types. |
61 const char kWebMVorbisAudioOnly[] = "audio/webm; codecs=\"vorbis\""; | 62 const char kWebMVorbisAudioOnly[] = "audio/webm; codecs=\"vorbis\""; |
62 const char kWebMOpusAudioOnly[] = "audio/webm; codecs=\"opus\""; | 63 const char kWebMOpusAudioOnly[] = "audio/webm; codecs=\"opus\""; |
63 const char kWebMVP8VideoOnly[] = "video/webm; codecs=\"vp8\""; | 64 const char kWebMVP8VideoOnly[] = "video/webm; codecs=\"vp8\""; |
64 const char kWebMVorbisAudioVP8Video[] = "video/webm; codecs=\"vorbis, vp8\""; | 65 const char kWebMVorbisAudioVP8Video[] = "video/webm; codecs=\"vorbis, vp8\""; |
65 const char kWebMOpusAudioVP9Video[] = "video/webm; codecs=\"opus, vp9\""; | 66 const char kWebMOpusAudioVP9Video[] = "video/webm; codecs=\"opus, vp9\""; |
66 const char kWebMVP9VideoOnly[] = "video/webm; codecs=\"vp9\""; | 67 const char kWebMVP9VideoOnly[] = "video/webm; codecs=\"vp9\""; |
67 #if defined(USE_PROPRIETARY_CODECS) | 68 #if BUILDFLAG(USE_PROPRIETARY_CODECS) |
68 const char kMP4AudioOnly[] = "audio/mp4; codecs=\"mp4a.40.2\""; | 69 const char kMP4AudioOnly[] = "audio/mp4; codecs=\"mp4a.40.2\""; |
69 const char kMP4VideoOnly[] = "video/mp4; codecs=\"avc1.4D000C\""; | 70 const char kMP4VideoOnly[] = "video/mp4; codecs=\"avc1.4D000C\""; |
70 const char kMP4VideoVp9Only[] = | 71 const char kMP4VideoVp9Only[] = |
71 "video/mp4; codecs=\"vp09.00.01.08.02.01.01.00\""; | 72 "video/mp4; codecs=\"vp09.00.01.08.02.01.01.00\""; |
72 #endif // defined(USE_PROPRIETARY_CODECS) | 73 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) |
73 | 74 |
74 // Sessions to load. | 75 // Sessions to load. |
75 const char kNoSessionToLoad[] = ""; | 76 const char kNoSessionToLoad[] = ""; |
76 const char kLoadableSession[] = "LoadableSession"; | 77 const char kLoadableSession[] = "LoadableSession"; |
77 const char kUnknownSession[] = "UnknownSession"; | 78 const char kUnknownSession[] = "UnknownSession"; |
78 | 79 |
79 // EME-specific test results and errors. | 80 // EME-specific test results and errors. |
80 const char kUnitTestSuccess[] = "UNIT_TEST_SUCCESS"; | 81 const char kUnitTestSuccess[] = "UNIT_TEST_SUCCESS"; |
81 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR"; | 82 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR"; |
82 const char kEmeGenerateRequestFailed[] = "EME_GENERATEREQUEST_FAILED"; | 83 const char kEmeGenerateRequestFailed[] = "EME_GENERATEREQUEST_FAILED"; |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 } | 522 } |
522 | 523 |
523 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, FrameSizeChangeVideo) { | 524 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, FrameSizeChangeVideo) { |
524 if (!IsPlayBackPossible(CurrentKeySystem())) { | 525 if (!IsPlayBackPossible(CurrentKeySystem())) { |
525 DVLOG(0) << "Skipping test - FrameSizeChange test requires video playback."; | 526 DVLOG(0) << "Skipping test - FrameSizeChange test requires video playback."; |
526 return; | 527 return; |
527 } | 528 } |
528 TestFrameSizeChange(); | 529 TestFrameSizeChange(); |
529 } | 530 } |
530 | 531 |
531 #if defined(USE_PROPRIETARY_CODECS) | 532 #if BUILDFLAG(USE_PROPRIETARY_CODECS) |
532 // Crashes on Mac only. http://crbug.com/621857 | 533 // Crashes on Mac only. http://crbug.com/621857 |
533 #if defined(OS_MACOSX) | 534 #if defined(OS_MACOSX) |
534 #define MAYBE_Playback_VideoOnly_MP4 DISABLED_Playback_VideoOnly_MP4 | 535 #define MAYBE_Playback_VideoOnly_MP4 DISABLED_Playback_VideoOnly_MP4 |
535 #else | 536 #else |
536 #define MAYBE_Playback_VideoOnly_MP4 Playback_VideoOnly_MP4 | 537 #define MAYBE_Playback_VideoOnly_MP4 Playback_VideoOnly_MP4 |
537 #endif | 538 #endif |
538 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, MAYBE_Playback_VideoOnly_MP4) { | 539 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, MAYBE_Playback_VideoOnly_MP4) { |
539 // MP4 without MSE is not support yet, http://crbug.com/170793. | 540 // MP4 without MSE is not support yet, http://crbug.com/170793. |
540 if (CurrentSourceType() != MSE) { | 541 if (CurrentSourceType() != MSE) { |
541 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; | 542 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; | 600 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; |
600 return; | 601 return; |
601 } | 602 } |
602 if (!IsPlayBackPossible(CurrentKeySystem())) { | 603 if (!IsPlayBackPossible(CurrentKeySystem())) { |
603 DVLOG(0) << "Skipping test - Test requires video playback."; | 604 DVLOG(0) << "Skipping test - Test requires video playback."; |
604 return; | 605 return; |
605 } | 606 } |
606 TestDifferentContainers(EncryptedContainer::ENCRYPTED_WEBM, | 607 TestDifferentContainers(EncryptedContainer::ENCRYPTED_WEBM, |
607 EncryptedContainer::ENCRYPTED_MP4); | 608 EncryptedContainer::ENCRYPTED_MP4); |
608 } | 609 } |
609 #endif // defined(USE_PROPRIETARY_CODECS) | 610 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) |
610 | 611 |
611 #if defined(WIDEVINE_CDM_AVAILABLE) | 612 #if defined(WIDEVINE_CDM_AVAILABLE) |
612 // The parent key system cannot be used when creating MediaKeys. | 613 // The parent key system cannot be used when creating MediaKeys. |
613 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException) { | 614 IN_PROC_BROWSER_TEST_F(WVEncryptedMediaTest, ParentThrowsException) { |
614 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm", | 615 RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm", |
615 kWebMVorbisAudioOnly, "com.widevine", MSE, | 616 kWebMVorbisAudioOnly, "com.widevine", MSE, |
616 kNoSessionToLoad, false, PlayTwice::NO, | 617 kNoSessionToLoad, false, PlayTwice::NO, |
617 kEmeNotSupportedError); | 618 kEmeNotSupportedError); |
618 } | 619 } |
619 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 620 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { | 664 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { |
664 TestPlaybackCase(kExternalClearKeyKeySystem, kLoadableSession, kEnded); | 665 TestPlaybackCase(kExternalClearKeyKeySystem, kLoadableSession, kEnded); |
665 } | 666 } |
666 | 667 |
667 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { | 668 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { |
668 TestPlaybackCase(kExternalClearKeyKeySystem, kUnknownSession, | 669 TestPlaybackCase(kExternalClearKeyKeySystem, kUnknownSession, |
669 kEmeSessionNotFound); | 670 kEmeSessionNotFound); |
670 } | 671 } |
671 | 672 |
672 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) | 673 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) |
OLD | NEW |