Remove ExpiryOnReleaseOfflineKeyTest
The test verifies that a downloaded license receives an expiry event in a session if it is released from another session. With the introduction of the big usage table feature loading a license/usage entry into multiple sessions is not permitted and so this test is no longer needed. Some OEMCrypto implementations might require OEMCrypto_UpdateUsageEntry to be called between calls to OEMCrypto_LoadKeys and OEMCrypto_ReportUsage. This CL adds the call to OEMCrypto_UpdateUsageEntry. Test: WV unit/integration test Test: Playback using play movies and netflix Test: GTS tests Bug: 64988654 Change-Id: Ic737c3200ea1858736a168be835507378eaf7b3e
This commit is contained in:
@@ -50,7 +50,7 @@ class CdmLicense {
|
||||
const CdmKeyResponse& license_response,
|
||||
const CdmKeyResponse& license_renewal_response,
|
||||
int64_t playback_start_time, int64_t last_playback_time,
|
||||
int64_t grace_period_end_time);
|
||||
int64_t grace_period_end_time, CdmSession* cdm_session);
|
||||
virtual bool RestoreLicenseForRelease(const CdmKeyMessage& license_request,
|
||||
const CdmKeyResponse& license_response);
|
||||
virtual bool HasInitData() { return stored_init_data_.get(); }
|
||||
|
||||
@@ -240,7 +240,8 @@ CdmResponseType CdmSession::RestoreOfflineSession(
|
||||
} else {
|
||||
if (!license_parser_->RestoreOfflineLicense(
|
||||
key_request_, key_response_, offline_key_renewal_response_,
|
||||
playback_start_time, last_playback_time, grace_period_end_time)) {
|
||||
playback_start_time, last_playback_time, grace_period_end_time,
|
||||
this)) {
|
||||
return RESTORE_OFFLINE_LICENSE_ERROR_2;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -628,7 +628,8 @@ bool CdmLicense::RestoreOfflineLicense(
|
||||
const CdmKeyMessage& license_request,
|
||||
const CdmKeyResponse& license_response,
|
||||
const CdmKeyResponse& license_renewal_response, int64_t playback_start_time,
|
||||
int64_t last_playback_time, int64_t grace_period_end_time) {
|
||||
int64_t last_playback_time, int64_t grace_period_end_time,
|
||||
CdmSession* cdm_session) {
|
||||
if (license_request.empty() || license_response.empty()) {
|
||||
LOGE(
|
||||
"CdmLicense::RestoreOfflineLicense: key_request or response empty: "
|
||||
@@ -670,9 +671,15 @@ bool CdmLicense::RestoreOfflineLicense(
|
||||
}
|
||||
|
||||
if (!provider_session_token_.empty()) {
|
||||
if (cdm_session) {
|
||||
CdmResponseType status = cdm_session->UpdateUsageEntryInformation();
|
||||
if (NO_ERROR != status) return false;
|
||||
}
|
||||
|
||||
std::string usage_report;
|
||||
CryptoSession::UsageDurationStatus usage_duration_status =
|
||||
CryptoSession::kUsageDurationsInvalid;
|
||||
|
||||
int64_t seconds_since_started, seconds_since_last_played;
|
||||
sts = crypto_session_->GenerateUsageReport(
|
||||
provider_session_token_, &usage_report, &usage_duration_status,
|
||||
|
||||
@@ -2019,55 +2019,6 @@ TEST_F(WvCdmRequestLicenseTest,
|
||||
VerifyKeyRequestResponse(g_license_server, client_auth);
|
||||
}
|
||||
|
||||
TEST_F(WvCdmRequestLicenseTest, ExpiryOnReleaseOfflineKeyTest) {
|
||||
Unprovision();
|
||||
Provision(kLevelDefault);
|
||||
|
||||
// override default settings unless configured through the command line
|
||||
std::string key_id;
|
||||
std::string client_auth;
|
||||
GetOfflineConfiguration(&key_id, &client_auth);
|
||||
|
||||
decryptor_.OpenSession(g_key_system, NULL, kDefaultCdmIdentifier, NULL,
|
||||
&session_id_);
|
||||
GenerateKeyRequest(key_id, kLicenseTypeOffline);
|
||||
VerifyKeyRequestResponse(g_license_server, client_auth);
|
||||
|
||||
CdmKeySetId key_set_id = key_set_id_;
|
||||
EXPECT_FALSE(key_set_id_.empty());
|
||||
decryptor_.CloseSession(session_id_);
|
||||
|
||||
session_id_.clear();
|
||||
key_set_id_.clear();
|
||||
StrictMock<TestWvCdmEventListener> listener;
|
||||
decryptor_.OpenSession(g_key_system, NULL, kDefaultCdmIdentifier, &listener,
|
||||
&session_id_);
|
||||
CdmSessionId restore_session_id = session_id_;
|
||||
EXPECT_CALL(
|
||||
listener,
|
||||
OnSessionKeysChange(
|
||||
restore_session_id,
|
||||
AllOf(Each(Pair(_, kKeyStatusUsable)), Not(IsEmpty())), true));
|
||||
EXPECT_CALL(listener, OnExpirationUpdate(restore_session_id, _));
|
||||
EXPECT_EQ(wvcdm::KEY_ADDED,
|
||||
decryptor_.RestoreKey(restore_session_id, key_set_id));
|
||||
|
||||
session_id_.clear();
|
||||
key_set_id_.clear();
|
||||
// Maybe called since VerifyKeyRequestResponse could take some time.
|
||||
EXPECT_CALL(listener, OnSessionRenewalNeeded(restore_session_id))
|
||||
.Times(AtLeast(0));
|
||||
EXPECT_CALL(
|
||||
listener,
|
||||
OnSessionKeysChange(
|
||||
restore_session_id,
|
||||
AllOf(Each(Pair(_, kKeyStatusExpired)), Not(IsEmpty())), false));
|
||||
GenerateKeyRelease(key_set_id);
|
||||
key_set_id_ = key_set_id;
|
||||
VerifyKeyRequestResponse(g_license_server, client_auth);
|
||||
decryptor_.CloseSession(restore_session_id);
|
||||
}
|
||||
|
||||
// This test verifies that repeated generation of the key release message
|
||||
// for the same key_set_id results in the previous session being
|
||||
// deallocated (rather than leaked) and a new one allocated.
|
||||
|
||||
Reference in New Issue
Block a user