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