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 1417d93bdb94f2f7c8e8a3e8c1a1e9886e27d008..88497ce88bd43ac5f40bb14d55d91b57a9fb8433 100644 |
--- a/chrome/browser/media/encrypted_media_browsertest.cc |
+++ b/chrome/browser/media/encrypted_media_browsertest.cc |
@@ -281,8 +281,22 @@ class EncryptedMediaTestBase : public MediaBrowserTest { |
} |
#endif // BUILDFLAG(ENABLE_PEPPER_CDMS) |
+ void SetUpForKeySystem(const std::string& key_system, |
+ CdmHostType cdm_host_type) { |
+#if BUILDFLAG(ENABLE_PEPPER_CDMS) |
+ if (IsExternalClearKey(key_system)) { |
+ if (cdm_host_type == CdmHostType::kMojo) { |
+ scoped_feature_list_.InitWithFeatures( |
+ {media::kExternalClearKeyForTesting, media::kMojoCdm}, {}); |
+ } else { |
+ scoped_feature_list_.InitWithFeatures( |
+ {media::kExternalClearKeyForTesting}, {}); |
+ } |
+ } |
+#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 |
@@ -296,13 +310,6 @@ class EncryptedMediaTestBase : public MediaBrowserTest { |
media::kClearKeyCdmAdapterFileName, |
media::kClearKeyCdmDisplayName, |
media::kClearKeyCdmPepperMimeType); |
- if (cdm_host_type == CdmHostType::kMojo) { |
- scoped_feature_list_.InitWithFeatures( |
- {media::kExternalClearKeyForTesting, media::kMojoCdm}, {}); |
- } else { |
- scoped_feature_list_.InitWithFeatures( |
- {media::kExternalClearKeyForTesting}, {}); |
- } |
} |
#endif // BUILDFLAG(ENABLE_PEPPER_CDMS) |
} |
@@ -340,10 +347,14 @@ class ECKEncryptedMediaTest : public EncryptedMediaTestBase, |
bool IsUsingMojoCdm() const { return GetParam() == CdmHostType::kMojo; } |
protected: |
+ void SetUp() override { |
+ SetUpForKeySystem(kExternalClearKeyKeySystem, GetParam()); |
+ EncryptedMediaTestBase::SetUp(); |
+ } |
+ |
void SetUpCommandLine(base::CommandLine* command_line) override { |
EncryptedMediaTestBase::SetUpCommandLine(command_line); |
- SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, GetParam(), |
- command_line); |
+ SetUpCommandLineForKeySystem(kExternalClearKeyKeySystem, command_line); |
} |
}; |
@@ -351,10 +362,14 @@ class ECKEncryptedMediaTest : public EncryptedMediaTestBase, |
// Tests encrypted media playback using Widevine key system. |
class WVEncryptedMediaTest : public EncryptedMediaTestBase { |
protected: |
+ void SetUp() override { |
+ SetUpForKeySystem(kWidevineKeySystem, CdmHostType::kPepper); |
+ EncryptedMediaTestBase::SetUp(); |
+ } |
+ |
void SetUpCommandLine(base::CommandLine* command_line) override { |
EncryptedMediaTestBase::SetUpCommandLine(command_line); |
- SetUpCommandLineForKeySystem(kWidevineKeySystem, CdmHostType::kPepper, |
- command_line); |
+ SetUpCommandLineForKeySystem(kWidevineKeySystem, command_line); |
} |
}; |
@@ -467,10 +482,14 @@ class EncryptedMediaTest |
} |
protected: |
+ void SetUp() override { |
+ SetUpForKeySystem(CurrentKeySystem(), CurrentCdmHostType()); |
+ EncryptedMediaTestBase::SetUp(); |
+ } |
+ |
void SetUpCommandLine(base::CommandLine* command_line) override { |
EncryptedMediaTestBase::SetUpCommandLine(command_line); |
- SetUpCommandLineForKeySystem(CurrentKeySystem(), CurrentCdmHostType(), |
- command_line); |
+ SetUpCommandLineForKeySystem(CurrentKeySystem(), command_line); |
} |
}; |