| 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" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // EME-specific test results and errors. | 74 // EME-specific test results and errors. |
| 75 const char kUnitTestSuccess[] = "UNIT_TEST_SUCCESS"; | 75 const char kUnitTestSuccess[] = "UNIT_TEST_SUCCESS"; |
| 76 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR"; | 76 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR"; |
| 77 const char kEmeGenerateRequestFailed[] = "EME_GENERATEREQUEST_FAILED"; | 77 const char kEmeGenerateRequestFailed[] = "EME_GENERATEREQUEST_FAILED"; |
| 78 const char kEmeSessionNotFound[] = "EME_SESSION_NOT_FOUND"; | 78 const char kEmeSessionNotFound[] = "EME_SESSION_NOT_FOUND"; |
| 79 const char kEmeLoadFailed[] = "EME_LOAD_FAILED"; | 79 const char kEmeLoadFailed[] = "EME_LOAD_FAILED"; |
| 80 const char kEmeUpdateFailed[] = "EME_UPDATE_FAILED"; | 80 const char kEmeUpdateFailed[] = "EME_UPDATE_FAILED"; |
| 81 const char kEmeErrorEvent[] = "EME_ERROR_EVENT"; | 81 const char kEmeErrorEvent[] = "EME_ERROR_EVENT"; |
| 82 const char kEmeMessageUnexpectedType[] = "EME_MESSAGE_UNEXPECTED_TYPE"; | 82 const char kEmeMessageUnexpectedType[] = "EME_MESSAGE_UNEXPECTED_TYPE"; |
| 83 const char kEmeRenewalMissingHeader[] = "EME_RENEWAL_MISSING_HEADER"; | 83 const char kEmeRenewalMissingHeader[] = "EME_RENEWAL_MISSING_HEADER"; |
| 84 const char kEmeSessionClosed[] = "SESSION_CLOSED"; |
| 84 | 85 |
| 85 const char kDefaultEmePlayer[] = "eme_player.html"; | 86 const char kDefaultEmePlayer[] = "eme_player.html"; |
| 86 | 87 |
| 87 // The type of video src used to load media. | 88 // The type of video src used to load media. |
| 88 enum SrcType { | 89 enum SrcType { |
| 89 SRC, | 90 SRC, |
| 90 MSE | 91 MSE |
| 91 }; | 92 }; |
| 92 | 93 |
| 93 // Whether the video should be played once or twice. | 94 // Whether the video should be played once or twice. |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 kEmeNotSupportedError); | 607 kEmeNotSupportedError); |
| 607 } | 608 } |
| 608 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 609 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
| 609 | 610 |
| 610 #if BUILDFLAG(ENABLE_PEPPER_CDMS) | 611 #if BUILDFLAG(ENABLE_PEPPER_CDMS) |
| 611 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, InitializeCDMFail) { | 612 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, InitializeCDMFail) { |
| 612 TestNonPlaybackCases(kExternalClearKeyInitializeFailKeySystem, | 613 TestNonPlaybackCases(kExternalClearKeyInitializeFailKeySystem, |
| 613 kEmeNotSupportedError); | 614 kEmeNotSupportedError); |
| 614 } | 615 } |
| 615 | 616 |
| 616 // When CDM crashes, we should still get a decode error. |kError| is reported | 617 // When CDM crashes, all open sessions should be closed. |
| 617 // when the HTMLVideoElement error event fires, indicating an error happened | |
| 618 // during playback. | |
| 619 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, CDMCrashDuringDecode) { | 618 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, CDMCrashDuringDecode) { |
| 620 IgnorePluginCrash(); | 619 IgnorePluginCrash(); |
| 621 TestNonPlaybackCases(kExternalClearKeyCrashKeySystem, kError); | 620 TestNonPlaybackCases(kExternalClearKeyCrashKeySystem, kEmeSessionClosed); |
| 622 } | 621 } |
| 623 | 622 |
| 624 // Testing that the media browser test does fail on plugin crash. | 623 // Testing that the media browser test does fail on plugin crash. |
| 625 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, CDMExpectedCrash) { | 624 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, CDMExpectedCrash) { |
| 626 // Plugin crash is not ignored by default, the test is expected to fail. | 625 // Plugin crash is not ignored by default, the test is expected to fail. |
| 627 EXPECT_NONFATAL_FAILURE( | 626 EXPECT_NONFATAL_FAILURE( |
| 628 TestNonPlaybackCases(kExternalClearKeyCrashKeySystem, kError), | 627 TestNonPlaybackCases(kExternalClearKeyCrashKeySystem, kEmeSessionClosed), |
| 629 "Failing test due to plugin crash."); | 628 "Failing test due to plugin crash."); |
| 630 } | 629 } |
| 631 | 630 |
| 632 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, FileIOTest) { | 631 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, FileIOTest) { |
| 633 TestNonPlaybackCases(kExternalClearKeyFileIOTestKeySystem, kUnitTestSuccess); | 632 TestNonPlaybackCases(kExternalClearKeyFileIOTestKeySystem, kUnitTestSuccess); |
| 634 } | 633 } |
| 635 | 634 |
| 636 // TODO(xhwang): Investigate how to fake capturing activities to test the | 635 // TODO(xhwang): Investigate how to fake capturing activities to test the |
| 637 // network link detection logic in OutputProtectionProxy. | 636 // network link detection logic in OutputProtectionProxy. |
| 638 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, OutputProtectionTest) { | 637 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, OutputProtectionTest) { |
| 639 TestNonPlaybackCases(kExternalClearKeyOutputProtectionTestKeySystem, | 638 TestNonPlaybackCases(kExternalClearKeyOutputProtectionTestKeySystem, |
| 640 kUnitTestSuccess); | 639 kUnitTestSuccess); |
| 641 } | 640 } |
| 642 | 641 |
| 643 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, Renewal) { | 642 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, Renewal) { |
| 644 TestPlaybackCase(kExternalClearKeyRenewalKeySystem, kNoSessionToLoad, kEnded); | 643 TestPlaybackCase(kExternalClearKeyRenewalKeySystem, kNoSessionToLoad, kEnded); |
| 645 } | 644 } |
| 646 | 645 |
| 647 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { | 646 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { |
| 648 TestPlaybackCase(kExternalClearKeyKeySystem, kLoadableSession, kEnded); | 647 TestPlaybackCase(kExternalClearKeyKeySystem, kLoadableSession, kEnded); |
| 649 } | 648 } |
| 650 | 649 |
| 651 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { | 650 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { |
| 652 TestPlaybackCase(kExternalClearKeyKeySystem, kUnknownSession, | 651 TestPlaybackCase(kExternalClearKeyKeySystem, kUnknownSession, |
| 653 kEmeSessionNotFound); | 652 kEmeSessionNotFound); |
| 654 } | 653 } |
| 655 | 654 |
| 656 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) | 655 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) |
| OLD | NEW |