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

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

Issue 1957643002: media: Move widevine CDM targets to WidevineCdm folder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also update stub cdm. 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 void SetUpCommandLineForKeySystem(const std::string& key_system, 254 void SetUpCommandLineForKeySystem(const std::string& key_system,
255 base::CommandLine* command_line) { 255 base::CommandLine* command_line) {
256 if (GetServerConfig(key_system)) 256 if (GetServerConfig(key_system))
257 // Since the web and license servers listen on different ports, we need to 257 // Since the web and license servers listen on different ports, we need to
258 // disable web-security to send license requests to the license server. 258 // disable web-security to send license requests to the license server.
259 // TODO(shadi): Add port forwarding to the test web server configuration. 259 // TODO(shadi): Add port forwarding to the test web server configuration.
260 command_line->AppendSwitch(switches::kDisableWebSecurity); 260 command_line->AppendSwitch(switches::kDisableWebSecurity);
261 261
262 #if defined(ENABLE_PEPPER_CDMS) 262 #if defined(ENABLE_PEPPER_CDMS)
263 if (IsExternalClearKey(key_system)) { 263 if (IsExternalClearKey(key_system)) {
264 RegisterPepperCdm(command_line, kClearKeyCdmAdapterFileName, key_system); 264 RegisterPepperCdm(command_line, "", kClearKeyCdmAdapterFileName,
265 key_system);
265 } 266 }
266 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) 267 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
267 else if (IsWidevine(key_system)) { // NOLINT 268 else if (IsWidevine(key_system)) { // NOLINT
268 RegisterPepperCdm(command_line, kWidevineCdmAdapterFileName, key_system); 269 RegisterPepperCdm(command_line, kWidevineCdmBaseDirectory,
270 kWidevineCdmAdapterFileName, key_system);
269 } 271 }
270 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) 272 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
271 #endif // defined(ENABLE_PEPPER_CDMS) 273 #endif // defined(ENABLE_PEPPER_CDMS)
272 } 274 }
273 275
274 private: 276 private:
275 #if defined(ENABLE_PEPPER_CDMS) 277 #if defined(ENABLE_PEPPER_CDMS)
278 // The CDM adatper should be located in |adapter_base_dir| in DIR_MODULE. If
279 // |adapter_base_dir| is empty, then the adapter should be located in
280 // DIR_MODULE directly.
276 void RegisterPepperCdm(base::CommandLine* command_line, 281 void RegisterPepperCdm(base::CommandLine* command_line,
282 const std::string& adapter_base_dir,
277 const std::string& adapter_name, 283 const std::string& adapter_name,
278 const std::string& key_system) { 284 const std::string& key_system) {
279 DCHECK(!is_pepper_cdm_registered_) 285 DCHECK(!is_pepper_cdm_registered_)
280 << "RegisterPepperCdm() can only be called once."; 286 << "RegisterPepperCdm() can only be called once.";
281 is_pepper_cdm_registered_ = true; 287 is_pepper_cdm_registered_ = true;
282 288
283 // Append the switch to register the Clear Key CDM Adapter. 289 // Build the CDM adapter path.
284 base::FilePath plugin_dir; 290 base::FilePath plugin_dir;
285 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir)); 291 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir));
292 plugin_dir = plugin_dir.AppendASCII(adapter_base_dir);
293
286 base::FilePath plugin_lib = plugin_dir.AppendASCII(adapter_name); 294 base::FilePath plugin_lib = plugin_dir.AppendASCII(adapter_name);
287 EXPECT_TRUE(base::PathExists(plugin_lib)) << plugin_lib.value(); 295 EXPECT_TRUE(base::PathExists(plugin_lib)) << plugin_lib.value();
296
297 // Build pepper plugin registration switch.
288 base::FilePath::StringType pepper_plugin = plugin_lib.value(); 298 base::FilePath::StringType pepper_plugin = plugin_lib.value();
289 pepper_plugin.append(FILE_PATH_LITERAL("#CDM#0.1.0.0;")); 299 pepper_plugin.append(FILE_PATH_LITERAL("#CDM#0.1.0.0;"));
290 #if defined(OS_WIN) 300 #if defined(OS_WIN)
291 pepper_plugin.append(base::ASCIIToUTF16(GetPepperType(key_system))); 301 pepper_plugin.append(base::ASCIIToUTF16(GetPepperType(key_system)));
292 #else 302 #else
293 pepper_plugin.append(GetPepperType(key_system)); 303 pepper_plugin.append(GetPepperType(key_system));
294 #endif 304 #endif
305
306 // Append the switch to register the CDM Adapter.
295 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, 307 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins,
296 pepper_plugin); 308 pepper_plugin);
297 } 309 }
298 310
299 // Adapted from key_systems.cc. 311 // Adapted from key_systems.cc.
300 std::string GetPepperType(const std::string& key_system) { 312 std::string GetPepperType(const std::string& key_system) {
301 if (IsExternalClearKey(key_system)) 313 if (IsExternalClearKey(key_system))
302 return kClearKeyCdmPluginMimeType; 314 return kClearKeyCdmPluginMimeType;
303 #if defined(WIDEVINE_CDM_AVAILABLE) 315 #if defined(WIDEVINE_CDM_AVAILABLE)
304 if (IsWidevine(key_system)) 316 if (IsWidevine(key_system))
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 682
671 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { 683 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) {
672 TestPlaybackCase(kLoadableSession, kEnded); 684 TestPlaybackCase(kLoadableSession, kEnded);
673 } 685 }
674 686
675 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { 687 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) {
676 TestPlaybackCase(kUnknownSession, kEmeSessionNotFound); 688 TestPlaybackCase(kUnknownSession, kEmeSessionNotFound);
677 } 689 }
678 690
679 #endif // defined(ENABLE_PEPPER_CDMS) 691 #endif // defined(ENABLE_PEPPER_CDMS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698