Handle nonce flood in OTA test

Merge from Widevine repo of http://go/wvgerrit/142049

This CL is test only code. A nonce flood was causing the OTA test to
be a little flaky when run on the automatic testing platform Luci.

Bug: 205889158
Change-Id: I4f3e5d8469b899e565c430bd46994e098c5d94e6
This commit is contained in:
Fred Gylys-Colwell
2021-12-19 07:22:33 +00:00
parent 2d1372fbec
commit 3c7528de62

View File

@@ -45,11 +45,20 @@ class CdmOtaKeyboxTest : public ::testing::Test {
std::string cert_authority;
CdmProvisioningRequest prov_request;
std::string provisioning_server_url;
CdmResponseType result = cdm_engine->GetProvisioningRequest(
cert_type, cert_authority, config.provisioning_service_certificate(),
kLevelDefault, &prov_request, &provisioning_server_url);
CdmResponseType result = CERT_PROVISIONING_NONCE_GENERATION_ERROR;
// Get a provisioning request. We might need one retry if there is a nonce
// flood failure.
for (int i = 0; i < 2; i++) {
result = cdm_engine->GetProvisioningRequest(
cert_type, cert_authority, config.provisioning_service_certificate(),
kLevelDefault, &prov_request, &provisioning_server_url);
if (result == CERT_PROVISIONING_NONCE_GENERATION_ERROR) {
TestSleep::Sleep(2);
continue;
}
break;
}
ASSERT_EQ(NO_ERROR, result);
LOGV("Provisioning request: req = %s", prov_request.c_str());
// Ignore URL provided by CdmEngine. Use ours, as configured