Source release 17.1.2
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "create_test_file_system.h"
|
||||
#include "crypto_session.h"
|
||||
#include "properties.h"
|
||||
#include "provisioning_holder.h"
|
||||
#include "test_base.h"
|
||||
#include "test_printers.h"
|
||||
#include "test_sleep.h"
|
||||
@@ -43,47 +44,10 @@ class CdmOtaKeyboxTest : public ::testing::Test {
|
||||
|
||||
void Provision(TestCdmEngine* cdm_engine) {
|
||||
ConfigTestEnv config = *WvCdmTestBase::default_config_;
|
||||
ProvisioningHolder provisioner(cdm_engine, config);
|
||||
CdmCertificateType cert_type = kCertificateWidevine;
|
||||
std::string cert_authority;
|
||||
CdmProvisioningRequest prov_request;
|
||||
std::string 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) {
|
||||
wvutil::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
|
||||
// for test vs. production server.
|
||||
provisioning_server_url.assign(config.provisioning_server());
|
||||
|
||||
// Make request.
|
||||
UrlRequest url_request(provisioning_server_url);
|
||||
if (!url_request.is_connected()) {
|
||||
LOGE("Failed to connect to provisioning server: url = %s",
|
||||
provisioning_server_url.c_str());
|
||||
}
|
||||
url_request.PostCertRequestInQueryString(prov_request);
|
||||
|
||||
// Receive and parse response.
|
||||
std::string http_message;
|
||||
ASSERT_TRUE(url_request.GetResponse(&http_message))
|
||||
<< "Failed to get provisioning response";
|
||||
LOGV("http_message: \n%s\n", http_message.c_str());
|
||||
|
||||
std::string cert, wrapped_key;
|
||||
ASSERT_EQ(NO_ERROR, cdm_engine->HandleProvisioningResponse(
|
||||
http_message, kLevelDefault, &cert, &wrapped_key));
|
||||
constexpr bool binary_provisioning = false;
|
||||
provisioner.Provision(cert_type, binary_provisioning);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user