From f6229788b0166316ac28718a05c31ccfb5e694f4 Mon Sep 17 00:00:00 2001 From: Fred Gylys-Colwell Date: Sun, 17 May 2020 11:57:06 -0700 Subject: [PATCH] Start playback timer in integration tests Merge from Widevine repo of http://go/wvgerrit/100328 Several integration tests in WvCdmRequestLicenseRollbackTest had been testing the duration of a license. However, the license they request sets the playback duration and not the rental duration. That means the timer we are checking does not start until the first playback. To fix the tests, we simply add a decrypt operation right after the license is received. Test: integration tests w/v16 mod mock. Bug: 156854660 Change-Id: Ie4f017c82db8aaf084ad050de3fcb7f51987c97e --- libwvdrmengine/cdm/test/request_license_test.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libwvdrmengine/cdm/test/request_license_test.cpp b/libwvdrmengine/cdm/test/request_license_test.cpp index c272d474..a9809ce2 100644 --- a/libwvdrmengine/cdm/test/request_license_test.cpp +++ b/libwvdrmengine/cdm/test/request_license_test.cpp @@ -6233,6 +6233,9 @@ TEST_F(WvCdmRequestLicenseRollbackTest, Streaming_ExpireBeforeRollback) { GenerateKeyRequest(init_data_with_expiry_, kLicenseTypeStreaming); VerifyKeyRequestResponse(config_.license_server(), config_.client_auth()); + // Start playback timer. + EXPECT_EQ(NO_ERROR, Decrypt(session_id_)); + // Elapse time so that the key should now be considered expired. std::this_thread::sleep_for( std::chrono::milliseconds(kExpirationWithWindowMs_)); @@ -6319,6 +6322,9 @@ TEST_F(WvCdmRequestLicenseRollbackTest, nullptr, &session_id_); EXPECT_EQ(wvcdm::KEY_ADDED, decryptor_->RestoreKey(session_id_, key_set_id)); + // Start playback timer. + EXPECT_EQ(NO_ERROR, Decrypt(session_id_)); + RollbackSystemTime(kExpirationWithWindowMs_); // Elapse time so that the key should now be considered expired. @@ -6357,6 +6363,9 @@ TEST_F(WvCdmRequestLicenseRollbackTest, nullptr, &session_id_); EXPECT_EQ(wvcdm::KEY_ADDED, decryptor_->RestoreKey(session_id_, key_set_id)); + // Start playback timer. + EXPECT_EQ(NO_ERROR, Decrypt(session_id_)); + // Elapse time so that the key should now be considered expired. std::this_thread::sleep_for( std::chrono::milliseconds(kExpirationWithWindowMs_));