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