Added CDM support for Watermarking reporting.
[ Merge of http://go/wvgerrit/148552 ] Extended the CDM layer to report OEMCrypto's watermarking support. The reporting of watermarking comes in three (3) mechanisms: 1) ClientCapabilities in license requests 2) CryptoSession metrics when queried to OEMCrypto 3) String property query by apps If OEMCrypto implementents OEMCrypto_GetWatermarkingSupport(), then the reported watermarking support by the CDM will match that of OEMCrypto. If OEMCrypto does not implement OEMCrypto_GetWatermarkingSupport() or an error occurs, it is assumed that OEMCrypto does not support watermarking, and the CDM will report "Not Supported". Bug: 226443788 Test: run_x86_64_tests request_license_test and license_unittest Change-Id: Id929a356c395e6bcf45d371ee6887eec40d35329
This commit is contained in:
@@ -135,6 +135,7 @@ const std::string kFakeKeyTooLong =
|
||||
a2bs_hex("d4bc8605d662878a46adb2adb6bf3c0b30a54a0c2f");
|
||||
const std::string kFakeKeyTooShort = a2bs_hex("06e247e7f924208011");
|
||||
const std::string kFakeIv = a2bs_hex("3d515a3ee0be1687080ac59da9e0d69a");
|
||||
const std::string kFakeBuildInfo = "Mock Crypto Session - License Test";
|
||||
|
||||
class MockCryptoSession : public TestCryptoSession {
|
||||
public:
|
||||
@@ -154,6 +155,11 @@ class MockCryptoSession : public TestCryptoSession {
|
||||
MOCK_METHOD(CdmResponseType, LoadEntitledContentKeys,
|
||||
(const std::vector<CryptoKey>& key_array), (override));
|
||||
MOCK_METHOD(bool, GetResourceRatingTier, (uint32_t*), (override));
|
||||
MOCK_METHOD(bool, GetWatermarkingSupport, (CdmWatermarkingSupport*),
|
||||
(override));
|
||||
MOCK_METHOD(bool, GetBuildInformation, (std::string*), (override));
|
||||
|
||||
CdmSecurityLevel GetSecurityLevel() override { return kSecurityLevelL1; }
|
||||
};
|
||||
|
||||
class MockPolicyEngine : public PolicyEngine {
|
||||
@@ -318,6 +324,11 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidation) {
|
||||
.WillOnce(DoAll(SetArgPointee<1>(kFakeCoreMessage),
|
||||
SetArgPointee<2>(kLicenseRequestSignature),
|
||||
Return(NO_ERROR)));
|
||||
EXPECT_CALL(*crypto_session_, GetBuildInformation(NotNull()))
|
||||
.WillOnce(DoAll(SetArgPointee<0>(kFakeBuildInfo), Return(true)));
|
||||
EXPECT_CALL(*crypto_session_, GetWatermarkingSupport(NotNull()))
|
||||
.WillOnce(
|
||||
DoAll(SetArgPointee<0>(kWatermarkingConfigurable), Return(true)));
|
||||
|
||||
CreateCdmLicense();
|
||||
EXPECT_TRUE(cdm_license_->Init(true, kDefaultServiceCertificate,
|
||||
@@ -385,6 +396,8 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidation) {
|
||||
ClientCapabilities::ECC_SECP384R1,
|
||||
ClientCapabilities::ECC_SECP521R1));
|
||||
EXPECT_TRUE(client_capabilities.has_resource_rating_tier());
|
||||
EXPECT_EQ(client_capabilities.watermarking_support(),
|
||||
ClientCapabilities::WATERMARKING_CONFIGURABLE);
|
||||
|
||||
// Verify Content Identification
|
||||
const LicenseRequest_ContentIdentification& content_id =
|
||||
@@ -442,6 +455,11 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidationV15) {
|
||||
.WillOnce(DoAll(SetArgPointee<1>(kFakeCoreMessage),
|
||||
SetArgPointee<2>(kLicenseRequestSignature),
|
||||
Return(NO_ERROR)));
|
||||
EXPECT_CALL(*crypto_session_, GetBuildInformation(NotNull()))
|
||||
.WillOnce(DoAll(SetArgPointee<0>(kFakeBuildInfo), Return(true)));
|
||||
EXPECT_CALL(*crypto_session_, GetWatermarkingSupport(NotNull()))
|
||||
.WillOnce(
|
||||
DoAll(SetArgPointee<0>(kWatermarkingNotSupported), Return(true)));
|
||||
|
||||
CreateCdmLicense();
|
||||
EXPECT_TRUE(cdm_license_->Init(true, kDefaultServiceCertificate,
|
||||
@@ -509,6 +527,8 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidationV15) {
|
||||
ClientCapabilities::ECC_SECP384R1,
|
||||
ClientCapabilities::ECC_SECP521R1));
|
||||
EXPECT_EQ(resource_rating_tier, client_capabilities.resource_rating_tier());
|
||||
EXPECT_EQ(client_capabilities.watermarking_support(),
|
||||
ClientCapabilities::WATERMARKING_NOT_SUPPORTED);
|
||||
|
||||
// Verify Content Identification
|
||||
const LicenseRequest_ContentIdentification& content_id =
|
||||
|
||||
Reference in New Issue
Block a user