Update OTA Keybox tests am: eb846100d4

Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/16058124

Change-Id: I9000ab12e582e2b1ec8992b70ab6a9c883f1a836
This commit is contained in:
Fred Gylys-Colwell
2021-10-28 17:02:15 +00:00
committed by Automerger Merge Worker

View File

@@ -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.