OLD | NEW |
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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/base_switches.h" | 8 #include "base/base_switches.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 return avc3_extended_and_aac_codecs_; | 189 return avc3_extended_and_aac_codecs_; |
190 } | 190 } |
191 const CodecVector& unknown_codec() const { return unknown_codec_; } | 191 const CodecVector& unknown_codec() const { return unknown_codec_; } |
192 const CodecVector& mixed_codecs() const { return mixed_codecs_; } | 192 const CodecVector& mixed_codecs() const { return mixed_codecs_; } |
193 const CodecVector& vp8_invalid_extension_codec() const { | 193 const CodecVector& vp8_invalid_extension_codec() const { |
194 return vp8_invalid_extension_codec_; | 194 return vp8_invalid_extension_codec_; |
195 } | 195 } |
196 | 196 |
197 // Update the command line to load |adapter_name| for | 197 // Update the command line to load |adapter_name| for |
198 // |pepper_type_for_key_system|. | 198 // |pepper_type_for_key_system|. |
199 void RegisterPepperCdm(CommandLine* command_line, | 199 void RegisterPepperCdm(base::CommandLine* command_line, |
200 const std::string& adapter_name, | 200 const std::string& adapter_name, |
201 const std::string& pepper_type_for_key_system, | 201 const std::string& pepper_type_for_key_system, |
202 bool expect_adapter_exists = true) { | 202 bool expect_adapter_exists = true) { |
203 DCHECK(!is_pepper_cdm_registered_) | 203 DCHECK(!is_pepper_cdm_registered_) |
204 << "RegisterPepperCdm() can only be called once."; | 204 << "RegisterPepperCdm() can only be called once."; |
205 is_pepper_cdm_registered_ = true; | 205 is_pepper_cdm_registered_ = true; |
206 | 206 |
207 // Append the switch to register the appropriate adapter. | 207 // Append the switch to register the appropriate adapter. |
208 base::FilePath plugin_dir; | 208 base::FilePath plugin_dir; |
209 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir)); | 209 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir)); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 CodecVector vp8_invalid_extension_codec_; | 319 CodecVector vp8_invalid_extension_codec_; |
320 bool is_test_page_loaded_; | 320 bool is_test_page_loaded_; |
321 bool is_pepper_cdm_registered_; | 321 bool is_pepper_cdm_registered_; |
322 }; | 322 }; |
323 | 323 |
324 // For ExternalClearKey tests, ensure that the ClearKey adapter is loaded. | 324 // For ExternalClearKey tests, ensure that the ClearKey adapter is loaded. |
325 class EncryptedMediaIsTypeSupportedExternalClearKeyTest | 325 class EncryptedMediaIsTypeSupportedExternalClearKeyTest |
326 : public EncryptedMediaIsTypeSupportedTest { | 326 : public EncryptedMediaIsTypeSupportedTest { |
327 #if defined(ENABLE_PEPPER_CDMS) | 327 #if defined(ENABLE_PEPPER_CDMS) |
328 protected: | 328 protected: |
329 void SetUpCommandLine(CommandLine* command_line) override { | 329 void SetUpCommandLine(base::CommandLine* command_line) override { |
330 // Platform-specific filename relative to the chrome executable. | 330 // Platform-specific filename relative to the chrome executable. |
331 const char adapter_file_name[] = | 331 const char adapter_file_name[] = |
332 #if defined(OS_MACOSX) | 332 #if defined(OS_MACOSX) |
333 "clearkeycdmadapter.plugin"; | 333 "clearkeycdmadapter.plugin"; |
334 #elif defined(OS_WIN) | 334 #elif defined(OS_WIN) |
335 "clearkeycdmadapter.dll"; | 335 "clearkeycdmadapter.dll"; |
336 #elif defined(OS_POSIX) | 336 #elif defined(OS_POSIX) |
337 "libclearkeycdmadapter.so"; | 337 "libclearkeycdmadapter.so"; |
338 #endif | 338 #endif |
339 | 339 |
340 const std::string pepper_name("application/x-ppapi-clearkey-cdm"); | 340 const std::string pepper_name("application/x-ppapi-clearkey-cdm"); |
341 RegisterPepperCdm(command_line, adapter_file_name, pepper_name); | 341 RegisterPepperCdm(command_line, adapter_file_name, pepper_name); |
342 } | 342 } |
343 #endif // defined(ENABLE_PEPPER_CDMS) | 343 #endif // defined(ENABLE_PEPPER_CDMS) |
344 }; | 344 }; |
345 | 345 |
346 // TODO(sandersd): Register the Widevine CDM if it is a component. A component | 346 // TODO(sandersd): Register the Widevine CDM if it is a component. A component |
347 // CDM registered using RegisterPepperCdm() declares support for audio codecs, | 347 // CDM registered using RegisterPepperCdm() declares support for audio codecs, |
348 // but not the other codecs we expect. http://crbug.com/356833. | 348 // but not the other codecs we expect. http://crbug.com/356833. |
349 class EncryptedMediaIsTypeSupportedWidevineTest | 349 class EncryptedMediaIsTypeSupportedWidevineTest |
350 : public EncryptedMediaIsTypeSupportedTest { | 350 : public EncryptedMediaIsTypeSupportedTest { |
351 }; | 351 }; |
352 | 352 |
353 #if defined(ENABLE_PEPPER_CDMS) | 353 #if defined(ENABLE_PEPPER_CDMS) |
354 // Registers ClearKey CDM with the wrong path (filename). | 354 // Registers ClearKey CDM with the wrong path (filename). |
355 class EncryptedMediaIsTypeSupportedClearKeyCDMRegisteredWithWrongPathTest | 355 class EncryptedMediaIsTypeSupportedClearKeyCDMRegisteredWithWrongPathTest |
356 : public EncryptedMediaIsTypeSupportedTest { | 356 : public EncryptedMediaIsTypeSupportedTest { |
357 protected: | 357 protected: |
358 void SetUpCommandLine(CommandLine* command_line) override { | 358 void SetUpCommandLine(base::CommandLine* command_line) override { |
359 RegisterPepperCdm(command_line, | 359 RegisterPepperCdm(command_line, |
360 "clearkeycdmadapterwrongname.dll", | 360 "clearkeycdmadapterwrongname.dll", |
361 "application/x-ppapi-clearkey-cdm", | 361 "application/x-ppapi-clearkey-cdm", |
362 false); | 362 false); |
363 } | 363 } |
364 }; | 364 }; |
365 | 365 |
366 // Registers Widevine CDM with the wrong path (filename). | 366 // Registers Widevine CDM with the wrong path (filename). |
367 class EncryptedMediaIsTypeSupportedWidevineCDMRegisteredWithWrongPathTest | 367 class EncryptedMediaIsTypeSupportedWidevineCDMRegisteredWithWrongPathTest |
368 : public EncryptedMediaIsTypeSupportedTest { | 368 : public EncryptedMediaIsTypeSupportedTest { |
369 protected: | 369 protected: |
370 void SetUpCommandLine(CommandLine* command_line) override { | 370 void SetUpCommandLine(base::CommandLine* command_line) override { |
371 RegisterPepperCdm(command_line, | 371 RegisterPepperCdm(command_line, |
372 "widevinecdmadapterwrongname.dll", | 372 "widevinecdmadapterwrongname.dll", |
373 "application/x-ppapi-widevine-cdm", | 373 "application/x-ppapi-widevine-cdm", |
374 false); | 374 false); |
375 } | 375 } |
376 }; | 376 }; |
377 #endif // defined(ENABLE_PEPPER_CDMS) | 377 #endif // defined(ENABLE_PEPPER_CDMS) |
378 | 378 |
379 IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedTest, ClearKey_Basic) { | 379 IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedTest, ClearKey_Basic) { |
380 EXPECT_TRUE(IsConcreteSupportedKeySystem(kPrefixedClearKey)); | 380 EXPECT_TRUE(IsConcreteSupportedKeySystem(kPrefixedClearKey)); |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 EncryptedMediaIsTypeSupportedWidevineCDMRegisteredWithWrongPathTest, | 1167 EncryptedMediaIsTypeSupportedWidevineCDMRegisteredWithWrongPathTest, |
1168 PepperCDMsRegisteredButAdapterNotPresent) { | 1168 PepperCDMsRegisteredButAdapterNotPresent) { |
1169 EXPECT_FALSE(IsConcreteSupportedKeySystem(kWidevineAlpha)); | 1169 EXPECT_FALSE(IsConcreteSupportedKeySystem(kWidevineAlpha)); |
1170 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( | 1170 EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType( |
1171 "video/webm", no_codecs(), kWidevineAlpha)); | 1171 "video/webm", no_codecs(), kWidevineAlpha)); |
1172 } | 1172 } |
1173 #endif // !defined(WIDEVINE_CDM_AVAILABLE) || defined(WIDEVINE_CDM_IS_COMPONENT
) | 1173 #endif // !defined(WIDEVINE_CDM_AVAILABLE) || defined(WIDEVINE_CDM_IS_COMPONENT
) |
1174 #endif // defined(ENABLE_PEPPER_CDMS) | 1174 #endif // defined(ENABLE_PEPPER_CDMS) |
1175 | 1175 |
1176 } // namespace chrome | 1176 } // namespace chrome |
OLD | NEW |