| 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 "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 BUILDFLAG(ENABLE_PEPPER_CDMS) | 30 #if BUILDFLAG(ENABLE_PEPPER_CDMS) |
| 30 #include "chrome/browser/media/pepper_cdm_test_constants.h" | 31 #include "chrome/browser/media/pepper_cdm_test_constants.h" |
| 31 #include "chrome/browser/media/pepper_cdm_test_helper.h" | 32 #include "chrome/browser/media/pepper_cdm_test_helper.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 59 // Supported media types. | 60 // Supported media types. |
| 60 const char kWebMVorbisAudioOnly[] = "audio/webm; codecs=\"vorbis\""; | 61 const char kWebMVorbisAudioOnly[] = "audio/webm; codecs=\"vorbis\""; |
| 61 const char kWebMOpusAudioOnly[] = "audio/webm; codecs=\"opus\""; | 62 const char kWebMOpusAudioOnly[] = "audio/webm; codecs=\"opus\""; |
| 62 const char kWebMVP8VideoOnly[] = "video/webm; codecs=\"vp8\""; | 63 const char kWebMVP8VideoOnly[] = "video/webm; codecs=\"vp8\""; |
| 63 const char kWebMVorbisAudioVP8Video[] = "video/webm; codecs=\"vorbis, vp8\""; | 64 const char kWebMVorbisAudioVP8Video[] = "video/webm; codecs=\"vorbis, vp8\""; |
| 64 const char kWebMOpusAudioVP9Video[] = "video/webm; codecs=\"opus, vp9\""; | 65 const char kWebMOpusAudioVP9Video[] = "video/webm; codecs=\"opus, vp9\""; |
| 65 const char kWebMVP9VideoOnly[] = "video/webm; codecs=\"vp9\""; | 66 const char kWebMVP9VideoOnly[] = "video/webm; codecs=\"vp9\""; |
| 66 #if defined(USE_PROPRIETARY_CODECS) | 67 #if defined(USE_PROPRIETARY_CODECS) |
| 67 const char kMP4AudioOnly[] = "audio/mp4; codecs=\"mp4a.40.2\""; | 68 const char kMP4AudioOnly[] = "audio/mp4; codecs=\"mp4a.40.2\""; |
| 68 const char kMP4VideoOnly[] = "video/mp4; codecs=\"avc1.4D000C\""; | 69 const char kMP4VideoOnly[] = "video/mp4; codecs=\"avc1.4D000C\""; |
| 70 const char kMP4VideoVp9Only[] = |
| 71 "video/mp4; codecs=\"vp09.00.01.08.02.01.01.00\""; |
| 69 #endif // defined(USE_PROPRIETARY_CODECS) | 72 #endif // defined(USE_PROPRIETARY_CODECS) |
| 70 | 73 |
| 71 // Sessions to load. | 74 // Sessions to load. |
| 72 const char kNoSessionToLoad[] = ""; | 75 const char kNoSessionToLoad[] = ""; |
| 73 const char kLoadableSession[] = "LoadableSession"; | 76 const char kLoadableSession[] = "LoadableSession"; |
| 74 const char kUnknownSession[] = "UnknownSession"; | 77 const char kUnknownSession[] = "UnknownSession"; |
| 75 | 78 |
| 76 // EME-specific test results and errors. | 79 // EME-specific test results and errors. |
| 77 const char kUnitTestSuccess[] = "UNIT_TEST_SUCCESS"; | 80 const char kUnitTestSuccess[] = "UNIT_TEST_SUCCESS"; |
| 78 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR"; | 81 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR"; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeErrorEvent)); | 238 title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(kEmeErrorEvent)); |
| 236 title_watcher->AlsoWaitForTitle( | 239 title_watcher->AlsoWaitForTitle( |
| 237 base::ASCIIToUTF16(kEmeMessageUnexpectedType)); | 240 base::ASCIIToUTF16(kEmeMessageUnexpectedType)); |
| 238 title_watcher->AlsoWaitForTitle( | 241 title_watcher->AlsoWaitForTitle( |
| 239 base::ASCIIToUTF16(kEmeRenewalMissingHeader)); | 242 base::ASCIIToUTF16(kEmeRenewalMissingHeader)); |
| 240 } | 243 } |
| 241 | 244 |
| 242 void SetUpCommandLine(base::CommandLine* command_line) override { | 245 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 243 command_line->AppendSwitch( | 246 command_line->AppendSwitch( |
| 244 switches::kDisableGestureRequirementForMediaPlayback); | 247 switches::kDisableGestureRequirementForMediaPlayback); |
| 248 command_line->AppendSwitch(switches::kEnableVp9InMp4); |
| 245 } | 249 } |
| 246 | 250 |
| 247 #if BUILDFLAG(ENABLE_PEPPER_CDMS) | 251 #if BUILDFLAG(ENABLE_PEPPER_CDMS) |
| 248 void SetUpDefaultCommandLine(base::CommandLine* command_line) override { | 252 void SetUpDefaultCommandLine(base::CommandLine* command_line) override { |
| 249 base::CommandLine default_command_line(base::CommandLine::NO_PROGRAM); | 253 base::CommandLine default_command_line(base::CommandLine::NO_PROGRAM); |
| 250 InProcessBrowserTest::SetUpDefaultCommandLine(&default_command_line); | 254 InProcessBrowserTest::SetUpDefaultCommandLine(&default_command_line); |
| 251 test_launcher_utils::RemoveCommandLineSwitch( | 255 test_launcher_utils::RemoveCommandLineSwitch( |
| 252 default_command_line, switches::kDisableComponentUpdate, command_line); | 256 default_command_line, switches::kDisableComponentUpdate, command_line); |
| 253 } | 257 } |
| 254 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) | 258 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 | 546 |
| 543 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_MP4) { | 547 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_MP4) { |
| 544 // MP4 without MSE is not support yet, http://crbug.com/170793. | 548 // MP4 without MSE is not support yet, http://crbug.com/170793. |
| 545 if (CurrentSourceType() != MSE) { | 549 if (CurrentSourceType() != MSE) { |
| 546 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; | 550 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; |
| 547 return; | 551 return; |
| 548 } | 552 } |
| 549 TestSimplePlayback("bear-640x360-a_frag-cenc.mp4", kMP4AudioOnly); | 553 TestSimplePlayback("bear-640x360-a_frag-cenc.mp4", kMP4AudioOnly); |
| 550 } | 554 } |
| 551 | 555 |
| 556 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoOnly_MP4_VP9) { |
| 557 // MP4 without MSE is not support yet, http://crbug.com/170793. |
| 558 if (CurrentSourceType() != MSE) { |
| 559 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; |
| 560 return; |
| 561 } |
| 562 TestSimplePlayback("bear-320x240-v_frag-vp9-cenc.mp4", kMP4VideoVp9Only); |
| 563 } |
| 564 |
| 552 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, | 565 IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, |
| 553 Playback_EncryptedVideo_MP4_ClearAudio_WEBM) { | 566 Playback_EncryptedVideo_MP4_ClearAudio_WEBM) { |
| 554 // MP4 without MSE is not support yet, http://crbug.com/170793. | 567 // MP4 without MSE is not support yet, http://crbug.com/170793. |
| 555 if (CurrentSourceType() != MSE) { | 568 if (CurrentSourceType() != MSE) { |
| 556 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; | 569 DVLOG(0) << "Skipping test; Can only play MP4 encrypted streams by MSE."; |
| 557 return; | 570 return; |
| 558 } | 571 } |
| 559 if (!IsPlayBackPossible(CurrentKeySystem())) { | 572 if (!IsPlayBackPossible(CurrentKeySystem())) { |
| 560 DVLOG(0) << "Skipping test - Test requires video playback."; | 573 DVLOG(0) << "Skipping test - Test requires video playback."; |
| 561 return; | 574 return; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { | 663 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { |
| 651 TestPlaybackCase(kExternalClearKeyKeySystem, kLoadableSession, kEnded); | 664 TestPlaybackCase(kExternalClearKeyKeySystem, kLoadableSession, kEnded); |
| 652 } | 665 } |
| 653 | 666 |
| 654 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { | 667 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { |
| 655 TestPlaybackCase(kExternalClearKeyKeySystem, kUnknownSession, | 668 TestPlaybackCase(kExternalClearKeyKeySystem, kUnknownSession, |
| 656 kEmeSessionNotFound); | 669 kEmeSessionNotFound); |
| 657 } | 670 } |
| 658 | 671 |
| 659 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) | 672 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) |
| OLD | NEW |