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

Unified Diff: chrome/browser/media/encrypted_media_browsertest.cc

Issue 2910843002: [Cleanup] Move all browsertests to use ScopedFeatureList to modify features
Patch Set: Move SFL calls to constructor 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media/encrypted_media_browsertest.cc
diff --git a/chrome/browser/media/encrypted_media_browsertest.cc b/chrome/browser/media/encrypted_media_browsertest.cc
index 68352c0afa5f78fe57539dbe402dfeec4943a5ea..9041f34544952d7b783e0b5823f5ea66d5695ffd 100644
--- a/chrome/browser/media/encrypted_media_browsertest.cc
+++ b/chrome/browser/media/encrypted_media_browsertest.cc
@@ -281,21 +281,10 @@ class EncryptedMediaTestBase : public MediaBrowserTest {
}
#endif // BUILDFLAG(ENABLE_PEPPER_CDMS)
- void SetUpCommandLineForKeySystem(const std::string& key_system,
- CdmHostType cdm_host_type,
- base::CommandLine* command_line) {
- if (GetServerConfig(key_system))
- // Since the web and license servers listen on different ports, we need to
- // disable web-security to send license requests to the license server.
- // TODO(shadi): Add port forwarding to the test web server configuration.
- command_line->AppendSwitch(switches::kDisableWebSecurity);
-
+ void SetUpForKeySystem(const std::string& key_system,
+ CdmHostType cdm_host_type) {
#if BUILDFLAG(ENABLE_PEPPER_CDMS)
if (IsExternalClearKey(key_system)) {
- RegisterPepperCdm(command_line, media::kClearKeyCdmBaseDirectory,
- media::kClearKeyCdmAdapterFileName,
- media::kClearKeyCdmDisplayName,
- media::kClearKeyCdmPepperMimeType);
if (cdm_host_type == CdmHostType::kMojo) {
scoped_feature_list_.InitWithFeatures(
{media::kExternalClearKeyForTesting, media::kMojoCdm,
@@ -317,6 +306,24 @@ class EncryptedMediaTestBase : public MediaBrowserTest {
#endif // BUILDFLAG(ENABLE_PEPPER_CDMS)
}
+ void SetUpCommandLineForKeySystem(const std::string& key_system,
+ base::CommandLine* command_line) {
+ if (GetServerConfig(key_system))
+ // Since the web and license servers listen on different ports, we need to
+ // disable web-security to send license requests to the license server.
+ // TODO(shadi): Add port forwarding to the test web server configuration.
+ command_line->AppendSwitch(switches::kDisableWebSecurity);
+
+#if BUILDFLAG(ENABLE_PEPPER_CDMS)
+ if (IsExternalClearKey(key_system)) {
+ RegisterPepperCdm(command_line, media::kClearKeyCdmBaseDirectory,
+ media::kClearKeyCdmAdapterFileName,
+ media::kClearKeyCdmDisplayName,
+ media::kClearKeyCdmPepperMimeType);
+ }
+#endif // BUILDFLAG(ENABLE_PEPPER_CDMS)
+ }
+
base::test::ScopedFeatureList scoped_feature_list_;
};
@@ -326,6 +333,10 @@ class EncryptedMediaTestBase : public MediaBrowserTest {
class ECKEncryptedMediaTest : public EncryptedMediaTestBase,
public testing::WithParamInterface<CdmHostType> {
public:
+ ECKEncryptedMediaTest() {
+ SetUpForKeySystem(kExternalClearKeyKeySystem, GetParam());
+ }
+
// We use special |key_system| names to do non-playback related tests,
// e.g. kExternalClearKeyFileIOTestKeySystem is used to test file IO.
void TestNonPlaybackCases(const std::string& key_system,
@@ -352,19 +363,22 @@ class ECKEncryptedMediaTest : public EncryptedMediaTestBase,
protected:
void SetUpCommandLine(base::CommandLine* command_line) override {
EncryptedMediaTestBase::SetUpCommandLine(command_line);
- SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, GetParam(),
- command_line);
+ SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, command_line);
}
};
#if defined(WIDEVINE_CDM_AVAILABLE)
// Tests encrypted media playback using Widevine key system.
class WVEncryptedMediaTest : public EncryptedMediaTestBase {
+ public:
+ WVEncryptedMediaTest() {
+ SetUpForKeySystem(kWidevineKeySystem, CdmHostType::kPepper);
+ }
+
protected:
void SetUpCommandLine(base::CommandLine* command_line) override {
EncryptedMediaTestBase::SetUpCommandLine(command_line);
- SetUpCommandLineForKeySystem(kWidevineKeySystem, CdmHostType::kPepper,
- command_line);
+ SetUpCommandLineForKeySystem(kWidevineKeySystem, command_line);
}
};
@@ -383,6 +397,10 @@ class EncryptedMediaTest
public testing::WithParamInterface<
std::tr1::tuple<const char*, SrcType, CdmHostType>> {
public:
+ EncryptedMediaTest() {
+ SetUpForKeySystem(CurrentKeySystem(), CurrentCdmHostType());
+ }
+
std::string CurrentKeySystem() {
return std::tr1::get<0>(GetParam());
}
@@ -479,8 +497,7 @@ class EncryptedMediaTest
protected:
void SetUpCommandLine(base::CommandLine* command_line) override {
EncryptedMediaTestBase::SetUpCommandLine(command_line);
- SetUpCommandLineForKeySystem(CurrentKeySystem(), CurrentCdmHostType(),
- command_line);
+ SetUpCommandLineForKeySystem(CurrentKeySystem(), command_line);
}
};

Powered by Google App Engine
This is Rietveld 408576698