Add CdmKeyStatus kKeyStatusUsableInFuture

Bug: 116738851
Test: unit tests
Change-Id: I49728788e57905806b72e891f3654fbf0c8b1bc0
This commit is contained in:
Robert Shih
2019-05-10 13:29:54 -07:00
parent 127f87770c
commit 69c8f488ca
10 changed files with 105 additions and 29 deletions

View File

@@ -406,6 +406,7 @@ enum CdmKeyStatus {
kKeyStatusOutputNotAllowed,
kKeyStatusPending,
kKeyStatusInternalError,
kKeyStatusUsableInFuture,
};
typedef std::map<KeyId, CdmKeyStatus> CdmKeyStatusMap;

View File

@@ -226,7 +226,7 @@ void PolicyEngine::UpdateLicense(const License& license) {
NotifyKeysChange(kKeyStatusUsable);
} else {
license_state_ = kLicenseStatePending;
NotifyKeysChange(kKeyStatusPending);
NotifyKeysChange(kKeyStatusUsableInFuture);
}
NotifyExpirationUpdate(current_time);
}

View File

@@ -619,17 +619,17 @@ TEST_F(LicenseKeysTest, KeyStatusChanges) {
EXPECT_EQ(content_key_count_, key_status_map.size());
ExpectKeyStatusesEqual(key_status_map, kKeyStatusPending);
// change to pending (again)
any_change = license_keys_->ApplyStatusChange(kKeyStatusPending,
// change to usable in future
any_change = license_keys_->ApplyStatusChange(kKeyStatusUsableInFuture,
&new_usable_keys);
EXPECT_FALSE(any_change);
EXPECT_TRUE(any_change);
EXPECT_FALSE(new_usable_keys);
EXPECT_FALSE(license_keys_->CanDecryptContent(ck_sw_crypto));
EXPECT_FALSE(license_keys_->CanDecryptContent(ck_hw_secure));
license_keys_->ExtractKeyStatuses(&key_status_map);
EXPECT_EQ(content_key_count_, key_status_map.size());
ExpectKeyStatusesEqual(key_status_map, kKeyStatusPending);
ExpectKeyStatusesEqual(key_status_map, kKeyStatusUsableInFuture);
// change to usable
any_change = license_keys_->ApplyStatusChange(kKeyStatusUsable,
@@ -1353,10 +1353,10 @@ TEST_P(LicenseKeysSecurityLevelConstraintsTest, KeyStatusChange) {
EXPECT_EQ(content_key_count_, key_status_map.size());
ExpectKeyStatusesEqual(key_status_map, kKeyStatusPending);
// change to pending (again)
any_change = license_keys_->ApplyStatusChange(kKeyStatusPending,
// change to usable in future
any_change = license_keys_->ApplyStatusChange(kKeyStatusUsableInFuture,
&new_usable_keys);
EXPECT_FALSE(any_change);
EXPECT_TRUE(any_change);
EXPECT_FALSE(new_usable_keys);
EXPECT_FALSE(license_keys_->CanDecryptContent(ck_sw_crypto));
EXPECT_FALSE(license_keys_->CanDecryptContent(ck_sw_decode));
@@ -1366,7 +1366,7 @@ TEST_P(LicenseKeysSecurityLevelConstraintsTest, KeyStatusChange) {
license_keys_->ExtractKeyStatuses(&key_status_map);
EXPECT_EQ(content_key_count_, key_status_map.size());
ExpectKeyStatusesEqual(key_status_map, kKeyStatusPending);
ExpectKeyStatusesEqual(key_status_map, kKeyStatusUsableInFuture);
// change to usable
any_change = license_keys_->ApplyStatusChange(kKeyStatusUsable,

View File

@@ -906,7 +906,7 @@ TEST_F(PolicyEngineTest, PlaybackOk_LicenseWithFutureStartTime) {
Return(GET_HDCP_CAPABILITY_FAILED)));
InSequence s;
ExpectSessionKeysChange(kKeyStatusPending, false);
ExpectSessionKeysChange(kKeyStatusUsableInFuture, false);
EXPECT_CALL(mock_event_listener_,
OnExpirationUpdate(_, kLicenseStartTime + kRentalDuration));
ExpectSessionKeysChange(kKeyStatusUsable, true);
@@ -1054,7 +1054,7 @@ TEST_F(PolicyEngineTest, PlaybackOk_RenewSuccess_WithFutureStartTime) {
EXPECT_CALL(check_, Call(1));
EXPECT_CALL(mock_event_listener_, OnSessionRenewalNeeded(_));
EXPECT_CALL(check_, Call(2));
ExpectSessionKeysChange(kKeyStatusPending, false);
ExpectSessionKeysChange(kKeyStatusUsableInFuture, false);
EXPECT_CALL(mock_event_listener_,
OnExpirationUpdate(_, new_license_start_time + kLowDuration));
EXPECT_CALL(check_, Call(3));