Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: chrome/browser/media/encrypted_media_browsertest.cc

Issue 2426813002: EME: Close existing sessions on CDM failure (Closed)
Patch Set: add new tests Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 const char kExternalClearKeyFileIOTestKeySystem[] = 48 const char kExternalClearKeyFileIOTestKeySystem[] =
49 "org.chromium.externalclearkey.fileiotest"; 49 "org.chromium.externalclearkey.fileiotest";
50 const char kExternalClearKeyInitializeFailKeySystem[] = 50 const char kExternalClearKeyInitializeFailKeySystem[] =
51 "org.chromium.externalclearkey.initializefail"; 51 "org.chromium.externalclearkey.initializefail";
52 const char kExternalClearKeyOutputProtectionTestKeySystem[] = 52 const char kExternalClearKeyOutputProtectionTestKeySystem[] =
53 "org.chromium.externalclearkey.outputprotectiontest"; 53 "org.chromium.externalclearkey.outputprotectiontest";
54 const char kExternalClearKeyPlatformVerificationTestKeySystem[] = 54 const char kExternalClearKeyPlatformVerificationTestKeySystem[] =
55 "org.chromium.externalclearkey.platformverificationtest"; 55 "org.chromium.externalclearkey.platformverificationtest";
56 const char kExternalClearKeyCrashKeySystem[] = 56 const char kExternalClearKeyCrashKeySystem[] =
57 "org.chromium.externalclearkey.crash"; 57 "org.chromium.externalclearkey.crash";
58 const char kExternalClearKeyCloseOnCrashKeySystem[] =
59 "org.chromium.externalclearkey.closeoncrash";
58 60
59 // Supported media types. 61 // Supported media types.
60 const char kWebMVorbisAudioOnly[] = "audio/webm; codecs=\"vorbis\""; 62 const char kWebMVorbisAudioOnly[] = "audio/webm; codecs=\"vorbis\"";
61 const char kWebMOpusAudioOnly[] = "audio/webm; codecs=\"opus\""; 63 const char kWebMOpusAudioOnly[] = "audio/webm; codecs=\"opus\"";
62 const char kWebMVP8VideoOnly[] = "video/webm; codecs=\"vp8\""; 64 const char kWebMVP8VideoOnly[] = "video/webm; codecs=\"vp8\"";
63 const char kWebMVorbisAudioVP8Video[] = "video/webm; codecs=\"vorbis, vp8\""; 65 const char kWebMVorbisAudioVP8Video[] = "video/webm; codecs=\"vorbis, vp8\"";
64 const char kWebMOpusAudioVP9Video[] = "video/webm; codecs=\"opus, vp9\""; 66 const char kWebMOpusAudioVP9Video[] = "video/webm; codecs=\"opus, vp9\"";
65 const char kWebMVP9VideoOnly[] = "video/webm; codecs=\"vp9\""; 67 const char kWebMVP9VideoOnly[] = "video/webm; codecs=\"vp9\"";
66 #if defined(USE_PROPRIETARY_CODECS) 68 #if defined(USE_PROPRIETARY_CODECS)
67 const char kMP4AudioOnly[] = "audio/mp4; codecs=\"mp4a.40.2\""; 69 const char kMP4AudioOnly[] = "audio/mp4; codecs=\"mp4a.40.2\"";
68 const char kMP4VideoOnly[] = "video/mp4; codecs=\"avc1.4D000C\""; 70 const char kMP4VideoOnly[] = "video/mp4; codecs=\"avc1.4D000C\"";
69 #endif // defined(USE_PROPRIETARY_CODECS) 71 #endif // defined(USE_PROPRIETARY_CODECS)
70 72
71 // Sessions to load. 73 // Sessions to load.
72 const char kNoSessionToLoad[] = ""; 74 const char kNoSessionToLoad[] = "";
73 const char kLoadableSession[] = "LoadableSession"; 75 const char kLoadableSession[] = "LoadableSession";
74 const char kUnknownSession[] = "UnknownSession"; 76 const char kUnknownSession[] = "UnknownSession";
75 77
76 // EME-specific test results and errors. 78 // EME-specific test results and errors.
77 const char kUnitTestSuccess[] = "UNIT_TEST_SUCCESS"; 79 const char kUnitTestSuccess[] = "UNIT_TEST_SUCCESS";
78 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR"; 80 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR";
79 const char kEmeGenerateRequestFailed[] = "EME_GENERATEREQUEST_FAILED"; 81 const char kEmeGenerateRequestFailed[] = "EME_GENERATEREQUEST_FAILED";
80 const char kEmeSessionNotFound[] = "EME_SESSION_NOT_FOUND"; 82 const char kEmeSessionNotFound[] = "EME_SESSION_NOT_FOUND";
81 const char kEmeLoadFailed[] = "EME_LOAD_FAILED"; 83 const char kEmeLoadFailed[] = "EME_LOAD_FAILED";
82 const char kEmeUpdateFailed[] = "EME_UPDATE_FAILED"; 84 const char kEmeUpdateFailed[] = "EME_UPDATE_FAILED";
83 const char kEmeErrorEvent[] = "EME_ERROR_EVENT"; 85 const char kEmeErrorEvent[] = "EME_ERROR_EVENT";
84 const char kEmeMessageUnexpectedType[] = "EME_MESSAGE_UNEXPECTED_TYPE"; 86 const char kEmeMessageUnexpectedType[] = "EME_MESSAGE_UNEXPECTED_TYPE";
85 const char kEmeRenewalMissingHeader[] = "EME_RENEWAL_MISSING_HEADER"; 87 const char kEmeRenewalMissingHeader[] = "EME_RENEWAL_MISSING_HEADER";
88 const char kEmeSessionClosed[] = "SESSION_CLOSED";
86 89
87 const char kDefaultEmePlayer[] = "eme_player.html"; 90 const char kDefaultEmePlayer[] = "eme_player.html";
88 91
89 // The type of video src used to load media. 92 // The type of video src used to load media.
90 enum SrcType { 93 enum SrcType {
91 SRC, 94 SRC,
92 MSE 95 MSE
93 }; 96 };
94 97
95 // Whether the video should be played once or twice. 98 // Whether the video should be played once or twice.
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 } 622 }
620 623
621 // Testing that the media browser test does fail on plugin crash. 624 // Testing that the media browser test does fail on plugin crash.
622 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, CDMExpectedCrash) { 625 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, CDMExpectedCrash) {
623 // Plugin crash is not ignored by default, the test is expected to fail. 626 // Plugin crash is not ignored by default, the test is expected to fail.
624 EXPECT_NONFATAL_FAILURE( 627 EXPECT_NONFATAL_FAILURE(
625 TestNonPlaybackCases(kExternalClearKeyCrashKeySystem, kError), 628 TestNonPlaybackCases(kExternalClearKeyCrashKeySystem, kError),
626 "Failing test due to plugin crash."); 629 "Failing test due to plugin crash.");
627 } 630 }
628 631
632 // When CDM crashes, all open sessions should be closed.
633 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, CDMCloseSessionsOnCrash) {
634 IgnorePluginCrash();
635 TestNonPlaybackCases(kExternalClearKeyCloseOnCrashKeySystem,
636 kEmeSessionClosed);
637 }
638
639 // Testing that the media browser test does fail on plugin crash.
640 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, CDMCloseSessionsExpectedCrash) {
641 // Plugin crash is not ignored by default, the test is expected to fail.
642 EXPECT_NONFATAL_FAILURE(
643 TestNonPlaybackCases(kExternalClearKeyCloseOnCrashKeySystem,
644 kEmeSessionClosed),
645 "Failing test due to plugin crash.");
646 }
647
629 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, FileIOTest) { 648 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, FileIOTest) {
630 TestNonPlaybackCases(kExternalClearKeyFileIOTestKeySystem, kUnitTestSuccess); 649 TestNonPlaybackCases(kExternalClearKeyFileIOTestKeySystem, kUnitTestSuccess);
631 } 650 }
632 651
633 // TODO(xhwang): Investigate how to fake capturing activities to test the 652 // TODO(xhwang): Investigate how to fake capturing activities to test the
634 // network link detection logic in OutputProtectionProxy. 653 // network link detection logic in OutputProtectionProxy.
635 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, OutputProtectionTest) { 654 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, OutputProtectionTest) {
636 TestNonPlaybackCases(kExternalClearKeyOutputProtectionTestKeySystem, 655 TestNonPlaybackCases(kExternalClearKeyOutputProtectionTestKeySystem,
637 kUnitTestSuccess); 656 kUnitTestSuccess);
638 } 657 }
(...skipping 10 matching lines...) Expand all
649 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { 668 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) {
650 TestPlaybackCase(kExternalClearKeyKeySystem, kLoadableSession, kEnded); 669 TestPlaybackCase(kExternalClearKeyKeySystem, kLoadableSession, kEnded);
651 } 670 }
652 671
653 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { 672 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) {
654 TestPlaybackCase(kExternalClearKeyKeySystem, kUnknownSession, 673 TestPlaybackCase(kExternalClearKeyKeySystem, kUnknownSession,
655 kEmeSessionNotFound); 674 kEmeSessionNotFound);
656 } 675 }
657 676
658 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) 677 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS)
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/media/chrome_key_systems.cc » ('j') | media/cdm/ppapi/external_clear_key/clear_key_cdm.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698