summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorjrummell <jrummell@chromium.org>2015-04-21 15:28:34 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-21 22:28:58 +0000
commit01db4c8321aee76ce432561ef492fecb833a6363 (patch)
tree5932b9fbd192f4ac093a071de9e3e63bdca90700 /media
parent0044897feca3e12b01ea0f50939b5a5eb33c6046 (diff)
downloadchromium_src-01db4c8321aee76ce432561ef492fecb833a6363.zip
chromium_src-01db4c8321aee76ce432561ef492fecb833a6363.tar.gz
chromium_src-01db4c8321aee76ce432561ef492fecb833a6363.tar.bz2
Change enums in eme_constants.h to enum classes
BUG=473830 TEST=media_unittests pass Review URL: https://codereview.chromium.org/1093253002 Cr-Commit-Position: refs/heads/master@{#326147}
Diffstat (limited to 'media')
-rw-r--r--media/base/eme_constants.h27
-rw-r--r--media/base/key_system_info.cc8
-rw-r--r--media/base/key_systems.cc48
-rw-r--r--media/base/key_systems_unittest.cc17
-rw-r--r--media/blink/key_system_config_selector.cc98
-rw-r--r--media/blink/key_system_config_selector_unittest.cc48
6 files changed, 118 insertions, 128 deletions
diff --git a/media/base/eme_constants.h b/media/base/eme_constants.h
index 8bb3883..0b24670 100644
--- a/media/base/eme_constants.h
+++ b/media/base/eme_constants.h
@@ -58,37 +58,30 @@ enum EmeCodec {
typedef uint32_t SupportedCodecs;
-enum EmeSessionTypeSupport {
+enum class EmeSessionTypeSupport {
// Invalid default value.
- EME_SESSION_TYPE_INVALID,
+ INVALID,
// The session type is not supported.
- EME_SESSION_TYPE_NOT_SUPPORTED,
+ NOT_SUPPORTED,
// The session type is supported if a distinctive identifier is available.
- EME_SESSION_TYPE_SUPPORTED_WITH_IDENTIFIER,
+ SUPPORTED_WITH_IDENTIFIER,
// The session type is always supported.
- EME_SESSION_TYPE_SUPPORTED,
+ SUPPORTED,
};
// Used to declare support for distinctive identifier and persistent state.
// These are purposefully limited to not allow one to require the other, so that
// transitive requirements are not possible. Non-trivial refactoring would be
// required to support transitive requirements.
-enum EmeFeatureSupport {
+enum class EmeFeatureSupport {
// Invalid default value.
- EME_FEATURE_INVALID,
+ INVALID,
// Access to the feature is not supported at all.
- EME_FEATURE_NOT_SUPPORTED,
+ NOT_SUPPORTED,
// Access to the feature may be requested.
- EME_FEATURE_REQUESTABLE,
+ REQUESTABLE,
// Access to the feature cannot be blocked.
- EME_FEATURE_ALWAYS_ENABLED,
-};
-
-// Used to query support for distinctive identifier and persistent state.
-enum EmeFeatureRequirement {
- EME_FEATURE_NOT_ALLOWED,
- EME_FEATURE_OPTIONAL,
- EME_FEATURE_REQUIRED,
+ ALWAYS_ENABLED,
};
enum class EmeMediaType {
diff --git a/media/base/key_system_info.cc b/media/base/key_system_info.cc
index f5ca112..8eec5b1 100644
--- a/media/base/key_system_info.cc
+++ b/media/base/key_system_info.cc
@@ -11,10 +11,10 @@ KeySystemInfo::KeySystemInfo()
supported_codecs(EME_CODEC_NONE),
max_audio_robustness(EmeRobustness::INVALID),
max_video_robustness(EmeRobustness::INVALID),
- persistent_license_support(EME_SESSION_TYPE_INVALID),
- persistent_release_message_support(EME_SESSION_TYPE_INVALID),
- persistent_state_support(EME_FEATURE_INVALID),
- distinctive_identifier_support(EME_FEATURE_INVALID),
+ persistent_license_support(EmeSessionTypeSupport::INVALID),
+ persistent_release_message_support(EmeSessionTypeSupport::INVALID),
+ persistent_state_support(EmeFeatureSupport::INVALID),
+ distinctive_identifier_support(EmeFeatureSupport::INVALID),
use_aes_decryptor(false) {
}
diff --git a/media/base/key_systems.cc b/media/base/key_systems.cc
index 7bbbde7..f899925 100644
--- a/media/base/key_systems.cc
+++ b/media/base/key_systems.cc
@@ -108,10 +108,11 @@ static void AddClearKey(std::vector<KeySystemInfo>* concrete_key_systems) {
info.max_audio_robustness = EmeRobustness::EMPTY;
info.max_video_robustness = EmeRobustness::EMPTY;
- info.persistent_license_support = EME_SESSION_TYPE_NOT_SUPPORTED;
- info.persistent_release_message_support = EME_SESSION_TYPE_NOT_SUPPORTED;
- info.persistent_state_support = EME_FEATURE_NOT_SUPPORTED;
- info.distinctive_identifier_support = EME_FEATURE_NOT_SUPPORTED;
+ info.persistent_license_support = EmeSessionTypeSupport::NOT_SUPPORTED;
+ info.persistent_release_message_support =
+ EmeSessionTypeSupport::NOT_SUPPORTED;
+ info.persistent_state_support = EmeFeatureSupport::NOT_SUPPORTED;
+ info.distinctive_identifier_support = EmeFeatureSupport::NOT_SUPPORTED;
info.use_aes_decryptor = true;
@@ -400,31 +401,34 @@ void KeySystemsImpl::AddConcreteSupportedKeySystems(
DCHECK(!info.key_system.empty());
DCHECK(info.max_audio_robustness != EmeRobustness::INVALID);
DCHECK(info.max_video_robustness != EmeRobustness::INVALID);
- DCHECK(info.persistent_license_support != EME_SESSION_TYPE_INVALID);
- DCHECK(info.persistent_release_message_support != EME_SESSION_TYPE_INVALID);
- DCHECK(info.persistent_state_support != EME_FEATURE_INVALID);
- DCHECK(info.distinctive_identifier_support != EME_FEATURE_INVALID);
+ DCHECK(info.persistent_license_support != EmeSessionTypeSupport::INVALID);
+ DCHECK(info.persistent_release_message_support !=
+ EmeSessionTypeSupport::INVALID);
+ DCHECK(info.persistent_state_support != EmeFeatureSupport::INVALID);
+ DCHECK(info.distinctive_identifier_support != EmeFeatureSupport::INVALID);
// Supporting persistent state is a prerequsite for supporting persistent
// sessions.
- if (info.persistent_state_support == EME_FEATURE_NOT_SUPPORTED) {
- DCHECK(info.persistent_license_support == EME_SESSION_TYPE_NOT_SUPPORTED);
+ if (info.persistent_state_support == EmeFeatureSupport::NOT_SUPPORTED) {
+ DCHECK(info.persistent_license_support ==
+ EmeSessionTypeSupport::NOT_SUPPORTED);
DCHECK(info.persistent_release_message_support ==
- EME_SESSION_TYPE_NOT_SUPPORTED);
+ EmeSessionTypeSupport::NOT_SUPPORTED);
}
// persistent-release-message sessions are not currently supported.
// http://crbug.com/448888
DCHECK(info.persistent_release_message_support ==
- EME_SESSION_TYPE_NOT_SUPPORTED);
+ EmeSessionTypeSupport::NOT_SUPPORTED);
// If distinctive identifiers are not supported, then no other features can
// require them.
- if (info.distinctive_identifier_support == EME_FEATURE_NOT_SUPPORTED) {
+ if (info.distinctive_identifier_support ==
+ EmeFeatureSupport::NOT_SUPPORTED) {
DCHECK(info.persistent_license_support !=
- EME_SESSION_TYPE_SUPPORTED_WITH_IDENTIFIER);
+ EmeSessionTypeSupport::SUPPORTED_WITH_IDENTIFIER);
DCHECK(info.persistent_release_message_support !=
- EME_SESSION_TYPE_SUPPORTED_WITH_IDENTIFIER);
+ EmeSessionTypeSupport::SUPPORTED_WITH_IDENTIFIER);
}
// Distinctive identifiers and persistent state can only be reliably blocked
@@ -438,8 +442,10 @@ void KeySystemsImpl::AddConcreteSupportedKeySystems(
can_block = true;
#endif
if (!can_block) {
- DCHECK(info.distinctive_identifier_support == EME_FEATURE_ALWAYS_ENABLED);
- DCHECK(info.persistent_state_support == EME_FEATURE_ALWAYS_ENABLED);
+ DCHECK(info.distinctive_identifier_support ==
+ EmeFeatureSupport::ALWAYS_ENABLED);
+ DCHECK(info.persistent_state_support ==
+ EmeFeatureSupport::ALWAYS_ENABLED);
}
DCHECK(!IsSupportedKeySystem(info.key_system))
@@ -776,7 +782,7 @@ EmeSessionTypeSupport KeySystemsImpl::GetPersistentLicenseSessionSupport(
concrete_key_system_map_.find(key_system);
if (key_system_iter == concrete_key_system_map_.end()) {
NOTREACHED();
- return EME_SESSION_TYPE_INVALID;
+ return EmeSessionTypeSupport::INVALID;
}
return key_system_iter->second.persistent_license_support;
}
@@ -789,7 +795,7 @@ EmeSessionTypeSupport KeySystemsImpl::GetPersistentReleaseMessageSessionSupport(
concrete_key_system_map_.find(key_system);
if (key_system_iter == concrete_key_system_map_.end()) {
NOTREACHED();
- return EME_SESSION_TYPE_INVALID;
+ return EmeSessionTypeSupport::INVALID;
}
return key_system_iter->second.persistent_release_message_support;
}
@@ -802,7 +808,7 @@ EmeFeatureSupport KeySystemsImpl::GetPersistentStateSupport(
concrete_key_system_map_.find(key_system);
if (key_system_iter == concrete_key_system_map_.end()) {
NOTREACHED();
- return EME_FEATURE_INVALID;
+ return EmeFeatureSupport::INVALID;
}
return key_system_iter->second.persistent_state_support;
}
@@ -815,7 +821,7 @@ EmeFeatureSupport KeySystemsImpl::GetDistinctiveIdentifierSupport(
concrete_key_system_map_.find(key_system);
if (key_system_iter == concrete_key_system_map_.end()) {
NOTREACHED();
- return EME_FEATURE_INVALID;
+ return EmeFeatureSupport::INVALID;
}
return key_system_iter->second.distinctive_identifier_support;
}
diff --git a/media/base/key_systems_unittest.cc b/media/base/key_systems_unittest.cc
index b80e6a1..611c2b6 100644
--- a/media/base/key_systems_unittest.cc
+++ b/media/base/key_systems_unittest.cc
@@ -193,10 +193,11 @@ void TestMediaClient::AddUsesAesKeySystem(
system.supported_init_data_types = kInitDataTypeMaskWebM;
system.max_audio_robustness = EmeRobustness::EMPTY;
system.max_video_robustness = EmeRobustness::EMPTY;
- system.persistent_license_support = EME_SESSION_TYPE_NOT_SUPPORTED;
- system.persistent_release_message_support = EME_SESSION_TYPE_NOT_SUPPORTED;
- system.persistent_state_support = EME_FEATURE_NOT_SUPPORTED;
- system.distinctive_identifier_support = EME_FEATURE_NOT_SUPPORTED;
+ system.persistent_license_support = EmeSessionTypeSupport::NOT_SUPPORTED;
+ system.persistent_release_message_support =
+ EmeSessionTypeSupport::NOT_SUPPORTED;
+ system.persistent_state_support = EmeFeatureSupport::NOT_SUPPORTED;
+ system.distinctive_identifier_support = EmeFeatureSupport::NOT_SUPPORTED;
system.use_aes_decryptor = true;
key_systems->push_back(system);
}
@@ -210,10 +211,10 @@ void TestMediaClient::AddExternalKeySystem(
ext.supported_init_data_types = kInitDataTypeMaskWebM;
ext.max_audio_robustness = EmeRobustness::EMPTY;
ext.max_video_robustness = EmeRobustness::EMPTY;
- ext.persistent_license_support = EME_SESSION_TYPE_SUPPORTED;
- ext.persistent_release_message_support = EME_SESSION_TYPE_NOT_SUPPORTED;
- ext.persistent_state_support = EME_FEATURE_ALWAYS_ENABLED;
- ext.distinctive_identifier_support = EME_FEATURE_ALWAYS_ENABLED;
+ ext.persistent_license_support = EmeSessionTypeSupport::SUPPORTED;
+ ext.persistent_release_message_support = EmeSessionTypeSupport::NOT_SUPPORTED;
+ ext.persistent_state_support = EmeFeatureSupport::ALWAYS_ENABLED;
+ ext.distinctive_identifier_support = EmeFeatureSupport::ALWAYS_ENABLED;
ext.parent_key_system = kExternalParent;
#if defined(ENABLE_PEPPER_CDMS)
ext.pepper_type = "application/x-ppapi-external-cdm";
diff --git a/media/blink/key_system_config_selector.cc b/media/blink/key_system_config_selector.cc
index 769f973..67a13e2 100644
--- a/media/blink/key_system_config_selector.cc
+++ b/media/blink/key_system_config_selector.cc
@@ -20,33 +20,21 @@
namespace media {
-namespace {
-
-static EmeFeatureRequirement ConvertRequirement(
- blink::WebMediaKeySystemConfiguration::Requirement requirement) {
- switch (requirement) {
- case blink::WebMediaKeySystemConfiguration::Requirement::Required:
- return EME_FEATURE_REQUIRED;
- case blink::WebMediaKeySystemConfiguration::Requirement::Optional:
- return EME_FEATURE_OPTIONAL;
- case blink::WebMediaKeySystemConfiguration::Requirement::NotAllowed:
- return EME_FEATURE_NOT_ALLOWED;
- }
+using EmeFeatureRequirement =
+ blink::WebMediaKeySystemConfiguration::Requirement;
- NOTREACHED();
- return EME_FEATURE_NOT_ALLOWED;
-}
+namespace {
static EmeConfigRule GetSessionTypeConfigRule(EmeSessionTypeSupport support) {
switch (support) {
- case EME_SESSION_TYPE_INVALID:
+ case EmeSessionTypeSupport::INVALID:
NOTREACHED();
return EmeConfigRule::NOT_SUPPORTED;
- case EME_SESSION_TYPE_NOT_SUPPORTED:
+ case EmeSessionTypeSupport::NOT_SUPPORTED:
return EmeConfigRule::NOT_SUPPORTED;
- case EME_SESSION_TYPE_SUPPORTED_WITH_IDENTIFIER:
+ case EmeSessionTypeSupport::SUPPORTED_WITH_IDENTIFIER:
return EmeConfigRule::IDENTIFIER_AND_PERSISTENCE_REQUIRED;
- case EME_SESSION_TYPE_SUPPORTED:
+ case EmeSessionTypeSupport::SUPPORTED:
return EmeConfigRule::PERSISTENCE_REQUIRED;
}
NOTREACHED();
@@ -56,7 +44,7 @@ static EmeConfigRule GetSessionTypeConfigRule(EmeSessionTypeSupport support) {
static EmeConfigRule GetDistinctiveIdentifierConfigRule(
EmeFeatureSupport support,
EmeFeatureRequirement requirement) {
- if (support == EME_FEATURE_INVALID) {
+ if (support == EmeFeatureSupport::INVALID) {
NOTREACHED();
return EmeConfigRule::NOT_SUPPORTED;
}
@@ -70,24 +58,24 @@ static EmeConfigRule GetDistinctiveIdentifierConfigRule(
// NOT_SUPPORTED I_NOT_ALLOWED I_NOT_ALLOWED NOT_SUPPORTED
// REQUESTABLE I_NOT_ALLOWED SUPPORTED I_REQUIRED
// ALWAYS_ENABLED NOT_SUPPORTED I_REQUIRED I_REQUIRED
- DCHECK(support == EME_FEATURE_NOT_SUPPORTED ||
- support == EME_FEATURE_REQUESTABLE ||
- support == EME_FEATURE_ALWAYS_ENABLED);
- DCHECK(requirement == EME_FEATURE_NOT_ALLOWED ||
- requirement == EME_FEATURE_OPTIONAL ||
- requirement == EME_FEATURE_REQUIRED);
- if ((support == EME_FEATURE_NOT_SUPPORTED &&
- requirement == EME_FEATURE_REQUIRED) ||
- (support == EME_FEATURE_ALWAYS_ENABLED &&
- requirement == EME_FEATURE_NOT_ALLOWED)) {
+ DCHECK(support == EmeFeatureSupport::NOT_SUPPORTED ||
+ support == EmeFeatureSupport::REQUESTABLE ||
+ support == EmeFeatureSupport::ALWAYS_ENABLED);
+ DCHECK(requirement == EmeFeatureRequirement::NotAllowed ||
+ requirement == EmeFeatureRequirement::Optional ||
+ requirement == EmeFeatureRequirement::Required);
+ if ((support == EmeFeatureSupport::NOT_SUPPORTED &&
+ requirement == EmeFeatureRequirement::Required) ||
+ (support == EmeFeatureSupport::ALWAYS_ENABLED &&
+ requirement == EmeFeatureRequirement::NotAllowed)) {
return EmeConfigRule::NOT_SUPPORTED;
}
- if (support == EME_FEATURE_REQUESTABLE &&
- requirement == EME_FEATURE_OPTIONAL) {
+ if (support == EmeFeatureSupport::REQUESTABLE &&
+ requirement == EmeFeatureRequirement::Optional) {
return EmeConfigRule::SUPPORTED;
}
- if (support == EME_FEATURE_NOT_SUPPORTED ||
- requirement == EME_FEATURE_NOT_ALLOWED) {
+ if (support == EmeFeatureSupport::NOT_SUPPORTED ||
+ requirement == EmeFeatureRequirement::NotAllowed) {
return EmeConfigRule::IDENTIFIER_NOT_ALLOWED;
}
return EmeConfigRule::IDENTIFIER_REQUIRED;
@@ -96,7 +84,7 @@ static EmeConfigRule GetDistinctiveIdentifierConfigRule(
static EmeConfigRule GetPersistentStateConfigRule(
EmeFeatureSupport support,
EmeFeatureRequirement requirement) {
- if (support == EME_FEATURE_INVALID) {
+ if (support == EmeFeatureSupport::INVALID) {
NOTREACHED();
return EmeConfigRule::NOT_SUPPORTED;
}
@@ -113,24 +101,24 @@ static EmeConfigRule GetPersistentStateConfigRule(
// NOT_SUPPORTED P_NOT_ALLOWED P_NOT_ALLOWED NOT_SUPPORTED
// REQUESTABLE P_NOT_ALLOWED SUPPORTED P_REQUIRED
// ALWAYS_ENABLED NOT_SUPPORTED P_REQUIRED P_REQUIRED
- DCHECK(support == EME_FEATURE_NOT_SUPPORTED ||
- support == EME_FEATURE_REQUESTABLE ||
- support == EME_FEATURE_ALWAYS_ENABLED);
- DCHECK(requirement == EME_FEATURE_NOT_ALLOWED ||
- requirement == EME_FEATURE_OPTIONAL ||
- requirement == EME_FEATURE_REQUIRED);
- if ((support == EME_FEATURE_NOT_SUPPORTED &&
- requirement == EME_FEATURE_REQUIRED) ||
- (support == EME_FEATURE_ALWAYS_ENABLED &&
- requirement == EME_FEATURE_NOT_ALLOWED)) {
+ DCHECK(support == EmeFeatureSupport::NOT_SUPPORTED ||
+ support == EmeFeatureSupport::REQUESTABLE ||
+ support == EmeFeatureSupport::ALWAYS_ENABLED);
+ DCHECK(requirement == EmeFeatureRequirement::NotAllowed ||
+ requirement == EmeFeatureRequirement::Optional ||
+ requirement == EmeFeatureRequirement::Required);
+ if ((support == EmeFeatureSupport::NOT_SUPPORTED &&
+ requirement == EmeFeatureRequirement::Required) ||
+ (support == EmeFeatureSupport::ALWAYS_ENABLED &&
+ requirement == EmeFeatureRequirement::NotAllowed)) {
return EmeConfigRule::NOT_SUPPORTED;
}
- if (support == EME_FEATURE_REQUESTABLE &&
- requirement == EME_FEATURE_OPTIONAL) {
+ if (support == EmeFeatureSupport::REQUESTABLE &&
+ requirement == EmeFeatureRequirement::Optional) {
return EmeConfigRule::SUPPORTED;
}
- if (support == EME_FEATURE_NOT_SUPPORTED ||
- requirement == EME_FEATURE_NOT_ALLOWED) {
+ if (support == EmeFeatureSupport::NOT_SUPPORTED ||
+ requirement == EmeFeatureRequirement::NotAllowed) {
return EmeConfigRule::PERSISTENCE_NOT_ALLOWED;
}
return EmeConfigRule::PERSISTENCE_REQUIRED;
@@ -426,7 +414,7 @@ KeySystemConfigSelector::GetSupportedConfiguration(
// permission has already been denied. This would happen anyway at step 11.
EmeConfigRule di_rule = GetDistinctiveIdentifierConfigRule(
key_systems_->GetDistinctiveIdentifierSupport(key_system),
- ConvertRequirement(candidate.distinctiveIdentifier));
+ candidate.distinctiveIdentifier);
if (!config_state->IsRuleSupported(di_rule)) {
DVLOG(2) << "Rejecting requested configuration because "
<< "the distinctiveIdentifier requirement was not supported.";
@@ -448,7 +436,7 @@ KeySystemConfigSelector::GetSupportedConfiguration(
// combination with accumulated configuration, return null.
EmeConfigRule ps_rule = GetPersistentStateConfigRule(
key_systems_->GetPersistentStateSupport(key_system),
- ConvertRequirement(candidate.persistentState));
+ candidate.persistentState);
if (!config_state->IsRuleSupported(ps_rule)) {
DVLOG(2) << "Rejecting requested configuration because "
<< "the persistentState requirement was not supported.";
@@ -565,10 +553,10 @@ KeySystemConfigSelector::GetSupportedConfiguration(
blink::WebMediaKeySystemConfiguration::Requirement::Optional) {
EmeConfigRule not_allowed_rule = GetDistinctiveIdentifierConfigRule(
key_systems_->GetDistinctiveIdentifierSupport(key_system),
- EME_FEATURE_NOT_ALLOWED);
+ EmeFeatureRequirement::NotAllowed);
EmeConfigRule required_rule = GetDistinctiveIdentifierConfigRule(
key_systems_->GetDistinctiveIdentifierSupport(key_system),
- EME_FEATURE_REQUIRED);
+ EmeFeatureRequirement::Required);
bool not_allowed_supported =
config_state->IsRuleSupported(not_allowed_rule);
bool required_supported = config_state->IsRuleSupported(required_rule);
@@ -605,10 +593,10 @@ KeySystemConfigSelector::GetSupportedConfiguration(
blink::WebMediaKeySystemConfiguration::Requirement::Optional) {
EmeConfigRule not_allowed_rule = GetPersistentStateConfigRule(
key_systems_->GetPersistentStateSupport(key_system),
- EME_FEATURE_NOT_ALLOWED);
+ EmeFeatureRequirement::NotAllowed);
EmeConfigRule required_rule = GetPersistentStateConfigRule(
key_systems_->GetPersistentStateSupport(key_system),
- EME_FEATURE_REQUIRED);
+ EmeFeatureRequirement::Required);
// |distinctiveIdentifier| should not be affected after it is decided.
DCHECK(not_allowed_rule == EmeConfigRule::NOT_SUPPORTED ||
not_allowed_rule == EmeConfigRule::PERSISTENCE_NOT_ALLOWED);
diff --git a/media/blink/key_system_config_selector_unittest.cc b/media/blink/key_system_config_selector_unittest.cc
index fc6d99a..762db78 100644
--- a/media/blink/key_system_config_selector_unittest.cc
+++ b/media/blink/key_system_config_selector_unittest.cc
@@ -124,15 +124,16 @@ class FakeKeySystems : public KeySystems {
InitDataTypeMask init_data_types = kInitDataTypeMaskNone;
// INVALID so that they must be set in any test that needs them.
- EmeSessionTypeSupport persistent_license = EME_SESSION_TYPE_INVALID;
- EmeSessionTypeSupport persistent_release_message = EME_SESSION_TYPE_INVALID;
+ EmeSessionTypeSupport persistent_license = EmeSessionTypeSupport::INVALID;
+ EmeSessionTypeSupport persistent_release_message =
+ EmeSessionTypeSupport::INVALID;
// Every test implicitly requires these, so they must be set. They are set to
// values that are likely to cause tests to fail if they are accidentally
// depended on. Test cases explicitly depending on them should set them, as
// the default values may be changed.
- EmeFeatureSupport persistent_state = EME_FEATURE_NOT_SUPPORTED;
- EmeFeatureSupport distinctive_identifier = EME_FEATURE_REQUESTABLE;
+ EmeFeatureSupport persistent_state = EmeFeatureSupport::NOT_SUPPORTED;
+ EmeFeatureSupport distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
};
class FakeMediaPermission : public MediaPermission {
@@ -327,7 +328,7 @@ TEST_F(KeySystemConfigSelectorTest, InitDataTypes_SubsetSupported) {
// --- distinctiveIdentifier ---
TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_Default) {
- key_systems_->distinctive_identifier = EME_FEATURE_REQUESTABLE;
+ key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
blink::WebMediaKeySystemConfiguration config;
config.distinctiveIdentifier =
@@ -341,7 +342,7 @@ TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_Default) {
TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_Forced) {
media_permission_->is_granted = true;
- key_systems_->distinctive_identifier = EME_FEATURE_ALWAYS_ENABLED;
+ key_systems_->distinctive_identifier = EmeFeatureSupport::ALWAYS_ENABLED;
blink::WebMediaKeySystemConfiguration config;
config.distinctiveIdentifier =
@@ -354,7 +355,7 @@ TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_Forced) {
}
TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_Blocked) {
- key_systems_->distinctive_identifier = EME_FEATURE_NOT_SUPPORTED;
+ key_systems_->distinctive_identifier = EmeFeatureSupport::NOT_SUPPORTED;
blink::WebMediaKeySystemConfiguration config;
config.distinctiveIdentifier =
@@ -366,7 +367,7 @@ TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_Blocked) {
TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_RequestsPermission) {
media_permission_->is_granted = true;
- key_systems_->distinctive_identifier = EME_FEATURE_REQUESTABLE;
+ key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
blink::WebMediaKeySystemConfiguration config;
config.distinctiveIdentifier =
@@ -380,7 +381,7 @@ TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_RequestsPermission) {
TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_RespectsPermission) {
media_permission_->is_granted = false;
- key_systems_->distinctive_identifier = EME_FEATURE_REQUESTABLE;
+ key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
blink::WebMediaKeySystemConfiguration config;
config.distinctiveIdentifier =
@@ -393,7 +394,7 @@ TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_RespectsPermission) {
// --- persistentState ---
TEST_F(KeySystemConfigSelectorTest, PersistentState_Default) {
- key_systems_->persistent_state = EME_FEATURE_REQUESTABLE;
+ key_systems_->persistent_state = EmeFeatureSupport::REQUESTABLE;
blink::WebMediaKeySystemConfiguration config;
config.persistentState =
@@ -406,7 +407,7 @@ TEST_F(KeySystemConfigSelectorTest, PersistentState_Default) {
}
TEST_F(KeySystemConfigSelectorTest, PersistentState_Forced) {
- key_systems_->persistent_state = EME_FEATURE_ALWAYS_ENABLED;
+ key_systems_->persistent_state = EmeFeatureSupport::ALWAYS_ENABLED;
blink::WebMediaKeySystemConfiguration config;
config.persistentState =
@@ -419,7 +420,7 @@ TEST_F(KeySystemConfigSelectorTest, PersistentState_Forced) {
}
TEST_F(KeySystemConfigSelectorTest, PersistentState_Blocked) {
- key_systems_->persistent_state = EME_FEATURE_ALWAYS_ENABLED;
+ key_systems_->persistent_state = EmeFeatureSupport::ALWAYS_ENABLED;
blink::WebMediaKeySystemConfiguration config;
config.persistentState =
@@ -442,8 +443,8 @@ TEST_F(KeySystemConfigSelectorTest, SessionTypes_Empty) {
TEST_F(KeySystemConfigSelectorTest, SessionTypes_SubsetSupported) {
// Allow persistent state, as it would be required to be successful.
- key_systems_->persistent_state = EME_FEATURE_REQUESTABLE;
- key_systems_->persistent_license = EME_SESSION_TYPE_NOT_SUPPORTED;
+ key_systems_->persistent_state = EmeFeatureSupport::REQUESTABLE;
+ key_systems_->persistent_license = EmeSessionTypeSupport::NOT_SUPPORTED;
std::vector<blink::WebEncryptedMediaSessionType> session_types;
session_types.push_back(blink::WebEncryptedMediaSessionType::Temporary);
@@ -460,8 +461,8 @@ TEST_F(KeySystemConfigSelectorTest, SessionTypes_SubsetSupported) {
TEST_F(KeySystemConfigSelectorTest, SessionTypes_AllSupported) {
// Allow persistent state, and expect it to be required.
- key_systems_->persistent_state = EME_FEATURE_REQUESTABLE;
- key_systems_->persistent_license = EME_SESSION_TYPE_SUPPORTED;
+ key_systems_->persistent_state = EmeFeatureSupport::REQUESTABLE;
+ key_systems_->persistent_license = EmeSessionTypeSupport::SUPPORTED;
std::vector<blink::WebEncryptedMediaSessionType> session_types;
session_types.push_back(blink::WebEncryptedMediaSessionType::Temporary);
@@ -487,9 +488,10 @@ TEST_F(KeySystemConfigSelectorTest, SessionTypes_AllSupported) {
TEST_F(KeySystemConfigSelectorTest, SessionTypes_PermissionCanBeRequired) {
media_permission_->is_granted = true;
- key_systems_->distinctive_identifier = EME_FEATURE_REQUESTABLE;
- key_systems_->persistent_state = EME_FEATURE_REQUESTABLE;
- key_systems_->persistent_license = EME_SESSION_TYPE_SUPPORTED_WITH_IDENTIFIER;
+ key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
+ key_systems_->persistent_state = EmeFeatureSupport::REQUESTABLE;
+ key_systems_->persistent_license =
+ EmeSessionTypeSupport::SUPPORTED_WITH_IDENTIFIER;
std::vector<blink::WebEncryptedMediaSessionType> session_types;
session_types.push_back(
@@ -636,7 +638,7 @@ TEST_F(KeySystemConfigSelectorTest, VideoCapabilities_Robustness_Unsupported) {
TEST_F(KeySystemConfigSelectorTest,
VideoCapabilities_Robustness_PermissionCanBeRequired) {
media_permission_->is_granted = true;
- key_systems_->distinctive_identifier = EME_FEATURE_REQUESTABLE;
+ key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
std::vector<blink::WebMediaKeySystemMediaCapability> video_capabilities(1);
video_capabilities[0].contentType = "a";
@@ -656,7 +658,7 @@ TEST_F(KeySystemConfigSelectorTest,
TEST_F(KeySystemConfigSelectorTest,
VideoCapabilities_Robustness_PermissionCanBeRecommended) {
media_permission_->is_granted = false;
- key_systems_->distinctive_identifier = EME_FEATURE_REQUESTABLE;
+ key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
std::vector<blink::WebMediaKeySystemMediaCapability> video_capabilities(1);
video_capabilities[0].contentType = "a";
@@ -725,7 +727,7 @@ TEST_F(KeySystemConfigSelectorTest, Configurations_SubsetSupported) {
TEST_F(KeySystemConfigSelectorTest,
Configurations_FirstRequiresPermission_Allowed) {
media_permission_->is_granted = true;
- key_systems_->distinctive_identifier = EME_FEATURE_REQUESTABLE;
+ key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
blink::WebMediaKeySystemConfiguration config1;
config1.label = "a";
@@ -744,7 +746,7 @@ TEST_F(KeySystemConfigSelectorTest,
TEST_F(KeySystemConfigSelectorTest,
Configurations_FirstRequiresPermission_Rejected) {
media_permission_->is_granted = false;
- key_systems_->distinctive_identifier = EME_FEATURE_REQUESTABLE;
+ key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
blink::WebMediaKeySystemConfiguration config1;
config1.label = "a";