diff --git a/libwvdrmengine/cdm/core/test/duration_use_case_test.cpp b/libwvdrmengine/cdm/core/test/duration_use_case_test.cpp index 5fb1fe4f..f0973e07 100644 --- a/libwvdrmengine/cdm/core/test/duration_use_case_test.cpp +++ b/libwvdrmengine/cdm/core/test/duration_use_case_test.cpp @@ -1533,9 +1533,11 @@ class CdmUseCase_RenewOnLicenseLoad : public RenewalTest { timer_limits_.initial_renewal_duration_seconds = renewal_delay_ + renewal_recovery_; + // Calculate the renewal cutoff: + renewal_cutoff_ = start_of_playback_ + renewal_delay_ + renewal_recovery_; + // Load the renewal just before the cutoff: - renewal_load_time_ = - start_of_playback_ + renewal_delay_ + renewal_recovery_ - 1; + renewal_load_time_ = renewal_cutoff_ - kFudge; } void SetUp() override { @@ -1548,6 +1550,7 @@ class CdmUseCase_RenewOnLicenseLoad : public RenewalTest { } } + uint64_t renewal_cutoff_; uint64_t renewal_delay_; uint64_t renewal_load_time_; uint64_t renewal_recovery_; @@ -1561,9 +1564,8 @@ TEST_P(CdmUseCase_RenewOnLicenseLoad, Case1S) { SleepUntilRenewalNeeded(); RequestRenewal(kRenewOnLicenseLoad); const uint64_t start = 15; // time of first decrypt - const uint64_t load_renewal = 20; const uint64_t stop = 45; - RenewAndContinue(start, load_renewal, stop, kRenewOnLicenseLoad); + RenewAndContinue(start, renewal_load_time_, stop, kRenewOnLicenseLoad); } // License loaded within rental duration window and playback continues. @@ -1573,10 +1575,9 @@ TEST_P(CdmUseCase_RenewOnLicenseLoad, Case1M) { LoadLicense(); SleepUntilRenewalNeeded(); RequestRenewal(kRenewOnLicenseLoad); - const uint64_t start = 20; // time of first decrypt - const uint64_t load_renewal = 20; + const uint64_t start = 25; // time of first decrypt const uint64_t stop = 45; // end of decrypt - RenewAndContinue(start, load_renewal, stop, kRenewOnLicenseLoad); + RenewAndContinue(start, renewal_load_time_, stop, kRenewOnLicenseLoad); } // License loaded within rental duration window and playback continues. @@ -1586,10 +1587,9 @@ TEST_P(CdmUseCase_RenewOnLicenseLoad, Case1L) { LoadLicense(); SleepUntilRenewalNeeded(); RequestRenewal(kRenewOnLicenseLoad); - const uint64_t load_renewal = 20; - const uint64_t start = 25; // time of first decrypt + const uint64_t start = 35; // time of first decrypt const uint64_t stop = 45; // end of decrypt - LoadRenewal(load_renewal, kRenewOnLicenseLoad); + LoadRenewal(renewal_load_time_, kRenewOnLicenseLoad); AllowPlayback(start, stop); } @@ -1607,9 +1607,7 @@ TEST_P(CdmUseCase_RenewOnLicenseLoad, Case3S) { LoadLicense(); const uint64_t start = 15; // time of first decrypt // Allow playback within the initial renewal window. - const uint64_t cutoff = - start_of_playback_ + renewal_delay_ + renewal_recovery_; - TerminatePlayback(start, cutoff); + TerminatePlayback(start, renewal_cutoff_); } // License loaded within rental duration window but renewal not received. @@ -1619,9 +1617,7 @@ TEST_P(CdmUseCase_RenewOnLicenseLoad, Case3M) { LoadLicense(); const uint64_t start = 25; // time of first decrypt // Allow playback within the initial renewal window. - const uint64_t cutoff = - start_of_playback_ + renewal_delay_ + renewal_recovery_; - TerminatePlayback(start, cutoff); + TerminatePlayback(start, renewal_cutoff_); } // License loaded within rental duration window but renewal not received.