Update CDM to newest license protocol definitions.
* CDM license protocol updates [ Merge of http://go/wvgerrit/22789 ] No functional changes (yet) - all tests in widevine_ce_cdm_unittest run successfully. * Address android test build failures [ Merge of http://go/wvgerrit/22983 ] Updates to the license_protocol.proto in go/wvgerrit/22789 did not include the integration tests for android. b/34202048 Test: Reran unittests. All tests other than some oemcrypto, request_license_test passed. Those tests failed with or without this CL. Change-Id: Ib9041d397187859b8fcbc1b1f7d275f8c4ef6aba
This commit is contained in:
@@ -188,10 +188,11 @@ using ::testing::StrNe;
|
||||
|
||||
namespace wvcdm {
|
||||
// Protobuf generated classes
|
||||
using video_widevine_server::sdk::LicenseIdentification;
|
||||
using video_widevine_server::sdk::LicenseRequest_ContentIdentification;
|
||||
using video_widevine_server::sdk::ClientIdentification;
|
||||
using video_widevine_server::sdk::SignedMessage;
|
||||
using video_widevine::LicenseIdentification;
|
||||
using video_widevine::LicenseRequest_ContentIdentification;
|
||||
using video_widevine::LicenseRequest_ContentIdentification_CencDeprecated;
|
||||
using video_widevine::ClientIdentification;
|
||||
using video_widevine::SignedMessage;
|
||||
|
||||
class TestWvCdmClientPropertySet : public CdmClientPropertySet {
|
||||
public:
|
||||
@@ -460,7 +461,7 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
|
||||
return;
|
||||
}
|
||||
|
||||
void ValidateResponse(video_widevine_server::sdk::LicenseType license_type,
|
||||
void ValidateResponse(video_widevine::LicenseType license_type,
|
||||
bool has_provider_session_token) {
|
||||
// Validate signed response
|
||||
SignedMessage signed_message;
|
||||
@@ -470,7 +471,7 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
|
||||
EXPECT_TRUE(!signed_message.msg().empty());
|
||||
|
||||
// Verify license
|
||||
video_widevine_server::sdk::License license;
|
||||
video_widevine::License license;
|
||||
EXPECT_TRUE(license.ParseFromString(signed_message.msg()));
|
||||
|
||||
// Verify license identification
|
||||
@@ -491,18 +492,18 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
|
||||
EXPECT_TRUE(!signed_message.msg().empty());
|
||||
|
||||
// Verify license request
|
||||
video_widevine_server::sdk::LicenseRequest license_renewal;
|
||||
video_widevine::LicenseRequest license_renewal;
|
||||
EXPECT_TRUE(license_renewal.ParseFromString(signed_message.msg()));
|
||||
|
||||
// Verify Content Identification
|
||||
const LicenseRequest_ContentIdentification& content_id =
|
||||
license_renewal.content_id();
|
||||
EXPECT_FALSE(content_id.has_cenc_id());
|
||||
EXPECT_FALSE(content_id.has_webm_id());
|
||||
EXPECT_TRUE(content_id.has_license());
|
||||
EXPECT_FALSE(content_id.has_cenc_id_deprecated());
|
||||
EXPECT_FALSE(content_id.has_webm_id_deprecated());
|
||||
EXPECT_TRUE(content_id.has_existing_license());
|
||||
|
||||
const LicenseRequest_ContentIdentification::ExistingLicense&
|
||||
existing_license = content_id.license();
|
||||
existing_license = content_id.existing_license();
|
||||
|
||||
const LicenseIdentification& id = existing_license.license_id();
|
||||
EXPECT_EQ(license_id_.request_id(), id.request_id());
|
||||
@@ -518,10 +519,10 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
|
||||
expected_seconds_since_last_played, kClockTolerance);
|
||||
EXPECT_TRUE(existing_license.session_usage_table_entry().empty());
|
||||
|
||||
EXPECT_EQ(::video_widevine_server::sdk::LicenseRequest_RequestType_RENEWAL,
|
||||
EXPECT_EQ(::video_widevine::LicenseRequest_RequestType_RENEWAL,
|
||||
license_renewal.type());
|
||||
EXPECT_LT(0, license_renewal.request_time());
|
||||
EXPECT_EQ(video_widevine_server::sdk::VERSION_2_1,
|
||||
EXPECT_EQ(video_widevine::VERSION_2_1,
|
||||
license_renewal.protocol_version());
|
||||
EXPECT_TRUE(license_renewal.has_key_control_nonce());
|
||||
}
|
||||
@@ -538,18 +539,18 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
|
||||
EXPECT_TRUE(!signed_message.msg().empty());
|
||||
|
||||
// Verify license request
|
||||
video_widevine_server::sdk::LicenseRequest license_renewal;
|
||||
video_widevine::LicenseRequest license_renewal;
|
||||
EXPECT_TRUE(license_renewal.ParseFromString(signed_message.msg()));
|
||||
|
||||
// Verify Content Identification
|
||||
const LicenseRequest_ContentIdentification& content_id =
|
||||
license_renewal.content_id();
|
||||
EXPECT_FALSE(content_id.has_cenc_id());
|
||||
EXPECT_FALSE(content_id.has_webm_id());
|
||||
EXPECT_TRUE(content_id.has_license());
|
||||
EXPECT_FALSE(content_id.has_cenc_id_deprecated());
|
||||
EXPECT_FALSE(content_id.has_webm_id_deprecated());
|
||||
EXPECT_TRUE(content_id.has_existing_license());
|
||||
|
||||
const LicenseRequest_ContentIdentification::ExistingLicense&
|
||||
existing_license = content_id.license();
|
||||
existing_license = content_id.existing_license();
|
||||
|
||||
const LicenseIdentification& id = existing_license.license_id();
|
||||
EXPECT_EQ(license_id_.request_id(), id.request_id());
|
||||
@@ -598,10 +599,10 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
|
||||
EXPECT_NEAR(seconds_since_last_decrypt,
|
||||
expected_seconds_since_last_playback, kClockTolerance);
|
||||
|
||||
EXPECT_EQ(::video_widevine_server::sdk::LicenseRequest_RequestType_RELEASE,
|
||||
EXPECT_EQ(::video_widevine::LicenseRequest_RequestType_RELEASE,
|
||||
license_renewal.type());
|
||||
EXPECT_LT(0, license_renewal.request_time());
|
||||
EXPECT_EQ(video_widevine_server::sdk::VERSION_2_1,
|
||||
EXPECT_EQ(video_widevine::VERSION_2_1,
|
||||
license_renewal.protocol_version());
|
||||
EXPECT_TRUE(license_renewal.has_key_control_nonce());
|
||||
}
|
||||
@@ -678,7 +679,7 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
|
||||
CdmKeyResponse key_response_;
|
||||
CdmSessionId session_id_;
|
||||
CdmKeySetId key_set_id_;
|
||||
video_widevine_server::sdk::LicenseIdentification license_id_;
|
||||
video_widevine::LicenseIdentification license_id_;
|
||||
};
|
||||
|
||||
TEST_F(WvCdmExtendedDurationTest, VerifyLicenseRequestTest) {
|
||||
@@ -696,18 +697,18 @@ TEST_F(WvCdmExtendedDurationTest, VerifyLicenseRequestTest) {
|
||||
EXPECT_TRUE(!signed_message.msg().empty());
|
||||
|
||||
// Verify license request
|
||||
video_widevine_server::sdk::LicenseRequest license_request;
|
||||
video_widevine::LicenseRequest license_request;
|
||||
EXPECT_TRUE(license_request.ParseFromString(signed_message.msg()));
|
||||
|
||||
// Verify Client Identification
|
||||
const ClientIdentification& client_id = license_request.client_id();
|
||||
EXPECT_EQ(video_widevine_server::sdk::
|
||||
ClientIdentification_TokenType_DEVICE_CERTIFICATE,
|
||||
EXPECT_EQ(video_widevine::
|
||||
ClientIdentification_TokenType_DRM_DEVICE_CERTIFICATE,
|
||||
client_id.type());
|
||||
|
||||
EXPECT_LT(0, client_id.client_info_size());
|
||||
for (int i = 0; i < client_id.client_info_size(); ++i) {
|
||||
const ::video_widevine_server::sdk::ClientIdentification_NameValue&
|
||||
const ::video_widevine::ClientIdentification_NameValue&
|
||||
name_value = client_id.client_info(i);
|
||||
EXPECT_TRUE(!name_value.name().empty());
|
||||
EXPECT_TRUE(!name_value.value().empty());
|
||||
@@ -727,22 +728,22 @@ TEST_F(WvCdmExtendedDurationTest, VerifyLicenseRequestTest) {
|
||||
// Verify Content Identification
|
||||
const LicenseRequest_ContentIdentification& content_id =
|
||||
license_request.content_id();
|
||||
EXPECT_TRUE(content_id.has_cenc_id());
|
||||
EXPECT_FALSE(content_id.has_webm_id());
|
||||
EXPECT_FALSE(content_id.has_license());
|
||||
EXPECT_TRUE(content_id.has_cenc_id_deprecated());
|
||||
EXPECT_FALSE(content_id.has_webm_id_deprecated());
|
||||
EXPECT_FALSE(content_id.has_existing_license());
|
||||
|
||||
const LicenseRequest_ContentIdentification::CENC& cenc_id =
|
||||
content_id.cenc_id();
|
||||
const LicenseRequest_ContentIdentification_CencDeprecated& cenc_id =
|
||||
content_id.cenc_id_deprecated();
|
||||
EXPECT_TRUE(std::equal(cenc_id.pssh(0).begin(), cenc_id.pssh(0).end(),
|
||||
g_key_id.begin() + 32));
|
||||
EXPECT_EQ(video_widevine_server::sdk::STREAMING, cenc_id.license_type());
|
||||
EXPECT_EQ(video_widevine::STREAMING, cenc_id.license_type());
|
||||
EXPECT_TRUE(cenc_id.has_request_id());
|
||||
|
||||
// Verify other license request fields
|
||||
EXPECT_EQ(::video_widevine_server::sdk::LicenseRequest_RequestType_NEW,
|
||||
EXPECT_EQ(::video_widevine::LicenseRequest_RequestType_NEW,
|
||||
license_request.type());
|
||||
EXPECT_LT(0, license_request.request_time());
|
||||
EXPECT_EQ(video_widevine_server::sdk::VERSION_2_1,
|
||||
EXPECT_EQ(video_widevine::VERSION_2_1,
|
||||
license_request.protocol_version());
|
||||
EXPECT_TRUE(license_request.has_key_control_nonce());
|
||||
|
||||
@@ -763,14 +764,14 @@ TEST_F(WvCdmExtendedDurationTest, VerifyLicenseRenewalTest) {
|
||||
EXPECT_TRUE(!signed_message.msg().empty());
|
||||
|
||||
// Verify license
|
||||
video_widevine_server::sdk::License license;
|
||||
video_widevine::License license;
|
||||
EXPECT_TRUE(license.ParseFromString(signed_message.msg()));
|
||||
|
||||
// Verify license identification
|
||||
video_widevine_server::sdk::LicenseIdentification license_id = license.id();
|
||||
video_widevine::LicenseIdentification license_id = license.id();
|
||||
EXPECT_LT(0u, license_id.request_id().size());
|
||||
EXPECT_LT(0u, license_id.session_id().size());
|
||||
EXPECT_EQ(video_widevine_server::sdk::STREAMING, license_id.type());
|
||||
EXPECT_EQ(video_widevine::STREAMING, license_id.type());
|
||||
EXPECT_FALSE(license_id.has_provider_session_token());
|
||||
|
||||
// Create renewal request
|
||||
@@ -787,7 +788,7 @@ TEST_F(WvCdmExtendedDurationTest, VerifyLicenseRenewalTest) {
|
||||
EXPECT_TRUE(!signed_message.msg().empty());
|
||||
|
||||
// Verify license request
|
||||
video_widevine_server::sdk::LicenseRequest license_renewal;
|
||||
video_widevine::LicenseRequest license_renewal;
|
||||
EXPECT_TRUE(license_renewal.ParseFromString(signed_message.msg()));
|
||||
|
||||
// Client Identification not filled in in renewal
|
||||
@@ -795,12 +796,12 @@ TEST_F(WvCdmExtendedDurationTest, VerifyLicenseRenewalTest) {
|
||||
// Verify Content Identification
|
||||
const LicenseRequest_ContentIdentification& content_id =
|
||||
license_renewal.content_id();
|
||||
EXPECT_FALSE(content_id.has_cenc_id());
|
||||
EXPECT_FALSE(content_id.has_webm_id());
|
||||
EXPECT_TRUE(content_id.has_license());
|
||||
EXPECT_FALSE(content_id.has_cenc_id_deprecated());
|
||||
EXPECT_FALSE(content_id.has_webm_id_deprecated());
|
||||
EXPECT_TRUE(content_id.has_existing_license());
|
||||
|
||||
const LicenseRequest_ContentIdentification::ExistingLicense&
|
||||
existing_license = content_id.license();
|
||||
existing_license = content_id.existing_license();
|
||||
|
||||
const LicenseIdentification& id = existing_license.license_id();
|
||||
EXPECT_EQ(license_id.request_id(), id.request_id());
|
||||
@@ -814,10 +815,10 @@ TEST_F(WvCdmExtendedDurationTest, VerifyLicenseRenewalTest) {
|
||||
EXPECT_EQ(0, existing_license.seconds_since_last_played());
|
||||
EXPECT_TRUE(existing_license.session_usage_table_entry().empty());
|
||||
|
||||
EXPECT_EQ(::video_widevine_server::sdk::LicenseRequest_RequestType_RENEWAL,
|
||||
EXPECT_EQ(::video_widevine::LicenseRequest_RequestType_RENEWAL,
|
||||
license_renewal.type());
|
||||
EXPECT_LT(0, license_renewal.request_time());
|
||||
EXPECT_EQ(video_widevine_server::sdk::VERSION_2_1,
|
||||
EXPECT_EQ(video_widevine::VERSION_2_1,
|
||||
license_renewal.protocol_version());
|
||||
EXPECT_TRUE(license_renewal.has_key_control_nonce());
|
||||
|
||||
@@ -959,7 +960,7 @@ TEST_P(WvCdmStreamingNoPstTest, UsageTest) {
|
||||
GenerateKeyRequest(g_key_id, kLicenseTypeStreaming);
|
||||
VerifyKeyRequestResponse(g_license_server, g_client_auth, false);
|
||||
|
||||
ValidateResponse(video_widevine_server::sdk::STREAMING, false);
|
||||
ValidateResponse(video_widevine::STREAMING, false);
|
||||
|
||||
int64_t initial_license_duration_remaining = 0;
|
||||
int64_t initial_playback_duration_remaining = 0;
|
||||
@@ -1033,7 +1034,7 @@ TEST_P(WvCdmStreamingPstTest, UsageTest) {
|
||||
GenerateKeyRequest(kStreamingClip1PstInitData, kLicenseTypeStreaming);
|
||||
VerifyKeyRequestResponse(g_license_server, g_client_auth, false);
|
||||
|
||||
ValidateResponse(video_widevine_server::sdk::STREAMING, true);
|
||||
ValidateResponse(video_widevine::STREAMING, true);
|
||||
|
||||
int64_t initial_license_duration_remaining = 0;
|
||||
int64_t initial_playback_duration_remaining = 0;
|
||||
@@ -1098,7 +1099,7 @@ TEST_P(WvCdmStreamingUsageReportTest, UsageTest) {
|
||||
GenerateKeyRequest(kStreamingClip1PstInitData, kLicenseTypeStreaming);
|
||||
VerifyKeyRequestResponse(g_license_server, g_client_auth, false);
|
||||
|
||||
ValidateResponse(video_widevine_server::sdk::STREAMING, true);
|
||||
ValidateResponse(video_widevine::STREAMING, true);
|
||||
|
||||
int64_t initial_license_duration_remaining = 0;
|
||||
int64_t initial_playback_duration_remaining = 0;
|
||||
@@ -1194,7 +1195,7 @@ TEST_P(WvCdmOfflineUsageReportTest, UsageTest) {
|
||||
GenerateKeyRequest(kOfflineClip2PstInitData, kLicenseTypeOffline);
|
||||
VerifyKeyRequestResponse(g_license_server, g_client_auth, false);
|
||||
|
||||
ValidateResponse(video_widevine_server::sdk::OFFLINE, true);
|
||||
ValidateResponse(video_widevine::OFFLINE, true);
|
||||
|
||||
CdmKeySetId key_set_id = key_set_id_;
|
||||
EXPECT_FALSE(key_set_id_.empty());
|
||||
|
||||
Reference in New Issue
Block a user