Address CE CDM test failures and code review comments
The android CL ag/13947818 was submitted before some CE CDM test failures were noticed and code review comments were received. Bug: 184813991 Test: WV unit/integration test Change-Id: Ic31ca5bc5e46994e01eca56248e6bdffedd779f3
This commit is contained in:
@@ -397,16 +397,36 @@ void WvCdmTestBase::Provision() {
|
||||
void WvCdmTestBase::EnsureProvisioned() {
|
||||
CdmSessionId session_id;
|
||||
FileSystem file_system;
|
||||
// OpenSession will check if a DRM certificate exists, while
|
||||
// GenerateKeyRequest will actually load the wrapped private key.
|
||||
// Either may return a NEED_PROVISIONING error, so both have to be checked.
|
||||
TestCdmEngine cdm_engine(&file_system,
|
||||
std::shared_ptr<EngineMetrics>(new EngineMetrics));
|
||||
CdmResponseType status = cdm_engine.OpenSession(config_.key_system(), nullptr,
|
||||
nullptr, &session_id);
|
||||
|
||||
CdmAppParameterMap app_parameters;
|
||||
CdmKeySetId key_set_id;
|
||||
InitializationData init_data(ISO_BMFF_VIDEO_MIME_TYPE, binary_key_id());
|
||||
CdmKeyRequest key_request;
|
||||
if (status == NO_ERROR) {
|
||||
status = cdm_engine.GenerateKeyRequest(session_id, key_set_id, init_data,
|
||||
kLicenseTypeStreaming,
|
||||
app_parameters, &key_request);
|
||||
}
|
||||
|
||||
if (status == NEED_PROVISIONING) {
|
||||
Provision();
|
||||
status = cdm_engine.OpenSession(config_.key_system(), nullptr, nullptr,
|
||||
&session_id);
|
||||
|
||||
ASSERT_EQ(NO_ERROR, status);
|
||||
status = cdm_engine.GenerateKeyRequest(session_id, key_set_id, init_data,
|
||||
kLicenseTypeStreaming,
|
||||
app_parameters, &key_request);
|
||||
ASSERT_EQ(KEY_MESSAGE, status);
|
||||
}
|
||||
ASSERT_EQ(NO_ERROR, status);
|
||||
ASSERT_EQ(KEY_MESSAGE, status);
|
||||
ASSERT_NE("", session_id) << "Could not open CDM session.";
|
||||
ASSERT_TRUE(cdm_engine.IsOpenSession(session_id));
|
||||
ASSERT_EQ(NO_ERROR, cdm_engine.CloseSession(session_id));
|
||||
|
||||
Reference in New Issue
Block a user