Allow use of cached initialization data

[ Merge of http://go/wvgerrit/41340 ]

An initial license request may actually result in a service certificate
request. Once the service certificate has been successfully handled,
an app may make a license request without needing to provide
the initialization data again. This behavior was broken in a recent
merge. Correcting the test as well.

b/72182032
Test: Ran wv unit/integration tests

Change-Id: I82401b9a3bf38140706dad859b4ae241b7ddac12
This commit is contained in:
Rahul Frias
2018-01-19 17:10:33 -08:00
parent f8d114ad11
commit bd45d4f0fa
2 changed files with 5 additions and 2 deletions

View File

@@ -372,7 +372,7 @@ CdmResponseType CdmSession::GenerateKeyRequest(
init_data.type().c_str());
return UNSUPPORTED_INIT_DATA;
}
if (init_data.IsEmpty()) {
if (init_data.IsEmpty() && !license_parser_->HasInitData()) {
LOGW("CdmSession::GenerateKeyRequest: init data absent");
return INIT_DATA_NOT_FOUND;
}

View File

@@ -1639,7 +1639,10 @@ TEST_F(WvCdmRequestLicenseTest, PrivacyModeTest) {
std::string resp = GetKeyRequestResponse(g_license_server, g_client_auth);
EXPECT_EQ(decryptor_.AddKey(session_id_, resp, &key_set_id_),
wvcdm::NEED_KEY);
GenerateKeyRequest(g_key_id, kLicenseTypeStreaming);
const std::string empty_init_data;
// Verify cached initialization data from previous request is used when
// empty initialization data is passed.
GenerateKeyRequest(empty_init_data, kLicenseTypeStreaming);
VerifyKeyRequestResponse(g_license_server, g_client_auth);
decryptor_.CloseSession(session_id_);
}