From 7604158d6f627e29a4acef9b24913c3d5075f217 Mon Sep 17 00:00:00 2001 From: Fred Gylys-Colwell Date: Fri, 14 Aug 2020 12:42:30 -0700 Subject: [PATCH] Test renewal against same and different server Merge from Widevine repo of http://go/wvgerrit/102843 The test WvCdmEngineTest.LicenseRenewal is split into two tests. One test verifies that the renewal may be fetched from the server specified in the license. The second test verifies that the renewal may be fetched from the same server that the license was fetched from. These might be the same server, but when we run against an experimental server, a staging server, or UAT Nightly, these will be different. Test: ran the tests Bug: 141438127 Change-Id: Ia11441bd2ba0c6ddb264ee38bfcb5060b9ddb476 --- .../cdm/core/test/cdm_engine_test.cpp | 20 +++++++++++++++---- libwvdrmengine/cdm/core/test/url_request.cpp | 4 +++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/libwvdrmengine/cdm/core/test/cdm_engine_test.cpp b/libwvdrmengine/cdm/core/test/cdm_engine_test.cpp index 5d24e264..080748d5 100644 --- a/libwvdrmengine/cdm/core/test/cdm_engine_test.cpp +++ b/libwvdrmengine/cdm/core/test/cdm_engine_test.cpp @@ -402,14 +402,26 @@ TEST_F(WvCdmEngineTest, LoadKey) { holder.SignAndLoadLicense(); } -TEST_F(WvCdmEngineTest, LicenseRenewal) { +// This test generates a renewal and then requests the renewal using the server +// url specified in the license. This is what most apps would do, but you should +// skip this test when you want to set the license and renewal server on the +// command line. +TEST_F(WvCdmEngineTest, LicenseRenewalSpecifiedServer) { GenerateKeyRequest(binary_key_id(), kCencMimeType); VerifyNewKeyResponse(config_.license_server(), config_.client_auth()); GenerateRenewalRequest(); - VerifyRenewalKeyResponse( - server_url_.empty() ? config_.license_server() : server_url_, - config_.client_auth()); + VerifyRenewalKeyResponse(server_url_, config_.client_auth()); +} + +// This test generates a renewal and then requests the renewal from the same +// server from which we requested the original license. +TEST_F(WvCdmEngineTest, LicenseRenewalSameServer) { + GenerateKeyRequest(binary_key_id(), kCencMimeType); + VerifyNewKeyResponse(config_.license_server(), config_.client_auth()); + + GenerateRenewalRequest(); + VerifyRenewalKeyResponse(config_.license_server(), config_.client_auth()); } TEST_F(WvCdmEngineTest, ParseDecryptHashStringTest) { diff --git a/libwvdrmengine/cdm/core/test/url_request.cpp b/libwvdrmengine/cdm/core/test/url_request.cpp index e33aed8c..7978ef3d 100644 --- a/libwvdrmengine/cdm/core/test/url_request.cpp +++ b/libwvdrmengine/cdm/core/test/url_request.cpp @@ -117,7 +117,9 @@ bool UrlRequest::GetResponse(std::string* message) { } ConcatenateChunkedResponse(response, message); - LOGV("HTTP response: (%d): %s", message->size(), message->c_str()); + LOGV("HTTP response from %s://%s:%d%s: (%zd): %s", socket_.scheme().c_str(), + socket_.domain_name().c_str(), socket_.port(), + socket_.resource_path().c_str(), message->size(), message->c_str()); return true; }