From f83e813ea8b390247d2993bf1492f60f7cdd3263 Mon Sep 17 00:00:00 2001 From: Rahul Frias Date: Fri, 1 Feb 2019 00:06:21 -0800 Subject: [PATCH] Enable provider client token test [ Merge of http://go/wvgerrit/71907 ] The client token needed to be enabled in the license request. Bug: 123369846 Bug: 123370099 Test: WV unit/integration tests Change-Id: I4d3e944b1d79010977c119291594878c406b00c5 --- libwvdrmengine/cdm/core/src/client_identification.cpp | 2 ++ libwvdrmengine/cdm/core/src/license.cpp | 7 ++++++- libwvdrmengine/cdm/core/test/license_unittest.cpp | 4 ++-- libwvdrmengine/cdm/test/request_license_test.cpp | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/libwvdrmengine/cdm/core/src/client_identification.cpp b/libwvdrmengine/cdm/core/src/client_identification.cpp index 3dd220da..1a1d864f 100644 --- a/libwvdrmengine/cdm/core/src/client_identification.cpp +++ b/libwvdrmengine/cdm/core/src/client_identification.cpp @@ -157,6 +157,8 @@ CdmResponseType ClientIdentification::Prepare( ClientIdentification_ClientCapabilities* client_capabilities = client_id->mutable_client_capabilities(); + client_capabilities->set_client_token(true); + if (is_license_request_) { bool supports_usage_information; if (crypto_session_->UsageInformationSupport(&supports_usage_information)) { diff --git a/libwvdrmengine/cdm/core/src/license.cpp b/libwvdrmengine/cdm/core/src/license.cpp index 63d3d550..22bd78c2 100644 --- a/libwvdrmengine/cdm/core/src/license.cpp +++ b/libwvdrmengine/cdm/core/src/license.cpp @@ -602,7 +602,9 @@ CdmResponseType CdmLicense::HandleKeyResponse( return NO_CONTENT_KEY; } license_key_type_ = key_type; - provider_client_token_ = license.provider_client_token(); + + if (license.has_provider_client_token()) + provider_client_token_ = license.provider_client_token(); if (license.has_srm_update()) { CdmResponseType status = crypto_session_->LoadSrm(license.srm_update()); @@ -880,6 +882,9 @@ CdmResponseType CdmLicense::RestoreLicenseForRelease( return LICENSE_RESPONSE_PARSE_ERROR_5; } + if (license.has_provider_client_token()) + provider_client_token_ = license.provider_client_token(); + if (license.id().has_provider_session_token()) provider_session_token_ = license.id().provider_session_token(); diff --git a/libwvdrmengine/cdm/core/test/license_unittest.cpp b/libwvdrmengine/cdm/core/test/license_unittest.cpp index 6f54b464..d730eb20 100644 --- a/libwvdrmengine/cdm/core/test/license_unittest.cpp +++ b/libwvdrmengine/cdm/core/test/license_unittest.cpp @@ -382,7 +382,7 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidation) { const ::video_widevine::ClientIdentification_ClientCapabilities& client_capabilities = client_id.client_capabilities(); - EXPECT_FALSE(client_capabilities.has_client_token()); + EXPECT_TRUE(client_capabilities.has_client_token()); EXPECT_TRUE(client_capabilities.has_session_token()); EXPECT_FALSE(client_capabilities.video_resolution_constraints()); EXPECT_EQ(video_widevine:: @@ -505,7 +505,7 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidationV15) { const ::video_widevine::ClientIdentification_ClientCapabilities& client_capabilities = client_id.client_capabilities(); - EXPECT_FALSE(client_capabilities.has_client_token()); + EXPECT_TRUE(client_capabilities.has_client_token()); EXPECT_TRUE(client_capabilities.has_session_token()); EXPECT_FALSE(client_capabilities.video_resolution_constraints()); EXPECT_EQ(video_widevine:: diff --git a/libwvdrmengine/cdm/test/request_license_test.cpp b/libwvdrmengine/cdm/test/request_license_test.cpp index 2484fc0c..a5e1a464 100644 --- a/libwvdrmengine/cdm/test/request_license_test.cpp +++ b/libwvdrmengine/cdm/test/request_license_test.cpp @@ -4086,7 +4086,7 @@ TEST_F(WvCdmRequestLicenseTest, UsageRemoveSecureStopTest) { } // TODO(rfrias): Enable when b/123370099 has been addressed -TEST_F(WvCdmRequestLicenseTest, DISABLED_VerifyProviderClientToken) { +TEST_F(WvCdmRequestLicenseTest, VerifyProviderClientToken) { Unprovision(); Provision(kLevelDefault);