PolicyTimersV16: override base class HasRenewalDelayExpired am: d9112ff7e1 am: 035254e828 am: 6c6cbc95df

Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/12184963

Change-Id: I183964f4454b2718623cfaf471bdd92a5394322e
This commit is contained in:
Robert Shih
2020-07-24 00:16:41 +00:00
committed by Automerger Merge Worker
3 changed files with 11 additions and 1 deletions

View File

@@ -84,6 +84,8 @@ class PolicyTimersV16 : public PolicyTimers {
return GetRentalDurationRemaining(current_time);
};
bool HasRenewalDelayExpired(int64_t current_time) override;
protected:
// Gets the clock time that the license expires based on whether we have
// started playing. This takes into account GetHardLicenseExpiryTime.

View File

@@ -77,6 +77,12 @@ int64_t PolicyTimersV16::GetRentalDurationRemaining(int64_t current_time) {
return rental_expiry_time - current_time;
}
bool PolicyTimersV16::HasRenewalDelayExpired(int64_t current_time) {
return policy_.can_renew() && (policy_.renewal_delay_seconds() > 0) &&
(renewal_start_time_ + policy_.renewal_delay_seconds() <=
current_time);
}
// For the policy time fields checked in the following methods, a value of 0
// (UNLIMITED_DURATION) indicates that there is no limit to the duration.
// If the fields are UNLIMITED_DURATION then these methods will return

View File

@@ -3744,7 +3744,9 @@ TEST_F(PolicyEngineTest, PlaybackOk_RenewSuccess_V16) {
EXPECT_TRUE(policy_engine_->CanDecryptContent(kKeyId));
}
TEST_F(PolicyEngineTest, PlaybackOk_RenewSuccess_WithFutureStartTime_V16) {
// TODO(b/161992421): Rewrite after clarifying expected behavior
TEST_F(PolicyEngineTest,
DISABLED_PlaybackOk_RenewSuccess_WithFutureStartTime_V16) {
License_Policy* policy = license_.mutable_policy();
policy->set_can_renew(true);
const int64_t license_renewal_delay =