Update OTA Keybox tests
Merge from Widevine repo of http://go/wvgerrit/135982 The basic test was failing when using the testbed oemcrypto because the testbed deletes its keybox on each initialization. The test would terminate and re-initialize oemcrypto whenever all the crypto sessions are deleted. This has been fixed by holding a crypto session alive until the end of the test. bug: 187646550 Test: test only code Merged-In: I48a3771bf5fd4aae8d262b8c7bf42f004d9b9f4c Change-Id: I48a3771bf5fd4aae8d262b8c7bf42f004d9b9f4c
This commit is contained in:
committed by
Alex Dale
parent
80463a0eea
commit
eb846100d4
@@ -82,6 +82,27 @@ TEST_F(CdmOtaKeyboxTest, BasicTest) {
|
||||
FileSystem file_system;
|
||||
TestCdmEngine cdm_engine(&file_system,
|
||||
std::shared_ptr<EngineMetrics>(new EngineMetrics));
|
||||
// Create a singleton crypto session to prevent OEMCrypto from being
|
||||
// terminated. This is really only needed when running the test against the
|
||||
// testbed OEMCrypto which does not save its keybox across init/terminate.
|
||||
metrics::CryptoMetrics crypto_metrics;
|
||||
std::unique_ptr<CryptoSession> crypto_session(
|
||||
CryptoSession::MakeCryptoSession(&crypto_metrics));
|
||||
// Remove any existing certificate.
|
||||
cdm_engine.Unprovision(kSecurityLevelL1);
|
||||
std::string system_id;
|
||||
CdmResponseType system_id_status =
|
||||
cdm_engine.QueryStatus(kLevelDefault, QUERY_KEY_SYSTEM_ID, &system_id);
|
||||
if (system_id_status == NO_ERROR) {
|
||||
std::cout << " "
|
||||
<< "System ID before test: " << system_id << "\n";
|
||||
} else {
|
||||
std::cout << " "
|
||||
<< "Could not find system id before test. ";
|
||||
PrintTo(system_id_status, &std::cout);
|
||||
std::cout << "\n";
|
||||
}
|
||||
|
||||
CdmSessionId session_id;
|
||||
ConfigTestEnv config = WvCdmTestBase::default_config_;
|
||||
|
||||
@@ -97,6 +118,17 @@ TEST_F(CdmOtaKeyboxTest, BasicTest) {
|
||||
}
|
||||
std::cout << "First provisioning process.\n";
|
||||
Provision(&cdm_engine);
|
||||
system_id_status =
|
||||
cdm_engine.QueryStatus(kLevelDefault, QUERY_KEY_SYSTEM_ID, &system_id);
|
||||
if (system_id_status == NO_ERROR) {
|
||||
std::cout << " "
|
||||
<< "System ID after first provisioning: " << system_id << "\n";
|
||||
} else {
|
||||
std::cout << " "
|
||||
<< "Could not find system id after first provisioning. ";
|
||||
PrintTo(system_id_status, &std::cout);
|
||||
std::cout << "\n";
|
||||
}
|
||||
|
||||
// After the first provisioning pass, we try to open a session again. If the
|
||||
// first provisioning was to install a keybox, this provisioning should be to
|
||||
@@ -111,6 +143,17 @@ TEST_F(CdmOtaKeyboxTest, BasicTest) {
|
||||
}
|
||||
std::cout << "Second provisioning process.\n";
|
||||
Provision(&cdm_engine);
|
||||
system_id_status =
|
||||
cdm_engine.QueryStatus(kLevelDefault, QUERY_KEY_SYSTEM_ID, &system_id);
|
||||
if (system_id_status == NO_ERROR) {
|
||||
std::cout << " "
|
||||
<< "System ID after second provisioning: " << system_id << "\n";
|
||||
} else {
|
||||
std::cout << " "
|
||||
<< "Could not find system id after second provisioning. ";
|
||||
PrintTo(system_id_status, &std::cout);
|
||||
std::cout << "\n";
|
||||
}
|
||||
|
||||
// After the second provisioning pass, we should be able to open a session
|
||||
// and continue.
|
||||
|
||||
Reference in New Issue
Block a user