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