From 64c3cb986a5c7f7a215eeeb4c04952747233c0e1 Mon Sep 17 00:00:00 2001 From: Rahul Frias Date: Fri, 25 Oct 2013 13:15:56 -0700 Subject: [PATCH] Use renewal URL in license tests After a change to the GPlay license server, it no longer accepts heartbeats at the license server URL ( https://jmt17.google.com/video-dev/license/ ). The CDM correctly reports https://jmt17.google.com/video-dev/heartbeat/ as the renewal URL but the current test code ignores the reported URL. The license server then rejects the request and send back an empty license response. This causes WvCdmRequestLicenseTest.StreamingLicenseRenewal and WvCdmRequestLicenseTest.StreamingLicenseRenewal to fail. Request license tests have been modified to respect the renewal URL. Merge of https://widevine-internal-review.googlesource.com/#/c/8188 from the widevine cdm repo b/11290339 Change-Id: I1dcf8277edce99633086fb3db8ffeb7a32a5500d --- .../cdm/test/request_license_test.cpp | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/libwvdrmengine/cdm/test/request_license_test.cpp b/libwvdrmengine/cdm/test/request_license_test.cpp index e028249e..34a793b9 100644 --- a/libwvdrmengine/cdm/test/request_license_test.cpp +++ b/libwvdrmengine/cdm/test/request_license_test.cpp @@ -282,19 +282,19 @@ class WvCdmRequestLicenseTest : public testing::Test { } void GenerateRenewalRequest(const std::string& key_system, - CdmLicenseType license_type) { + CdmLicenseType license_type, + std::string* server_url) { // TODO application makes a license request, CDM will renew the license // when appropriate. std::string init_data; wvcdm::CdmAppParameterMap app_parameters; - std::string server_url; EXPECT_EQ(wvcdm::KEY_MESSAGE, decryptor_.GenerateKeyRequest(session_id_, key_set_id_, init_data, license_type, app_parameters, - &key_msg_, &server_url)); + &key_msg_, server_url)); // TODO(edwinwong, rfrias): Add tests cases for when license server url // is empty on renewal. Need appropriate key id at the server. - EXPECT_NE(0u, server_url.size()); + EXPECT_NE(0u, server_url->size()); } void GenerateKeyRelease(CdmKeySetId key_set_id) { @@ -690,8 +690,11 @@ TEST_F(WvCdmRequestLicenseTest, StreamingLicenseRenewal) { GenerateKeyRequest(g_key_system, g_key_id, kLicenseTypeStreaming); VerifyKeyRequestResponse(g_license_server, g_client_auth, g_key_id, false); - GenerateRenewalRequest(g_key_system, kLicenseTypeStreaming); - VerifyKeyRequestResponse(g_license_server, g_client_auth, g_key_id, true); + std::string license_server; + GenerateRenewalRequest(g_key_system, kLicenseTypeStreaming, &license_server); + if (license_server.empty()) + license_server = g_license_server; + VerifyKeyRequestResponse(license_server, g_client_auth, g_key_id, true); decryptor_.CloseSession(session_id_); } @@ -700,8 +703,11 @@ TEST_F(WvCdmRequestLicenseTest, OfflineLicenseRenewal) { GenerateKeyRequest(g_key_system, g_key_id, kLicenseTypeOffline); VerifyKeyRequestResponse(g_license_server, g_client_auth, g_key_id, false); - GenerateRenewalRequest(g_key_system, kLicenseTypeOffline); - VerifyKeyRequestResponse(g_license_server, g_client_auth, g_key_id, true); + std::string license_server; + GenerateRenewalRequest(g_key_system, kLicenseTypeOffline, &license_server); + if (license_server.empty()) + license_server = g_license_server; + VerifyKeyRequestResponse(license_server, g_client_auth, g_key_id, true); decryptor_.CloseSession(session_id_); }