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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/test/scoped_feature_list.h" |
15 #include "base/threading/platform_thread.h" | 16 #include "base/threading/platform_thread.h" |
16 #include "base/time/time.h" | 17 #include "base/time/time.h" |
17 #include "build/build_config.h" | 18 #include "build/build_config.h" |
18 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 20 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
20 #include "chrome/common/chrome_paths.h" | 21 #include "chrome/common/chrome_paths.h" |
21 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
22 #include "chrome/test/base/in_process_browser_test.h" | 23 #include "chrome/test/base/in_process_browser_test.h" |
23 #include "chrome/test/base/test_launcher_utils.h" | 24 #include "chrome/test/base/test_launcher_utils.h" |
24 #include "chrome/test/base/ui_test_utils.h" | 25 #include "chrome/test/base/ui_test_utils.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 | 284 |
284 // For ClearKey, nothing additional is required. | 285 // For ClearKey, nothing additional is required. |
285 class EncryptedMediaSupportedTypesClearKeyTest | 286 class EncryptedMediaSupportedTypesClearKeyTest |
286 : public EncryptedMediaSupportedTypesTest { | 287 : public EncryptedMediaSupportedTypesTest { |
287 }; | 288 }; |
288 | 289 |
289 // For ExternalClearKey tests, ensure that the ClearKey adapter is loaded. | 290 // For ExternalClearKey tests, ensure that the ClearKey adapter is loaded. |
290 class EncryptedMediaSupportedTypesExternalClearKeyTest | 291 class EncryptedMediaSupportedTypesExternalClearKeyTest |
291 : public EncryptedMediaSupportedTypesTest { | 292 : public EncryptedMediaSupportedTypesTest { |
292 #if BUILDFLAG(ENABLE_PEPPER_CDMS) | 293 #if BUILDFLAG(ENABLE_PEPPER_CDMS) |
| 294 public: |
| 295 EncryptedMediaSupportedTypesExternalClearKeyTest() { |
| 296 scoped_feature_list_.InitAndEnableFeature( |
| 297 media::kExternalClearKeyForTesting); |
| 298 } |
| 299 |
293 protected: | 300 protected: |
294 void SetUpCommandLine(base::CommandLine* command_line) override { | 301 void SetUpCommandLine(base::CommandLine* command_line) override { |
295 EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line); | 302 EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line); |
296 RegisterPepperCdm(command_line, media::kClearKeyCdmBaseDirectory, | 303 RegisterPepperCdm(command_line, media::kClearKeyCdmBaseDirectory, |
297 media::kClearKeyCdmAdapterFileName, | 304 media::kClearKeyCdmAdapterFileName, |
298 media::kClearKeyCdmDisplayName, | 305 media::kClearKeyCdmDisplayName, |
299 media::kClearKeyCdmPepperMimeType); | 306 media::kClearKeyCdmPepperMimeType); |
300 command_line->AppendSwitchASCII(switches::kEnableFeatures, | |
301 media::kExternalClearKeyForTesting.name); | |
302 } | 307 } |
| 308 |
| 309 private: |
| 310 base::test::ScopedFeatureList scoped_feature_list_; |
303 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) | 311 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) |
304 }; | 312 }; |
305 | 313 |
306 // By default, the External Clear Key (ECK) key system is not supported even if | 314 // By default, the External Clear Key (ECK) key system is not supported even if |
307 // present. This test case tests this behavior by not enabling | 315 // present. This test case tests this behavior by not enabling |
308 // kExternalClearKeyForTesting. | 316 // kExternalClearKeyForTesting. |
309 // Even registering the Pepper CDM where applicable does not enable the CDM. | 317 // Even registering the Pepper CDM where applicable does not enable the CDM. |
310 class EncryptedMediaSupportedTypesExternalClearKeyNotEnabledTest | 318 class EncryptedMediaSupportedTypesExternalClearKeyNotEnabledTest |
311 : public EncryptedMediaSupportedTypesTest { | 319 : public EncryptedMediaSupportedTypesTest { |
312 protected: | 320 protected: |
313 void SetUpCommandLine(base::CommandLine* command_line) override { | 321 void SetUpCommandLine(base::CommandLine* command_line) override { |
314 EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line); | 322 EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line); |
315 #if BUILDFLAG(ENABLE_PEPPER_CDMS) | 323 #if BUILDFLAG(ENABLE_PEPPER_CDMS) |
316 RegisterPepperCdm(command_line, media::kClearKeyCdmBaseDirectory, | 324 RegisterPepperCdm(command_line, media::kClearKeyCdmBaseDirectory, |
317 media::kClearKeyCdmAdapterFileName, | 325 media::kClearKeyCdmAdapterFileName, |
318 media::kClearKeyCdmDisplayName, | 326 media::kClearKeyCdmDisplayName, |
319 media::kClearKeyCdmPepperMimeType); | 327 media::kClearKeyCdmPepperMimeType); |
320 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) | 328 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) |
321 } | 329 } |
322 }; | 330 }; |
323 | 331 |
324 class EncryptedMediaSupportedTypesWidevineTest | 332 class EncryptedMediaSupportedTypesWidevineTest |
325 : public EncryptedMediaSupportedTypesTest { | 333 : public EncryptedMediaSupportedTypesTest { |
326 }; | 334 }; |
327 | 335 |
328 #if BUILDFLAG(ENABLE_PEPPER_CDMS) | 336 #if BUILDFLAG(ENABLE_PEPPER_CDMS) |
329 // Registers ClearKey CDM with the wrong path (filename). | 337 // Registers ClearKey CDM with the wrong path (filename). |
330 class EncryptedMediaSupportedTypesClearKeyCDMRegisteredWithWrongPathTest | 338 class EncryptedMediaSupportedTypesClearKeyCDMRegisteredWithWrongPathTest |
331 : public EncryptedMediaSupportedTypesTest { | 339 : public EncryptedMediaSupportedTypesTest { |
| 340 public: |
| 341 EncryptedMediaSupportedTypesClearKeyCDMRegisteredWithWrongPathTest() { |
| 342 scoped_feature_list_.InitAndEnableFeature( |
| 343 media::kExternalClearKeyForTesting); |
| 344 } |
| 345 |
332 protected: | 346 protected: |
333 void SetUpCommandLine(base::CommandLine* command_line) override { | 347 void SetUpCommandLine(base::CommandLine* command_line) override { |
334 EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line); | 348 EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line); |
335 RegisterPepperCdm(command_line, media::kClearKeyCdmBaseDirectory, | 349 RegisterPepperCdm(command_line, media::kClearKeyCdmBaseDirectory, |
336 "clearkeycdmadapterwrongname.dll", | 350 "clearkeycdmadapterwrongname.dll", |
337 media::kClearKeyCdmDisplayName, | 351 media::kClearKeyCdmDisplayName, |
338 media::kClearKeyCdmPepperMimeType, false); | 352 media::kClearKeyCdmPepperMimeType, false); |
339 command_line->AppendSwitchASCII(switches::kEnableFeatures, | |
340 media::kExternalClearKeyForTesting.name); | |
341 } | 353 } |
| 354 |
| 355 private: |
| 356 base::test::ScopedFeatureList scoped_feature_list_; |
342 }; | 357 }; |
343 | 358 |
344 // Registers Widevine CDM with the wrong path (filename). | 359 // Registers Widevine CDM with the wrong path (filename). |
345 class EncryptedMediaSupportedTypesWidevineCDMRegisteredWithWrongPathTest | 360 class EncryptedMediaSupportedTypesWidevineCDMRegisteredWithWrongPathTest |
346 : public EncryptedMediaSupportedTypesTest { | 361 : public EncryptedMediaSupportedTypesTest { |
347 protected: | 362 protected: |
348 void SetUpCommandLine(base::CommandLine* command_line) override { | 363 void SetUpCommandLine(base::CommandLine* command_line) override { |
349 EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line); | 364 EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line); |
350 RegisterPepperCdm(command_line, "WidevineCdm", | 365 RegisterPepperCdm(command_line, "WidevineCdm", |
351 "widevinecdmadapterwrongname.dll", | 366 "widevinecdmadapterwrongname.dll", |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 kVideoWebMMimeType, video_webm_codecs(), kWidevine)); | 833 kVideoWebMMimeType, video_webm_codecs(), kWidevine)); |
819 | 834 |
820 // Clear Key should still be registered. | 835 // Clear Key should still be registered. |
821 EXPECT_SUCCESS(AreCodecsSupportedByKeySystem(kVideoWebMMimeType, | 836 EXPECT_SUCCESS(AreCodecsSupportedByKeySystem(kVideoWebMMimeType, |
822 video_webm_codecs(), kClearKey)); | 837 video_webm_codecs(), kClearKey)); |
823 } | 838 } |
824 #endif // !defined(WIDEVINE_CDM_AVAILABLE) | 839 #endif // !defined(WIDEVINE_CDM_AVAILABLE) |
825 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) | 840 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) |
826 | 841 |
827 } // namespace chrome | 842 } // namespace chrome |
OLD | NEW |