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

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

Issue 1996863002: media: Use bundled Widevine CDM in encrypted media browser tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 DVLOG(0) << "MSE is only supported in Android 4.1 and later."; 91 DVLOG(0) << "MSE is only supported in Android 4.1 and later.";
92 return false; 92 return false;
93 } 93 }
94 #endif // defined(OS_ANDROID) 94 #endif // defined(OS_ANDROID)
95 return true; 95 return true;
96 } 96 }
97 97
98 // Base class for encrypted media tests. 98 // Base class for encrypted media tests.
99 class EncryptedMediaTestBase : public MediaBrowserTest { 99 class EncryptedMediaTestBase : public MediaBrowserTest {
100 public: 100 public:
101 EncryptedMediaTestBase() {} 101 EncryptedMediaTestBase() { enable_component_update(); }
ddorwin 2016/05/20 16:56:15 What are the test performance impacts? Should we p
xhwang 2016/05/20 21:23:28 I suppose we'll load existing components, then bef
102 102
103 bool IsExternalClearKey(const std::string& key_system) { 103 bool IsExternalClearKey(const std::string& key_system) {
104 if (key_system == kExternalClearKeyKeySystem) 104 if (key_system == kExternalClearKeyKeySystem)
105 return true; 105 return true;
106 std::string prefix = std::string(kExternalClearKeyKeySystem) + '.'; 106 std::string prefix = std::string(kExternalClearKeyKeySystem) + '.';
107 return key_system.substr(0, prefix.size()) == prefix; 107 return key_system.substr(0, prefix.size()) == prefix;
108 } 108 }
109 109
110 #if defined(WIDEVINE_CDM_AVAILABLE) 110 #if defined(WIDEVINE_CDM_AVAILABLE)
111 bool IsWidevine(const std::string& key_system) { 111 bool IsWidevine(const std::string& key_system) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 // disable web-security to send license requests to the license server. 248 // disable web-security to send license requests to the license server.
249 // TODO(shadi): Add port forwarding to the test web server configuration. 249 // TODO(shadi): Add port forwarding to the test web server configuration.
250 command_line->AppendSwitch(switches::kDisableWebSecurity); 250 command_line->AppendSwitch(switches::kDisableWebSecurity);
251 251
252 #if defined(ENABLE_PEPPER_CDMS) 252 #if defined(ENABLE_PEPPER_CDMS)
253 if (IsExternalClearKey(key_system)) { 253 if (IsExternalClearKey(key_system)) {
254 RegisterPepperCdm(command_line, kClearKeyCdmBaseDirectory, 254 RegisterPepperCdm(command_line, kClearKeyCdmBaseDirectory,
255 kClearKeyCdmAdapterFileName, kClearKeyCdmDisplayName, 255 kClearKeyCdmAdapterFileName, kClearKeyCdmDisplayName,
256 kClearKeyCdmPepperMimeType); 256 kClearKeyCdmPepperMimeType);
257 } 257 }
258 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
259 else if (IsWidevine(key_system)) { // NOLINT
260 RegisterPepperCdm(command_line, kWidevineCdmBaseDirectory,
261 kWidevineCdmAdapterFileName, kWidevineCdmDisplayName,
262 kWidevineCdmPluginMimeType);
263 }
264 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
265 #endif // defined(ENABLE_PEPPER_CDMS) 258 #endif // defined(ENABLE_PEPPER_CDMS)
266 } 259 }
267 }; 260 };
268 261
269 #if defined(ENABLE_PEPPER_CDMS) 262 #if defined(ENABLE_PEPPER_CDMS)
270 // Tests encrypted media playback using ExternalClearKey key system in 263 // Tests encrypted media playback using ExternalClearKey key system in
271 // decrypt-and-decode mode. 264 // decrypt-and-decode mode.
272 class ECKEncryptedMediaTest : public EncryptedMediaTestBase { 265 class ECKEncryptedMediaTest : public EncryptedMediaTestBase {
273 public: 266 public:
274 // We use special |key_system| names to do non-playback related tests, e.g. 267 // We use special |key_system| names to do non-playback related tests, e.g.
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 616
624 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { 617 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) {
625 TestPlaybackCase(kLoadableSession, kEnded); 618 TestPlaybackCase(kLoadableSession, kEnded);
626 } 619 }
627 620
628 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { 621 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) {
629 TestPlaybackCase(kUnknownSession, kEmeSessionNotFound); 622 TestPlaybackCase(kUnknownSession, kEmeSessionNotFound);
630 } 623 }
631 624
632 #endif // defined(ENABLE_PEPPER_CDMS) 625 #endif // defined(ENABLE_PEPPER_CDMS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698