Fix expiry time overflow if it is unlimited

Bug: 21324836

Merged from Widevine CDM repo:
https://widevine-internal-review.googlesource.com/#/c/14392

Change-Id: I2a8da14c98f8ae0fece3667b6f6b8517577f8a98
This commit is contained in:
Kongqun Yang
2015-05-19 18:09:02 -07:00
parent b513c016ed
commit ce68b8ee88
9 changed files with 25 additions and 15 deletions

View File

@@ -18,7 +18,6 @@
namespace {
const int64_t kDurationUnlimited = 0;
const int64_t kNoExpiration = LLONG_MAX;
const int64_t kLicenseStartTime = 1413517500; // ~ 01/01/2013
const int64_t kPlaybackStartTime = kLicenseStartTime + 5;
const int64_t kRentalDuration = 604800; // 7 days
@@ -75,8 +74,8 @@ class MockCdmEventListener : public WvCdmEventListener {
MOCK_METHOD3(OnSessionKeysChange, void(const CdmSessionId& session_id,
const CdmKeyStatusMap& keys_status,
bool has_new_usable_key));
MOCK_METHOD2(OnExpirationUpdate,
void(const CdmSessionId& session_id, int64_t new_expiry_time));
MOCK_METHOD2(OnExpirationUpdate, void(const CdmSessionId& session_id,
int64_t new_expiry_time_seconds));
};
class MockMaxResEngine : public MaxResEngine {
@@ -471,7 +470,7 @@ TEST_F(PolicyEngineTest, PlaybackOk_PlaybackDuration0) {
EXPECT_CALL(mock_event_listener_,
OnExpirationUpdate(_, kLicenseStartTime + kHighDuration));
EXPECT_CALL(mock_event_listener_,
OnExpirationUpdate(_, kNoExpiration));
OnExpirationUpdate(_, NEVER_EXPIRES));
EXPECT_CALL(check_, Call(1));
EXPECT_CALL(mock_event_listener_, OnSessionRenewalNeeded(_));
EXPECT_CALL(check_, Call(2));
@@ -545,7 +544,7 @@ TEST_F(PolicyEngineTest, PlaybackOk_Durations0) {
.WillOnce(Return(kLicenseStartTime + kHighDuration));
ExpectSessionKeysChange(kKeyStatusUsable, true);
EXPECT_CALL(mock_event_listener_, OnExpirationUpdate(_, kNoExpiration));
EXPECT_CALL(mock_event_listener_, OnExpirationUpdate(_, NEVER_EXPIRES));
policy_engine_->SetLicense(license_);