Source release 16.4.0
This commit is contained in:
@@ -19,7 +19,6 @@
|
||||
#include "initialization_data.h"
|
||||
#include "license_request.h"
|
||||
#include "log.h"
|
||||
#include "metrics.pb.h"
|
||||
#include "properties.h"
|
||||
#include "string_conversions.h"
|
||||
#include "test_base.h"
|
||||
@@ -27,6 +26,7 @@
|
||||
#include "url_request.h"
|
||||
#include "wv_cdm_constants.h"
|
||||
#include "wv_cdm_types.h"
|
||||
#include "wv_metrics.pb.h"
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
@@ -48,12 +48,9 @@ const std::string kFakeSessionId = "TotallyARealSession123456789";
|
||||
|
||||
} // namespace
|
||||
|
||||
class WvCdmEnginePreProvTest : public WvCdmTestBase {
|
||||
class WvCdmEnginePreProvTest : public WvCdmTestBaseWithEngine {
|
||||
public:
|
||||
WvCdmEnginePreProvTest()
|
||||
: dummy_engine_metrics_(new EngineMetrics),
|
||||
cdm_engine_(&file_system_, dummy_engine_metrics_),
|
||||
session_opened_(false) {}
|
||||
WvCdmEnginePreProvTest() : session_opened_(false) {}
|
||||
|
||||
~WvCdmEnginePreProvTest() override {}
|
||||
|
||||
@@ -109,16 +106,13 @@ class WvCdmEnginePreProvTest : public WvCdmTestBase {
|
||||
LicenseRequest license_request;
|
||||
license_request.GetDrmMessage(http_response, *response);
|
||||
|
||||
LOGV("response: size=%u, string:\n%s\n", response->size(),
|
||||
LOGV("response: size = %zu, string =\n%s\n", response->size(),
|
||||
Base64SafeEncode(
|
||||
std::vector<uint8_t>(response->begin(), response->end()))
|
||||
.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
FileSystem file_system_;
|
||||
shared_ptr<metrics::EngineMetrics> dummy_engine_metrics_;
|
||||
CdmEngine cdm_engine_;
|
||||
bool session_opened_;
|
||||
std::string key_msg_;
|
||||
std::string session_id_;
|
||||
@@ -239,7 +233,7 @@ class WvCdmEngineTest : public WvCdmEnginePreProvTest {
|
||||
std::string drm_msg;
|
||||
LicenseRequest lic_request;
|
||||
lic_request.GetDrmMessage(response, drm_msg);
|
||||
LOGV("drm msg: %u bytes\r\n%s", drm_msg.size(),
|
||||
LOGV("drm msg: %zu bytes\r\n%s", drm_msg.size(),
|
||||
HexEncode(reinterpret_cast<const uint8_t*>(drm_msg.data()),
|
||||
drm_msg.size())
|
||||
.c_str());
|
||||
@@ -402,14 +396,37 @@ 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());
|
||||
if (!server_url_.empty()) {
|
||||
// If the license server put a URL for the renewal in the license, we should
|
||||
// be able to verify the renewal against that server.
|
||||
VerifyRenewalKeyResponse(server_url_, config_.client_auth());
|
||||
} else {
|
||||
// If the license server did not give us a URL, we won't verify it.
|
||||
LOGE("License server did not set renewal URL. license_url=%s.",
|
||||
config_.license_server().c_str());
|
||||
// This is OK when you are using a local, debug, license server, but it
|
||||
// should NOT happen if using UAT or UAT nightly.
|
||||
EXPECT_EQ(std::string::npos, config_.license_server().find("proxy.uat"));
|
||||
}
|
||||
}
|
||||
|
||||
// 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) {
|
||||
|
||||
Reference in New Issue
Block a user