Provisioning 3.0: Changes to Provisioning and Service Certs.
[ Merge of http://go/wvgerrit/23360 ] Service Certificates are used in two places, provisioning and licensing. The service certificate code depended on a session_id to get and set the service certificate properties, but the session_id was not available in the provisioning path. This patch pulls out the property lookup by session_id dependency, and passes the CdmImpl's property_set into the provisioning code, so the service certificate can be read and written there. Bug: 62972441 Test: WV unit/integration tests. This introduces three test failures * WvCdmRequestLicenseTest.PrivacyModeWithServiceCertificateTest * Cdm/WvCdmStreamingLicenseRenewalTest.WithClientId/4 * Cdm/WvCdmOfflineLicenseReleaseTest.WithClientId/3 Change-Id: I6e9d4e23a9e7e81a63a994db8ec0b443893449a6
This commit is contained in:
@@ -5,10 +5,12 @@
|
||||
|
||||
#include "clock.h"
|
||||
#include "crypto_session.h"
|
||||
#include "default_service_certificate.h"
|
||||
#include "initialization_data.h"
|
||||
#include "license.h"
|
||||
#include "policy_engine.h"
|
||||
#include "properties.h"
|
||||
#include "service_certificate.h"
|
||||
#include "string_conversions.h"
|
||||
#include "wv_cdm_constants.h"
|
||||
|
||||
@@ -155,25 +157,26 @@ class CdmLicenseTest : public ::testing::Test {
|
||||
MockCryptoSession* crypto_session_;
|
||||
MockInitializationData* init_data_;
|
||||
MockPolicyEngine* policy_engine_;
|
||||
ServiceCertificate service_cert_;
|
||||
};
|
||||
|
||||
TEST_F(CdmLicenseTest, InitSuccess) {
|
||||
EXPECT_CALL(*crypto_session_, IsOpen()).WillOnce(Return(true));
|
||||
|
||||
CreateCdmLicense();
|
||||
EXPECT_TRUE(cdm_license_->Init(kToken, kClientTokenDrmCert,
|
||||
EXPECT_TRUE(cdm_license_->Init(&service_cert_, kToken, kClientTokenDrmCert,
|
||||
crypto_session_, policy_engine_));
|
||||
}
|
||||
|
||||
TEST_F(CdmLicenseTest, InitFail_EmptyToken) {
|
||||
CreateCdmLicense();
|
||||
EXPECT_FALSE(cdm_license_->Init("", kClientTokenDrmCert,
|
||||
EXPECT_FALSE(cdm_license_->Init(&service_cert_, "", kClientTokenDrmCert,
|
||||
crypto_session_, policy_engine_));
|
||||
}
|
||||
|
||||
TEST_F(CdmLicenseTest, InitFail_CryptoSessionNull) {
|
||||
CreateCdmLicense();
|
||||
EXPECT_FALSE(cdm_license_->Init(kToken, kClientTokenDrmCert,
|
||||
EXPECT_FALSE(cdm_license_->Init(&service_cert_, kToken, kClientTokenDrmCert,
|
||||
NULL, policy_engine_));
|
||||
}
|
||||
|
||||
@@ -181,10 +184,18 @@ TEST_F(CdmLicenseTest, InitFail_PolicyEngineNull) {
|
||||
EXPECT_CALL(*crypto_session_, IsOpen()).WillOnce(Return(true));
|
||||
|
||||
CreateCdmLicense();
|
||||
EXPECT_FALSE(cdm_license_->Init(kToken, kClientTokenDrmCert,
|
||||
EXPECT_FALSE(cdm_license_->Init(&service_cert_, kToken, kClientTokenDrmCert,
|
||||
crypto_session_, NULL));
|
||||
}
|
||||
|
||||
TEST_F(CdmLicenseTest, InitWithNullServiceCert) {
|
||||
EXPECT_CALL(*crypto_session_, IsOpen()).WillOnce(Return(true));
|
||||
|
||||
CreateCdmLicense();
|
||||
EXPECT_TRUE(cdm_license_->Init(NULL, kToken, kClientTokenDrmCert,
|
||||
crypto_session_, policy_engine_));
|
||||
}
|
||||
|
||||
TEST_F(CdmLicenseTest, PrepareKeyRequestValidation) {
|
||||
bool usage_information_support = true;
|
||||
CryptoSession::HdcpCapability current_hdcp_version = HDCP_NO_DIGITAL_OUTPUT;
|
||||
@@ -219,16 +230,17 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidation) {
|
||||
DoAll(SetArgPointee<2>(kLicenseRequestSignature), Return(true)));
|
||||
|
||||
CreateCdmLicense();
|
||||
EXPECT_TRUE(cdm_license_->Init(kToken, kClientTokenDrmCert,
|
||||
service_cert_.Init(kDefaultServiceCertificate);
|
||||
EXPECT_TRUE(cdm_license_->Init(&service_cert_, kToken, kClientTokenDrmCert,
|
||||
crypto_session_, policy_engine_));
|
||||
|
||||
CdmAppParameterMap app_parameters;
|
||||
CdmKeyMessage signed_request;
|
||||
Properties::set_use_certificates_as_identification(true);
|
||||
std::string server_url;
|
||||
EXPECT_TRUE(cdm_license_->PrepareKeyRequest(
|
||||
EXPECT_EQ(cdm_license_->PrepareKeyRequest(
|
||||
*init_data_, kLicenseTypeStreaming, app_parameters,
|
||||
&signed_request, &server_url));
|
||||
&signed_request, &server_url), KEY_MESSAGE);
|
||||
|
||||
EXPECT_TRUE(!signed_request.empty());
|
||||
|
||||
@@ -287,7 +299,7 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidation) {
|
||||
// Verify Content Identification
|
||||
const LicenseRequest_ContentIdentification& content_id =
|
||||
license_request.content_id();
|
||||
EXPECT_TRUE(content_id.has_cenc_id_deprecated());
|
||||
ASSERT_TRUE(content_id.has_cenc_id_deprecated());
|
||||
EXPECT_FALSE(content_id.has_webm_id_deprecated());
|
||||
EXPECT_FALSE(content_id.has_existing_license());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user