Expect failure on license load for expired LDL license

Merge from Widevine repo of http://go/wvgerrit/170970

RenewOnLicenseLoad.Case2 tests are failing because they
are expecting to load an expired license. However, the spec
says that the license should return KEY_EXPIRED. The test is
being updated.

Some other RenewOnLicenseLoad tests were failing because
they forgot to request the renewal.

Bug: 278750980
Test: Run tests on Luci
Change-Id: I7196db11fcf43859ba9310b87fd8ccb609e47039
This commit is contained in:
Fred Gylys-Colwell
2023-05-04 21:18:06 -07:00
parent 651776f475
commit 65d52908af
3 changed files with 16 additions and 2 deletions

View File

@@ -1557,6 +1557,7 @@ TEST_P(CdmUseCase_RenewOnLicenseLoad, Case1S) {
SleepUntil(start_of_playback_);
LoadLicense();
SleepUntilRenewalNeeded();
RequestRenewal(kRenewOnLicenseLoad);
const uint64_t start = 15; // time of first decrypt
const uint64_t load_renewal = 20;
const uint64_t stop = 45;
@@ -1569,6 +1570,7 @@ TEST_P(CdmUseCase_RenewOnLicenseLoad, Case1M) {
SleepUntil(start_of_playback_);
LoadLicense();
SleepUntilRenewalNeeded();
RequestRenewal(kRenewOnLicenseLoad);
const uint64_t start = 20; // time of first decrypt
const uint64_t load_renewal = 20;
const uint64_t stop = 45; // end of decrypt
@@ -1591,8 +1593,9 @@ TEST_P(CdmUseCase_RenewOnLicenseLoad, Case1L) {
// License loaded after rental duration window and playback should fail.
TEST_P(CdmUseCase_RenewOnLicenseLoad, Case2) {
start_of_playback_ = EndOfRentalWindow() + 1;
ForbidPlayback(start_of_playback_);
start_of_playback_ = EndOfRentalWindow() + kFudge;
SleepUntil(start_of_playback_);
license_holder_.FailLoadLicense();
}
// License loaded within rental duration window but renewal not received.
@@ -1637,6 +1640,7 @@ TEST_P(CdmUseCase_RenewOnLicenseLoad, Case4) {
SleepUntil(start_of_playback_);
LoadLicense();
SleepUntilRenewalNeeded();
RequestRenewal(kRenewOnLicenseLoad);
const uint64_t start = 20; // time of first decrypt
const uint64_t load_renewal = 20;
const uint64_t stop = 45; // end of decrypt

View File

@@ -55,6 +55,13 @@ void LicenseHolder::LoadLicense() {
}
}
void LicenseHolder::FailLoadLicense() {
CdmLicenseType license_type;
ASSERT_NE(KEY_ADDED, cdm_engine_->AddKey(session_id_, key_response_,
&license_type, &key_set_id_))
<< "Unexpected success loading license for " << content_id();
}
void LicenseHolder::ReloadLicense() {
CdmResponseType status = cdm_engine_->RestoreKey(session_id_, key_set_id_);
ASSERT_EQ(KEY_ADDED, status)

View File

@@ -59,6 +59,9 @@ class LicenseHolder {
// Load the license response into the CDM engine. A call to FetchLicense()
// must be made first.
void LoadLicense();
// Attempt to load the license response into the CDM engine, but expect a
// failure.
void FailLoadLicense();
// Reload the license. Call OpenSession() before calling
// ReloadLicense(). Also, the key_set_id must have been set previously. The
// key_set_id is set by calling LoadLicense(), or by calling set_key_set_id().