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

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

Issue 2910843002: [Cleanup] Move all browsertests to use ScopedFeatureList to modify features
Patch Set: Ilya comments addressed Created 3 years, 5 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 <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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 288
288 // For ClearKey, nothing additional is required. 289 // For ClearKey, nothing additional is required.
289 class EncryptedMediaSupportedTypesClearKeyTest 290 class EncryptedMediaSupportedTypesClearKeyTest
290 : public EncryptedMediaSupportedTypesTest { 291 : public EncryptedMediaSupportedTypesTest {
291 }; 292 };
292 293
293 // For ExternalClearKey tests, ensure that the ClearKey adapter is loaded. 294 // For ExternalClearKey tests, ensure that the ClearKey adapter is loaded.
294 class EncryptedMediaSupportedTypesExternalClearKeyTest 295 class EncryptedMediaSupportedTypesExternalClearKeyTest
295 : public EncryptedMediaSupportedTypesTest { 296 : public EncryptedMediaSupportedTypesTest {
296 #if BUILDFLAG(ENABLE_PEPPER_CDMS) 297 #if BUILDFLAG(ENABLE_PEPPER_CDMS)
298 void SetUp() override {
299 scoped_feature_list_.InitAndEnableFeature(
300 media::kExternalClearKeyForTesting);
301 EncryptedMediaSupportedTypesTest::SetUp();
302 }
303
297 protected: 304 protected:
298 void SetUpCommandLine(base::CommandLine* command_line) override { 305 void SetUpCommandLine(base::CommandLine* command_line) override {
299 EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line); 306 EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line);
300 RegisterPepperCdm(command_line, media::kClearKeyCdmBaseDirectory, 307 RegisterPepperCdm(command_line, media::kClearKeyCdmBaseDirectory,
301 media::kClearKeyCdmAdapterFileName, 308 media::kClearKeyCdmAdapterFileName,
302 media::kClearKeyCdmDisplayName, 309 media::kClearKeyCdmDisplayName,
303 media::kClearKeyCdmPepperMimeType); 310 media::kClearKeyCdmPepperMimeType);
304 command_line->AppendSwitchASCII(switches::kEnableFeatures,
305 media::kExternalClearKeyForTesting.name);
306 } 311 }
312
313 private:
314 base::test::ScopedFeatureList scoped_feature_list_;
307 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) 315 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS)
308 }; 316 };
309 317
310 // By default, the External Clear Key (ECK) key system is not supported even if 318 // By default, the External Clear Key (ECK) key system is not supported even if
311 // present. This test case tests this behavior by not enabling 319 // present. This test case tests this behavior by not enabling
312 // kExternalClearKeyForTesting. 320 // kExternalClearKeyForTesting.
313 // Even registering the Pepper CDM where applicable does not enable the CDM. 321 // Even registering the Pepper CDM where applicable does not enable the CDM.
314 class EncryptedMediaSupportedTypesExternalClearKeyNotEnabledTest 322 class EncryptedMediaSupportedTypesExternalClearKeyNotEnabledTest
315 : public EncryptedMediaSupportedTypesTest { 323 : public EncryptedMediaSupportedTypesTest {
316 protected: 324 protected:
(...skipping 10 matching lines...) Expand all
327 335
328 class EncryptedMediaSupportedTypesWidevineTest 336 class EncryptedMediaSupportedTypesWidevineTest
329 : public EncryptedMediaSupportedTypesTest { 337 : public EncryptedMediaSupportedTypesTest {
330 }; 338 };
331 339
332 #if BUILDFLAG(ENABLE_PEPPER_CDMS) 340 #if BUILDFLAG(ENABLE_PEPPER_CDMS)
333 // Registers ClearKey CDM with the wrong path (filename). 341 // Registers ClearKey CDM with the wrong path (filename).
334 class EncryptedMediaSupportedTypesClearKeyCDMRegisteredWithWrongPathTest 342 class EncryptedMediaSupportedTypesClearKeyCDMRegisteredWithWrongPathTest
335 : public EncryptedMediaSupportedTypesTest { 343 : public EncryptedMediaSupportedTypesTest {
336 protected: 344 protected:
345 void SetUp() override {
346 scoped_feature_list_.InitAndEnableFeature(
347 media::kExternalClearKeyForTesting);
348 EncryptedMediaSupportedTypesTest::SetUp();
349 }
337 void SetUpCommandLine(base::CommandLine* command_line) override { 350 void SetUpCommandLine(base::CommandLine* command_line) override {
338 EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line); 351 EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line);
339 RegisterPepperCdm(command_line, media::kClearKeyCdmBaseDirectory, 352 RegisterPepperCdm(command_line, media::kClearKeyCdmBaseDirectory,
340 "clearkeycdmadapterwrongname.dll", 353 "clearkeycdmadapterwrongname.dll",
341 media::kClearKeyCdmDisplayName, 354 media::kClearKeyCdmDisplayName,
342 media::kClearKeyCdmPepperMimeType, false); 355 media::kClearKeyCdmPepperMimeType, false);
343 command_line->AppendSwitchASCII(switches::kEnableFeatures,
344 media::kExternalClearKeyForTesting.name);
345 } 356 }
357
358 private:
359 base::test::ScopedFeatureList scoped_feature_list_;
346 }; 360 };
347 361
348 // Registers Widevine CDM with the wrong path (filename). 362 // Registers Widevine CDM with the wrong path (filename).
349 class EncryptedMediaSupportedTypesWidevineCDMRegisteredWithWrongPathTest 363 class EncryptedMediaSupportedTypesWidevineCDMRegisteredWithWrongPathTest
350 : public EncryptedMediaSupportedTypesTest { 364 : public EncryptedMediaSupportedTypesTest {
351 protected: 365 protected:
352 void SetUpCommandLine(base::CommandLine* command_line) override { 366 void SetUpCommandLine(base::CommandLine* command_line) override {
353 EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line); 367 EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line);
354 RegisterPepperCdm(command_line, "WidevineCdm", 368 RegisterPepperCdm(command_line, "WidevineCdm",
355 "widevinecdmadapterwrongname.dll", 369 "widevinecdmadapterwrongname.dll",
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 kVideoWebMMimeType, video_webm_codecs(), kWidevine)); 836 kVideoWebMMimeType, video_webm_codecs(), kWidevine));
823 837
824 // Clear Key should still be registered. 838 // Clear Key should still be registered.
825 EXPECT_SUCCESS(AreCodecsSupportedByKeySystem(kVideoWebMMimeType, 839 EXPECT_SUCCESS(AreCodecsSupportedByKeySystem(kVideoWebMMimeType,
826 video_webm_codecs(), kClearKey)); 840 video_webm_codecs(), kClearKey));
827 } 841 }
828 #endif // !defined(WIDEVINE_CDM_AVAILABLE) 842 #endif // !defined(WIDEVINE_CDM_AVAILABLE)
829 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) 843 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS)
830 844
831 } // namespace chrome 845 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698