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 16 matching lines...) Expand all Loading... |
27 #if defined(ENABLE_PEPPER_CDMS) | 27 #if defined(ENABLE_PEPPER_CDMS) |
28 #include "chrome/browser/media/pepper_cdm_test_constants.h" | 28 #include "chrome/browser/media/pepper_cdm_test_constants.h" |
29 #include "chrome/browser/media/pepper_cdm_test_helper.h" | 29 #include "chrome/browser/media/pepper_cdm_test_helper.h" |
30 #endif | 30 #endif |
31 | 31 |
32 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | 32 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
33 | 33 |
34 // Available key systems. | 34 // Available key systems. |
35 const char kClearKeyKeySystem[] = "org.w3.clearkey"; | 35 const char kClearKeyKeySystem[] = "org.w3.clearkey"; |
36 const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; | 36 const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; |
37 | |
38 // Variants of External Clear Key key system to test different scenarios. | |
39 // To add a new variant, make sure you also update: | |
40 // - media/test/data/eme_player_js/globals.js | |
41 // - AddExternalClearKey() in chrome_key_systems.cc | |
42 // - CreateCdmInstance() in clear_key_cdm.cc | |
43 const char kExternalClearKeyFileIOTestKeySystem[] = | 37 const char kExternalClearKeyFileIOTestKeySystem[] = |
44 "org.chromium.externalclearkey.fileiotest"; | 38 "org.chromium.externalclearkey.fileiotest"; |
45 const char kExternalClearKeyInitializeFailKeySystem[] = | 39 const char kExternalClearKeyInitializeFailKeySystem[] = |
46 "org.chromium.externalclearkey.initializefail"; | 40 "org.chromium.externalclearkey.initializefail"; |
47 const char kExternalClearKeyOutputProtectionTestKeySystem[] = | |
48 "org.chromium.externalclearkey.outputprotectiontest"; | |
49 const char kExternalClearKeyCrashKeySystem[] = | 41 const char kExternalClearKeyCrashKeySystem[] = |
50 "org.chromium.externalclearkey.crash"; | 42 "org.chromium.externalclearkey.crash"; |
51 | 43 |
52 // Supported media types. | 44 // Supported media types. |
53 const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\""; | 45 const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\""; |
54 const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\""; | 46 const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\""; |
55 const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\""; | 47 const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\""; |
56 const char kWebMVP9VideoOnly[] = "video/webm; codecs=\"vp9\""; | 48 const char kWebMVP9VideoOnly[] = "video/webm; codecs=\"vp9\""; |
57 #if defined(USE_PROPRIETARY_CODECS) | 49 #if defined(USE_PROPRIETARY_CODECS) |
58 const char kMP4AudioOnly[] = "audio/mp4; codecs=\"mp4a.40.2\""; | 50 const char kMP4AudioOnly[] = "audio/mp4; codecs=\"mp4a.40.2\""; |
59 const char kMP4VideoOnly[] = "video/mp4; codecs=\"avc1.4D4041\""; | 51 const char kMP4VideoOnly[] = "video/mp4; codecs=\"avc1.4D4041\""; |
60 #endif // defined(USE_PROPRIETARY_CODECS) | 52 #endif // defined(USE_PROPRIETARY_CODECS) |
61 | 53 |
62 // Sessions to load. | 54 // Sessions to load. |
63 const char kNoSessionToLoad[] = ""; | 55 const char kNoSessionToLoad[] = ""; |
64 const char kLoadableSession[] = "LoadableSession"; | 56 const char kLoadableSession[] = "LoadableSession"; |
65 const char kUnknownSession[] = "UnknownSession"; | 57 const char kUnknownSession[] = "UnknownSession"; |
66 | 58 |
67 // EME-specific test results and errors. | 59 // EME-specific test results and errors. |
68 const char kUnitTestSuccess[] = "UNIT_TEST_SUCCESS"; | 60 const char kFileIOTestSuccess[] = "FILE_IO_TEST_SUCCESS"; |
69 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR"; | 61 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR"; |
70 const char kEmeGenerateRequestFailed[] = "EME_GENERATEREQUEST_FAILED"; | 62 const char kEmeGenerateRequestFailed[] = "EME_GENERATEREQUEST_FAILED"; |
71 const char kEmeSessionNotFound[] = "EME_SESSION_NOT_FOUND"; | 63 const char kEmeSessionNotFound[] = "EME_SESSION_NOT_FOUND"; |
72 const char kEmeLoadFailed[] = "EME_LOAD_FAILED"; | 64 const char kEmeLoadFailed[] = "EME_LOAD_FAILED"; |
73 const char kEmeUpdateFailed[] = "EME_UPDATE_FAILED"; | 65 const char kEmeUpdateFailed[] = "EME_UPDATE_FAILED"; |
74 const char kEmeErrorEvent[] = "EME_ERROR_EVENT"; | 66 const char kEmeErrorEvent[] = "EME_ERROR_EVENT"; |
75 const char kEmeMessageUnexpectedType[] = "EME_MESSAGE_UNEXPECTED_TYPE"; | 67 const char kEmeMessageUnexpectedType[] = "EME_MESSAGE_UNEXPECTED_TYPE"; |
76 const char kEmeRenewalMissingHeader[] = "EME_RENEWAL_MISSING_HEADER"; | 68 const char kEmeRenewalMissingHeader[] = "EME_RENEWAL_MISSING_HEADER"; |
77 | 69 |
78 const char kDefaultEmePlayer[] = "eme_player.html"; | 70 const char kDefaultEmePlayer[] = "eme_player.html"; |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 | 612 |
621 // Testing that the media browser test does fail on plugin crash. | 613 // Testing that the media browser test does fail on plugin crash. |
622 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, CDMExpectedCrash) { | 614 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, CDMExpectedCrash) { |
623 // Plugin crash is not ignored by default, the test is expected to fail. | 615 // Plugin crash is not ignored by default, the test is expected to fail. |
624 EXPECT_NONFATAL_FAILURE( | 616 EXPECT_NONFATAL_FAILURE( |
625 TestNonPlaybackCases(kExternalClearKeyCrashKeySystem, kError), | 617 TestNonPlaybackCases(kExternalClearKeyCrashKeySystem, kError), |
626 "Failing test due to plugin crash."); | 618 "Failing test due to plugin crash."); |
627 } | 619 } |
628 | 620 |
629 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, FileIOTest) { | 621 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, FileIOTest) { |
630 TestNonPlaybackCases(kExternalClearKeyFileIOTestKeySystem, kUnitTestSuccess); | 622 TestNonPlaybackCases(kExternalClearKeyFileIOTestKeySystem, |
631 } | 623 kFileIOTestSuccess); |
632 | |
633 // TODO(xhwang): Investigate how to fake capturing activities to test the | |
634 // network link detection logic in OutputProtectionProxy. | |
635 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, OutputProtectionTest) { | |
636 TestNonPlaybackCases(kExternalClearKeyOutputProtectionTestKeySystem, | |
637 kUnitTestSuccess); | |
638 } | 624 } |
639 | 625 |
640 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { | 626 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { |
641 TestPlaybackCase(kLoadableSession, kEnded); | 627 TestPlaybackCase(kLoadableSession, kEnded); |
642 } | 628 } |
643 | 629 |
644 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { | 630 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { |
645 TestPlaybackCase(kUnknownSession, kEmeSessionNotFound); | 631 TestPlaybackCase(kUnknownSession, kEmeSessionNotFound); |
646 } | 632 } |
647 | 633 |
648 #endif // defined(ENABLE_PEPPER_CDMS) | 634 #endif // defined(ENABLE_PEPPER_CDMS) |
OLD | NEW |