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

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: rebase update Created 3 years, 6 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 class EncryptedMediaSupportedTypesExternalClearKeyTest 297 class EncryptedMediaSupportedTypesExternalClearKeyTest
297 : public EncryptedMediaSupportedTypesTest { 298 : public EncryptedMediaSupportedTypesTest {
298 #if BUILDFLAG(ENABLE_PEPPER_CDMS) 299 #if BUILDFLAG(ENABLE_PEPPER_CDMS)
299 protected: 300 protected:
300 void SetUpCommandLine(base::CommandLine* command_line) override { 301 void SetUpCommandLine(base::CommandLine* command_line) override {
301 EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line); 302 EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line);
302 RegisterPepperCdm(command_line, media::kClearKeyCdmBaseDirectory, 303 RegisterPepperCdm(command_line, media::kClearKeyCdmBaseDirectory,
303 media::kClearKeyCdmAdapterFileName, 304 media::kClearKeyCdmAdapterFileName,
304 media::kClearKeyCdmDisplayName, 305 media::kClearKeyCdmDisplayName,
305 media::kClearKeyCdmPepperMimeType); 306 media::kClearKeyCdmPepperMimeType);
306 command_line->AppendSwitchASCII(switches::kEnableFeatures, 307 scoped_feature_list_.InitAndEnableFeature(
307 media::kExternalClearKeyForTesting.name); 308 media::kExternalClearKeyForTesting);
Ilya Sherman 2017/06/12 21:50:29 Could this be done outside of SetUpCommandLine()?
chaopeng 2017/06/28 19:21:22 Done.
308 } 309 }
310
311 private:
312 base::test::ScopedFeatureList scoped_feature_list_;
309 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) 313 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS)
310 }; 314 };
311 315
312 // By default, the External Clear Key (ECK) key system is not supported even if 316 // By default, the External Clear Key (ECK) key system is not supported even if
313 // present. This test case tests this behavior by not enabling 317 // present. This test case tests this behavior by not enabling
314 // kExternalClearKeyForTesting. 318 // kExternalClearKeyForTesting.
315 // Even registering the Pepper CDM where applicable does not enable the CDM. 319 // Even registering the Pepper CDM where applicable does not enable the CDM.
316 class EncryptedMediaSupportedTypesExternalClearKeyNotEnabledTest 320 class EncryptedMediaSupportedTypesExternalClearKeyNotEnabledTest
317 : public EncryptedMediaSupportedTypesTest { 321 : public EncryptedMediaSupportedTypesTest {
318 protected: 322 protected:
(...skipping 16 matching lines...) Expand all
335 // Registers ClearKey CDM with the wrong path (filename). 339 // Registers ClearKey CDM with the wrong path (filename).
336 class EncryptedMediaSupportedTypesClearKeyCDMRegisteredWithWrongPathTest 340 class EncryptedMediaSupportedTypesClearKeyCDMRegisteredWithWrongPathTest
337 : public EncryptedMediaSupportedTypesTest { 341 : public EncryptedMediaSupportedTypesTest {
338 protected: 342 protected:
339 void SetUpCommandLine(base::CommandLine* command_line) override { 343 void SetUpCommandLine(base::CommandLine* command_line) override {
340 EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line); 344 EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line);
341 RegisterPepperCdm(command_line, media::kClearKeyCdmBaseDirectory, 345 RegisterPepperCdm(command_line, media::kClearKeyCdmBaseDirectory,
342 "clearkeycdmadapterwrongname.dll", 346 "clearkeycdmadapterwrongname.dll",
343 media::kClearKeyCdmDisplayName, 347 media::kClearKeyCdmDisplayName,
344 media::kClearKeyCdmPepperMimeType, false); 348 media::kClearKeyCdmPepperMimeType, false);
345 command_line->AppendSwitchASCII(switches::kEnableFeatures, 349
346 media::kExternalClearKeyForTesting.name); 350 scoped_feature_list_.InitAndEnableFeature(
351 media::kExternalClearKeyForTesting);
Ilya Sherman 2017/06/12 21:50:29 Could this be done outside of SetUpCommandLine()?
chaopeng 2017/06/28 19:21:22 Done.
347 } 352 }
353
354 private:
355 base::test::ScopedFeatureList scoped_feature_list_;
348 }; 356 };
349 357
350 // Registers Widevine CDM with the wrong path (filename). 358 // Registers Widevine CDM with the wrong path (filename).
351 class EncryptedMediaSupportedTypesWidevineCDMRegisteredWithWrongPathTest 359 class EncryptedMediaSupportedTypesWidevineCDMRegisteredWithWrongPathTest
352 : public EncryptedMediaSupportedTypesTest { 360 : public EncryptedMediaSupportedTypesTest {
353 protected: 361 protected:
354 void SetUpCommandLine(base::CommandLine* command_line) override { 362 void SetUpCommandLine(base::CommandLine* command_line) override {
355 EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line); 363 EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line);
356 RegisterPepperCdm(command_line, "WidevineCdm", 364 RegisterPepperCdm(command_line, "WidevineCdm",
357 "widevinecdmadapterwrongname.dll", 365 "widevinecdmadapterwrongname.dll",
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 kVideoWebMMimeType, video_webm_codecs(), kWidevine)); 832 kVideoWebMMimeType, video_webm_codecs(), kWidevine));
825 833
826 // Clear Key should still be registered. 834 // Clear Key should still be registered.
827 EXPECT_SUCCESS(AreCodecsSupportedByKeySystem(kVideoWebMMimeType, 835 EXPECT_SUCCESS(AreCodecsSupportedByKeySystem(kVideoWebMMimeType,
828 video_webm_codecs(), kClearKey)); 836 video_webm_codecs(), kClearKey));
829 } 837 }
830 #endif // !defined(WIDEVINE_CDM_AVAILABLE) 838 #endif // !defined(WIDEVINE_CDM_AVAILABLE)
831 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) 839 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS)
832 840
833 } // namespace chrome 841 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698