diff --git a/libwvdrmengine/cdm/core/test/duration_use_case_test.cpp b/libwvdrmengine/cdm/core/test/duration_use_case_test.cpp index fe7e71b6..d8c83938 100644 --- a/libwvdrmengine/cdm/core/test/duration_use_case_test.cpp +++ b/libwvdrmengine/cdm/core/test/duration_use_case_test.cpp @@ -468,7 +468,7 @@ class CdmDurationTest : public WvCdmTestBaseWithEngine, // // In the document, we use realistic rental times in hours or days. In these // tests, we will use round numbers so that it is easier to read. For example, -// instead of a seven day rental duration, we will use a 200 rental duration. +// instead of a seven day rental duration, we will use a 100 rental duration. /*****************************************************************************/ /*****************************************************************************/ @@ -477,8 +477,6 @@ class CdmDurationTest : public WvCdmTestBaseWithEngine, class CdmUseCase_Streaming : public CdmDurationTest { public: CdmUseCase_Streaming() : CdmDurationTest("CDM_Streaming") { - // Rental duration = 3 hours hard. (use 300 for readability) - // Playback duration = 0 (unlimited) timer_limits_.soft_enforce_rental_duration = false; timer_limits_.rental_duration_seconds = 40; timer_limits_.total_playback_duration_seconds = 0; @@ -1055,11 +1053,11 @@ class RenewalTest : public CdmDurationTest { void LoadRenewal(uint64_t time_of_load, const RenewalPolicy& renewal_policy) { ASSERT_NE(renewal_in_flight_, nullptr); std::string http_response; - // TODO(fredgc): Tune this. Most of the network latency will probably show - // up in the next few commands. I think the tests have enough slop to - // account for reasonable latency with the current value of - // kRoundTripTime. But We'll know I made a mistake if we see errors about - // "Test Clock skew..." in the SleepUntil call below. + // Most of the network latency will probably show up in the next few + // commands. I think the tests have enough slop to account for reasonable + // latency with the current value of kRoundTripTime. But We'll know I made a + // mistake if we see errors about "Test Clock skew..." in the SleepUntil + // call below. ASSERT_TRUE(renewal_in_flight_->GetResponse(&http_response)); int status_code = renewal_in_flight_->GetStatusCode(http_response); ASSERT_EQ(kHttpOk, status_code); @@ -1683,9 +1681,9 @@ INSTANTIATE_TEST_CASE_P(Both, CdmUseCase_UnlimitedStreaming, class CdmUseCase_LicenseDuration : public CdmDurationTest { public: CdmUseCase_LicenseDuration() : CdmDurationTest("CDM_LicenseDuration") { - // Rental duration = 3 hours hard. (use 300 for readability) - // Playback duration = 0 (unlimited) timer_limits_.soft_enforce_rental_duration = true; + // The policy does not specify a rental duration, but the server adjusts it + // so that it looks like this to a v16 device. timer_limits_.rental_duration_seconds = 40u; timer_limits_.soft_enforce_playback_duration = false; timer_limits_.total_playback_duration_seconds = 40u; @@ -1695,13 +1693,18 @@ class CdmUseCase_LicenseDuration : public CdmDurationTest { // Playback within rental duration. TEST_P(CdmUseCase_LicenseDuration, Case1) { // Allow playback within the playback window. - LoadAndAllowPlayback(start_of_playback_, EndOfPlaybackWindow()); + LoadAndAllowPlayback(start_of_playback_, EndOfRentalWindow()); } // Playback exceeds rental duration. TEST_P(CdmUseCase_LicenseDuration, Case2) { - // Allow playback within the playback window, but not beyond. - LoadAndTerminatePlayback(start_of_playback_, EndOfPlaybackWindow()); + LoadAndAllowPlayback(start_of_playback_, EndOfRentalWindow()); + // Do not allow playback after playback window. For a v16 CDM with a v15 + // OEMCrypto, playback is cutoff at the rental window, and for a v16 CDM with + // a v16 OEMCrypto, playback is allowed a little longer. In both cases, + // playback is not allowed after the end of the playback window. + SleepUntil(EndOfPlaybackWindow() + kFudge); + FailDecrypt(); } // Playback with stops/restarts within rental duration, last one exceeds @@ -1713,8 +1716,12 @@ TEST_P(CdmUseCase_LicenseDuration, Case3) { start_of_playback_ + 3 * kPlayDuration); UnloadLicense(); AllowLenience(); - LoadAndTerminatePlayback(start_of_playback_ + 4 * kPlayDuration, - EndOfPlaybackWindow()); + LoadAndAllowPlayback(start_of_playback_ + 4 * kPlayDuration, + EndOfRentalWindow()); + // As above, do not allow playback after playback window. + AllowLenience(); + SleepUntil(EndOfPlaybackWindow() + kFudge); + FailDecrypt(); } // Playback within rental duration, restart exceeds playback duration.