From 2a316f65fe30d5eebfefa7e3ea5e48f14e477ca2 Mon Sep 17 00:00:00 2001 From: Rahul Frias Date: Wed, 21 Apr 2021 00:28:18 -0700 Subject: [PATCH] Correct request_license_test failures [ Merge of http://go/wvgerrit/122885 ] A recent change to the license service resulted in PSTs being inserted into persistent renewable licenses even when not specified by the content provider. This caused ReleaseOfflineKeySessionUsageDisabledTest to fail. The asset was changed to use a policy for a persistent license without renewal. Offline_RollbackBeforeRestoreKey failed because the duration of the license is short. It has expired when the clock is restored after a rollback. Bug: 181693982 Test: request_license_test Change-Id: I0a2c2a09e563c81c134fba1f310deb1eb4de26a3 --- .../cdm/test/request_license_test.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/libwvdrmengine/cdm/test/request_license_test.cpp b/libwvdrmengine/cdm/test/request_license_test.cpp index 100d5749..e5dcf686 100644 --- a/libwvdrmengine/cdm/test/request_license_test.cpp +++ b/libwvdrmengine/cdm/test/request_license_test.cpp @@ -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_)); }