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

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

Issue 2085063002: media: Add OutputProtectionProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months 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 16 matching lines...) Expand all
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
37 const char kExternalClearKeyFileIOTestKeySystem[] = 43 const char kExternalClearKeyFileIOTestKeySystem[] =
38 "org.chromium.externalclearkey.fileiotest"; 44 "org.chromium.externalclearkey.fileiotest";
39 const char kExternalClearKeyInitializeFailKeySystem[] = 45 const char kExternalClearKeyInitializeFailKeySystem[] =
40 "org.chromium.externalclearkey.initializefail"; 46 "org.chromium.externalclearkey.initializefail";
47 const char kExternalClearKeyOutputProtectionTestKeySystem[] =
48 "org.chromium.externalclearkey.outputprotectiontest";
41 const char kExternalClearKeyCrashKeySystem[] = 49 const char kExternalClearKeyCrashKeySystem[] =
42 "org.chromium.externalclearkey.crash"; 50 "org.chromium.externalclearkey.crash";
43 51
44 // Supported media types. 52 // Supported media types.
45 const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\""; 53 const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\"";
46 const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\""; 54 const char kWebMVideoOnly[] = "video/webm; codecs=\"vp8\"";
47 const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\""; 55 const char kWebMAudioVideo[] = "video/webm; codecs=\"vorbis, vp8\"";
48 const char kWebMVP9VideoOnly[] = "video/webm; codecs=\"vp9\""; 56 const char kWebMVP9VideoOnly[] = "video/webm; codecs=\"vp9\"";
49 #if defined(USE_PROPRIETARY_CODECS) 57 #if defined(USE_PROPRIETARY_CODECS)
50 const char kMP4AudioOnly[] = "audio/mp4; codecs=\"mp4a.40.2\""; 58 const char kMP4AudioOnly[] = "audio/mp4; codecs=\"mp4a.40.2\"";
51 const char kMP4VideoOnly[] = "video/mp4; codecs=\"avc1.4D4041\""; 59 const char kMP4VideoOnly[] = "video/mp4; codecs=\"avc1.4D4041\"";
52 #endif // defined(USE_PROPRIETARY_CODECS) 60 #endif // defined(USE_PROPRIETARY_CODECS)
53 61
54 // Sessions to load. 62 // Sessions to load.
55 const char kNoSessionToLoad[] = ""; 63 const char kNoSessionToLoad[] = "";
56 const char kLoadableSession[] = "LoadableSession"; 64 const char kLoadableSession[] = "LoadableSession";
57 const char kUnknownSession[] = "UnknownSession"; 65 const char kUnknownSession[] = "UnknownSession";
58 66
59 // EME-specific test results and errors. 67 // EME-specific test results and errors.
60 const char kFileIOTestSuccess[] = "FILE_IO_TEST_SUCCESS"; 68 const char kUnitTestSuccess[] = "UNIT_TEST_SUCCESS";
61 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR"; 69 const char kEmeNotSupportedError[] = "NOTSUPPORTEDERROR";
62 const char kEmeGenerateRequestFailed[] = "EME_GENERATEREQUEST_FAILED"; 70 const char kEmeGenerateRequestFailed[] = "EME_GENERATEREQUEST_FAILED";
63 const char kEmeSessionNotFound[] = "EME_SESSION_NOT_FOUND"; 71 const char kEmeSessionNotFound[] = "EME_SESSION_NOT_FOUND";
64 const char kEmeLoadFailed[] = "EME_LOAD_FAILED"; 72 const char kEmeLoadFailed[] = "EME_LOAD_FAILED";
65 const char kEmeUpdateFailed[] = "EME_UPDATE_FAILED"; 73 const char kEmeUpdateFailed[] = "EME_UPDATE_FAILED";
66 const char kEmeErrorEvent[] = "EME_ERROR_EVENT"; 74 const char kEmeErrorEvent[] = "EME_ERROR_EVENT";
67 const char kEmeMessageUnexpectedType[] = "EME_MESSAGE_UNEXPECTED_TYPE"; 75 const char kEmeMessageUnexpectedType[] = "EME_MESSAGE_UNEXPECTED_TYPE";
68 const char kEmeRenewalMissingHeader[] = "EME_RENEWAL_MISSING_HEADER"; 76 const char kEmeRenewalMissingHeader[] = "EME_RENEWAL_MISSING_HEADER";
69 77
70 const char kDefaultEmePlayer[] = "eme_player.html"; 78 const char kDefaultEmePlayer[] = "eme_player.html";
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 620
613 // Testing that the media browser test does fail on plugin crash. 621 // Testing that the media browser test does fail on plugin crash.
614 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, CDMExpectedCrash) { 622 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, CDMExpectedCrash) {
615 // Plugin crash is not ignored by default, the test is expected to fail. 623 // Plugin crash is not ignored by default, the test is expected to fail.
616 EXPECT_NONFATAL_FAILURE( 624 EXPECT_NONFATAL_FAILURE(
617 TestNonPlaybackCases(kExternalClearKeyCrashKeySystem, kError), 625 TestNonPlaybackCases(kExternalClearKeyCrashKeySystem, kError),
618 "Failing test due to plugin crash."); 626 "Failing test due to plugin crash.");
619 } 627 }
620 628
621 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, FileIOTest) { 629 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, FileIOTest) {
622 TestNonPlaybackCases(kExternalClearKeyFileIOTestKeySystem, 630 TestNonPlaybackCases(kExternalClearKeyFileIOTestKeySystem, kUnitTestSuccess);
623 kFileIOTestSuccess); 631 }
632
633 // TODO(xhwang): Investigate how to fake capturing activities to test the
634 // network link detection logic in OutputProtectionProxy.
xhwang 2016/06/21 20:07:18 +miu for ideas on this
635 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, OutputProtectionTest) {
636 TestNonPlaybackCases(kExternalClearKeyOutputProtectionTestKeySystem,
637 kUnitTestSuccess);
624 } 638 }
625 639
626 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { 640 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) {
627 TestPlaybackCase(kLoadableSession, kEnded); 641 TestPlaybackCase(kLoadableSession, kEnded);
628 } 642 }
629 643
630 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { 644 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) {
631 TestPlaybackCase(kUnknownSession, kEmeSessionNotFound); 645 TestPlaybackCase(kUnknownSession, kEmeSessionNotFound);
632 } 646 }
633 647
634 #endif // defined(ENABLE_PEPPER_CDMS) 648 #endif // defined(ENABLE_PEPPER_CDMS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698