Merge "Correct request_license_test failures" into sc-dev

This commit is contained in:
Rahul Frias
2021-04-24 01:03:49 +00:00
committed by Android (Google) Code Review

View File

@@ -2994,12 +2994,14 @@ TEST_F(WvCdmRequestLicenseTest, ReleaseOfflineKeySessionUsageDisabledTest) {
// The default offline asset "offline_clip2" has the session usage table
// entry enabled in the replay control portion of the key control block.
// To have it disabled we must use "offline_clip1", so replace the last
// char in init data with '1'
// To have it disabled we must use "offline_clip7", so replace the last
// char in init data with '7'. PST are also automatically inserted into
// persistent licenses with renewals. This asset has a policy that prohibits
// renewals so no PST is specified.
std::string key_id;
std::string client_auth;
GetOfflineConfiguration(&key_id, &client_auth);
key_id[key_id.size() - 1] = '1';
key_id[key_id.size() - 1] = '7';
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
@@ -6572,7 +6574,7 @@ TEST_F(WvCdmRequestLicenseRollbackTest, Offline_RollbackBeforeRestoreKey) {
decryptor_->RestoreKey(session_id_, key_set_id);
// Verify we can't decrypt.
// Verify we can't decrypt. The license start time is in the future.
EXPECT_EQ(DECRYPT_NOT_READY, Decrypt(session_id_));
RestoreSystemTime();
@@ -6582,8 +6584,11 @@ TEST_F(WvCdmRequestLicenseRollbackTest, Offline_RollbackBeforeRestoreKey) {
std::this_thread::sleep_for(
std::chrono::milliseconds(kExpirationTimeMs_ / 2));
// Verify we can decrypt.
EXPECT_EQ(NO_ERROR, Decrypt(session_id_));
// Verify we can't decrypt. The playback duration is short, half of the
// rollback time. The first playback time gets set to the rollback time
// when the license is restored. The license has expired by the time the
// clock is restored/rolled forward.
EXPECT_EQ(NEED_KEY, Decrypt(session_id_));
ASSERT_EQ(NO_ERROR, decryptor_->CloseSession(session_id_));
}