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

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: comments addressed 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"
11 #include "base/win/windows_version.h" 11 #include "base/win/windows_version.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 #include "chrome/browser/media/media_browsertest.h" 13 #include "chrome/browser/media/media_browsertest.h"
14 #include "chrome/browser/media/test_license_server.h" 14 #include "chrome/browser/media/test_license_server.h"
15 #include "chrome/browser/media/wv_test_license_server_config.h" 15 #include "chrome/browser/media/wv_test_license_server_config.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" 17 #include "chrome/browser/ui/tabs/tab_strip_model.h"
18 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
19 #include "content/public/common/content_switches.h" 19 #include "content/public/common/content_switches.h"
20 #include "content/public/test/browser_test_utils.h" 20 #include "content/public/test/browser_test_utils.h"
21 #include "testing/gtest/include/gtest/gtest-spi.h" 21 #include "testing/gtest/include/gtest/gtest-spi.h"
22 #if defined(OS_ANDROID) 22 #if defined(OS_ANDROID)
23 #include "base/android/build_info.h" 23 #include "base/android/build_info.h"
24 #endif 24 #endif
25 25
26 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 26 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
27 27
28 #if defined(ENABLE_PEPPER_CDMS) 28 #if defined(ENABLE_PEPPER_CDMS)
29 // Platform-specific filename relative to the chrome executable. 29
30 // Base path for Clear Key CDM (relative to the chrome executable).
31 const char kClearKeyCdmBaseDirectory[] = "ClearKeyCdm";
32
33 // Platform-specific filename relative to kClearKeyCdmBaseDirectory.
30 const char kClearKeyCdmAdapterFileName[] = 34 const char kClearKeyCdmAdapterFileName[] =
31 #if defined(OS_MACOSX) 35 #if defined(OS_MACOSX)
32 "clearkeycdmadapter.plugin"; 36 "clearkeycdmadapter.plugin";
33 #elif defined(OS_WIN) 37 #elif defined(OS_WIN)
34 "clearkeycdmadapter.dll"; 38 "clearkeycdmadapter.dll";
35 #elif defined(OS_POSIX) 39 #elif defined(OS_POSIX)
36 "libclearkeycdmadapter.so"; 40 "libclearkeycdmadapter.so";
37 #endif 41 #endif
38 42
39 const char kClearKeyCdmPluginMimeType[] = "application/x-ppapi-clearkey-cdm"; 43 const char kClearKeyCdmPluginMimeType[] = "application/x-ppapi-clearkey-cdm";
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 void SetUpCommandLineForKeySystem(const std::string& key_system, 258 void SetUpCommandLineForKeySystem(const std::string& key_system,
255 base::CommandLine* command_line) { 259 base::CommandLine* command_line) {
256 if (GetServerConfig(key_system)) 260 if (GetServerConfig(key_system))
257 // Since the web and license servers listen on different ports, we need to 261 // 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. 262 // disable web-security to send license requests to the license server.
259 // TODO(shadi): Add port forwarding to the test web server configuration. 263 // TODO(shadi): Add port forwarding to the test web server configuration.
260 command_line->AppendSwitch(switches::kDisableWebSecurity); 264 command_line->AppendSwitch(switches::kDisableWebSecurity);
261 265
262 #if defined(ENABLE_PEPPER_CDMS) 266 #if defined(ENABLE_PEPPER_CDMS)
263 if (IsExternalClearKey(key_system)) { 267 if (IsExternalClearKey(key_system)) {
264 RegisterPepperCdm(command_line, kClearKeyCdmAdapterFileName, key_system); 268 RegisterPepperCdm(command_line, kClearKeyCdmBaseDirectory,
269 kClearKeyCdmAdapterFileName, key_system);
265 } 270 }
266 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) 271 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
267 else if (IsWidevine(key_system)) { // NOLINT 272 else if (IsWidevine(key_system)) { // NOLINT
268 RegisterPepperCdm(command_line, kWidevineCdmAdapterFileName, key_system); 273 RegisterPepperCdm(command_line, kWidevineCdmBaseDirectory,
274 kWidevineCdmAdapterFileName, key_system);
269 } 275 }
270 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT) 276 #endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
271 #endif // defined(ENABLE_PEPPER_CDMS) 277 #endif // defined(ENABLE_PEPPER_CDMS)
272 } 278 }
273 279
274 private: 280 private:
275 #if defined(ENABLE_PEPPER_CDMS) 281 #if defined(ENABLE_PEPPER_CDMS)
282 // The CDM adatper should be located in |adapter_base_dir| in DIR_MODULE. If
283 // |adapter_base_dir| is empty, then the adapter should be located in
284 // DIR_MODULE directly.
276 void RegisterPepperCdm(base::CommandLine* command_line, 285 void RegisterPepperCdm(base::CommandLine* command_line,
286 const std::string& adapter_base_dir,
277 const std::string& adapter_name, 287 const std::string& adapter_name,
278 const std::string& key_system) { 288 const std::string& key_system) {
279 DCHECK(!is_pepper_cdm_registered_) 289 DCHECK(!is_pepper_cdm_registered_)
280 << "RegisterPepperCdm() can only be called once."; 290 << "RegisterPepperCdm() can only be called once.";
281 is_pepper_cdm_registered_ = true; 291 is_pepper_cdm_registered_ = true;
282 292
283 // Append the switch to register the Clear Key CDM Adapter. 293 // Build the CDM adapter path.
284 base::FilePath plugin_dir; 294 base::FilePath plugin_dir;
285 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir)); 295 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir));
296 plugin_dir = plugin_dir.AppendASCII(adapter_base_dir);
297
286 base::FilePath plugin_lib = plugin_dir.AppendASCII(adapter_name); 298 base::FilePath plugin_lib = plugin_dir.AppendASCII(adapter_name);
287 EXPECT_TRUE(base::PathExists(plugin_lib)) << plugin_lib.value(); 299 EXPECT_TRUE(base::PathExists(plugin_lib)) << plugin_lib.value();
300
301 // Build pepper plugin registration switch.
288 base::FilePath::StringType pepper_plugin = plugin_lib.value(); 302 base::FilePath::StringType pepper_plugin = plugin_lib.value();
289 pepper_plugin.append(FILE_PATH_LITERAL("#CDM#0.1.0.0;")); 303 pepper_plugin.append(FILE_PATH_LITERAL("#CDM#0.1.0.0;"));
290 #if defined(OS_WIN) 304 #if defined(OS_WIN)
291 pepper_plugin.append(base::ASCIIToUTF16(GetPepperType(key_system))); 305 pepper_plugin.append(base::ASCIIToUTF16(GetPepperType(key_system)));
292 #else 306 #else
293 pepper_plugin.append(GetPepperType(key_system)); 307 pepper_plugin.append(GetPepperType(key_system));
294 #endif 308 #endif
309
310 // Append the switch to register the CDM Adapter.
295 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, 311 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins,
296 pepper_plugin); 312 pepper_plugin);
297 } 313 }
298 314
299 // Adapted from key_systems.cc. 315 // Adapted from key_systems.cc.
300 std::string GetPepperType(const std::string& key_system) { 316 std::string GetPepperType(const std::string& key_system) {
301 if (IsExternalClearKey(key_system)) 317 if (IsExternalClearKey(key_system))
302 return kClearKeyCdmPluginMimeType; 318 return kClearKeyCdmPluginMimeType;
303 #if defined(WIDEVINE_CDM_AVAILABLE) 319 #if defined(WIDEVINE_CDM_AVAILABLE)
304 if (IsWidevine(key_system)) 320 if (IsWidevine(key_system))
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 686
671 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) { 687 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadLoadableSession) {
672 TestPlaybackCase(kLoadableSession, kEnded); 688 TestPlaybackCase(kLoadableSession, kEnded);
673 } 689 }
674 690
675 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) { 691 IN_PROC_BROWSER_TEST_F(ECKEncryptedMediaTest, LoadUnknownSession) {
676 TestPlaybackCase(kUnknownSession, kEmeSessionNotFound); 692 TestPlaybackCase(kUnknownSession, kEmeSessionNotFound);
677 } 693 }
678 694
679 #endif // defined(ENABLE_PEPPER_CDMS) 695 #endif // defined(ENABLE_PEPPER_CDMS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698