From d2c384f6195c1ed3436a50b58070ca96ab63e260 Mon Sep 17 00:00:00 2001 From: Fred Gylys-Colwell Date: Wed, 21 Feb 2018 13:35:57 -0800 Subject: [PATCH] Adjust cdm engine test response to nonce flood Merge from Widevine repo of http://go/wvgerrit/43720 This CL changes the cdm engine test's Provision method so that it keeps OEMCrypto alive during the provisioning. This is only needed when testing with the oemcrypto mock and the nonce flood rate has been throttled to 1. In that case, if OEMCrypto is allowed to terminate between each request, all nonce requests will be an error. Keeping OEMCrypto alive does not modify the desired test results when oemcrypto is not throttled. This CL changes test code only. bug: 73607610 test: unit tests Change-Id: I71b27b1bb8200188a0a821afc977d7a9cc7fd968 --- libwvdrmengine/cdm/core/test/cdm_engine_test.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libwvdrmengine/cdm/core/test/cdm_engine_test.cpp b/libwvdrmengine/cdm/core/test/cdm_engine_test.cpp index 071a9fc7..3240813c 100644 --- a/libwvdrmengine/cdm/core/test/cdm_engine_test.cpp +++ b/libwvdrmengine/cdm/core/test/cdm_engine_test.cpp @@ -183,6 +183,10 @@ class WvCdmEnginePreProvTest : public testing::Test { CdmCertificateType cert_type = kCertificateWidevine; std::string cert_authority; std::string cert, wrapped_key; + // Keep a crypto session alive so that OEMCrypto won't terminate while we + // try to provision. This is needed for testing nonce floods. + CryptoSession keep_alive(cdm_engine_.GetMetrics()->GetCryptoMetrics()); + ASSERT_EQ(NO_ERROR, cdm_engine_.SetProvisioningServiceCertificate( g_provisioning_service_certificate)); CdmResponseType result = NO_ERROR;