From 1c96d290bdc67240c73a60fe52ee22c49795c80b Mon Sep 17 00:00:00 2001 From: Alex Dale Date: Tue, 21 Jun 2022 15:34:12 -0700 Subject: [PATCH] Update cdm provision tests to work with prov 4 [ Merge of http://go/wvgerrit/150810 ] This CL changes the call "Provision()" in some tests to use "EnsureProvisioned()". The latter can actually call "Provision()" twice in case of Prov 4 being used: first call to get oemcert.bin and second call to get drm cert.bin. Also added a file clean up during test tear-down. Test: opk_ta with prov2 and prov4 Bug: 180530495 Bug: 236317198 Change-Id: I37c8708ead7f18e8b4d619bf6a080424e45406ee --- libwvdrmengine/cdm/core/test/cdm_engine_test.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/libwvdrmengine/cdm/core/test/cdm_engine_test.cpp b/libwvdrmengine/cdm/core/test/cdm_engine_test.cpp index 0ed472e7..8f266bed 100644 --- a/libwvdrmengine/cdm/core/test/cdm_engine_test.cpp +++ b/libwvdrmengine/cdm/core/test/cdm_engine_test.cpp @@ -2,7 +2,7 @@ // source code may only be used and distributed under the Widevine License // Agreement. // These tests are for the cdm engine, and code below it in the stack. In -// particular, we assume that the OEMCrypo layer works, and has a valid keybox. +// particular, we assume that the OEMCrypto layer works, and has a valid keybox. // This is because we need a valid RSA certificate, and will attempt to connect // to the provisioning server to request one if we don't. @@ -65,7 +65,7 @@ class WvCdmEnginePreProvTest : public WvCdmTestBaseWithEngine { CdmResponseType status = cdm_engine_.OpenSession( config_.key_system(), nullptr, nullptr, &session_id_); if (status == NEED_PROVISIONING) { - Provision(); + EnsureProvisioned(); status = cdm_engine_.OpenSession(config_.key_system(), nullptr, nullptr, &session_id_); } @@ -335,20 +335,22 @@ TEST_F(WvCdmEngineTest, SetLicensingServiceInvalidCertificate) { NO_ERROR); }; -TEST_F(WvCdmEnginePreProvTestStaging, ProvisioningTest) { Provision(); } +TEST_F(WvCdmEnginePreProvTestStaging, ProvisioningTest) { EnsureProvisioned(); } -TEST_F(WvCdmEnginePreProvTestUatBinary, ProvisioningTest) { Provision(); } +TEST_F(WvCdmEnginePreProvTestUatBinary, ProvisioningTest) { + EnsureProvisioned(); +} // Test that provisioning works. -TEST_F(WvCdmEngineTest, ProvisioningTest) { Provision(); } +TEST_F(WvCdmEngineTest, ProvisioningTest) { EnsureProvisioned(); } // Test that provisioning works, even if device is already provisioned. TEST_F(WvCdmEngineTest, ReprovisioningTest) { // Provision once. - Provision(); + EnsureProvisioned(); // Verify that we can provision a second time, even though we already // provisioned once. - Provision(); + EnsureProvisioned(); } TEST_F(WvCdmEngineTest, BaseIsoBmffMessageTest) {