Source release 18.1.0

This commit is contained in:
John "Juce" Bruce
2023-06-23 15:45:08 -07:00
parent 2baa7c6e2b
commit b2c35151ad
2074 changed files with 196004 additions and 427059 deletions

View File

@@ -143,7 +143,7 @@ class MockCryptoSession : public TestCryptoSession {
: TestCryptoSession(crypto_metrics) {}
MOCK_METHOD(bool, IsOpen, (), (override));
MOCK_METHOD(const std::string&, request_id, (), (override));
MOCK_METHOD(bool, HasUsageInfoSupport, (bool*), (override));
MOCK_METHOD(bool, HasUsageTableSupport, (bool*), (override));
MOCK_METHOD(CdmResponseType, GetHdcpCapabilities,
(HdcpCapability*, HdcpCapability*), (override));
MOCK_METHOD(bool, GetSupportedCertificateTypes, (SupportedCertificateTypes*),
@@ -151,7 +151,9 @@ class MockCryptoSession : public TestCryptoSession {
MOCK_METHOD(bool, GetApiVersion, (uint32_t*), (override));
MOCK_METHOD(CdmResponseType, GenerateNonce, (uint32_t*), (override));
MOCK_METHOD(CdmResponseType, PrepareAndSignLicenseRequest,
(const std::string&, std::string*, std::string*), (override));
(const std::string&, std::string*, std::string*, bool&,
OEMCrypto_SignatureHashAlgorithm&),
(override));
MOCK_METHOD(CdmResponseType, LoadEntitledContentKeys,
(const std::vector<CryptoKey>& key_array), (override));
MOCK_METHOD(bool, GetResourceRatingTier, (uint32_t*), (override));
@@ -188,12 +190,12 @@ using video_widevine::WidevinePsshData_EntitledKey;
// gmock methods
using ::testing::_;
using ::testing::DoAll;
using ::testing::Eq;
using ::testing::NotNull;
using ::testing::PrintToStringParamName;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::SetArgPointee;
using ::testing::SetArgReferee;
using ::testing::UnorderedElementsAre;
using ::testing::Values;
@@ -226,11 +228,11 @@ class CdmLicenseTest : public WvCdmTestBase {
}
void TearDown() override {
if (cdm_license_) delete cdm_license_;
if (policy_engine_) delete policy_engine_;
if (init_data_) delete init_data_;
if (crypto_session_) delete crypto_session_;
if (clock_) delete clock_;
delete cdm_license_;
delete policy_engine_;
delete init_data_;
delete crypto_session_;
delete clock_;
}
virtual void CreateCdmLicense() {
@@ -303,12 +305,13 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidation) {
EXPECT_CALL(*crypto_session_, IsOpen()).WillOnce(Return(true));
EXPECT_CALL(*crypto_session_, request_id())
.WillOnce(ReturnRef(kCryptoRequestId));
EXPECT_CALL(*crypto_session_, HasUsageInfoSupport(NotNull()))
EXPECT_CALL(*crypto_session_, HasUsageTableSupport(NotNull()))
.WillOnce(
DoAll(SetArgPointee<0>(usage_information_support), Return(true)));
EXPECT_CALL(*crypto_session_, GetHdcpCapabilities(NotNull(), NotNull()))
.WillOnce(DoAll(SetArgPointee<0>(current_hdcp_version),
SetArgPointee<1>(max_hdcp_version), Return(NO_ERROR)));
SetArgPointee<1>(max_hdcp_version),
Return(CdmResponseType(NO_ERROR))));
// Supported certificates set by SetUp().
EXPECT_CALL(*crypto_session_, GetSupportedCertificateTypes(NotNull()));
EXPECT_CALL(*crypto_session_, GetApiVersion(NotNull()))
@@ -318,12 +321,14 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidation) {
.WillOnce(DoAll(SetArgPointee<0>(resource_rating_tier), Return(true)));
EXPECT_CALL(*clock_, GetCurrentTime()).WillOnce(Return(kLicenseStartTime));
EXPECT_CALL(*crypto_session_, GenerateNonce(NotNull()))
.WillOnce(DoAll(SetArgPointee<0>(kNonce), Return(NO_ERROR)));
.WillOnce(
DoAll(SetArgPointee<0>(kNonce), Return(CdmResponseType(NO_ERROR))));
EXPECT_CALL(*crypto_session_,
PrepareAndSignLicenseRequest(_, NotNull(), NotNull()))
PrepareAndSignLicenseRequest(_, NotNull(), NotNull(), _, _))
.WillOnce(DoAll(SetArgPointee<1>(kFakeCoreMessage),
SetArgPointee<2>(kLicenseRequestSignature),
Return(NO_ERROR)));
SetArgReferee<3>(false),
Return(CdmResponseType(NO_ERROR))));
EXPECT_CALL(*crypto_session_, GetBuildInformation(NotNull()))
.WillOnce(DoAll(SetArgPointee<0>(kFakeBuildInfo), Return(true)));
EXPECT_CALL(*crypto_session_, GetWatermarkingSupport(NotNull()))
@@ -435,12 +440,13 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidationV15) {
EXPECT_CALL(*crypto_session_, IsOpen()).WillOnce(Return(true));
EXPECT_CALL(*crypto_session_, request_id())
.WillOnce(ReturnRef(kCryptoRequestId));
EXPECT_CALL(*crypto_session_, HasUsageInfoSupport(NotNull()))
EXPECT_CALL(*crypto_session_, HasUsageTableSupport(NotNull()))
.WillOnce(
DoAll(SetArgPointee<0>(usage_information_support), Return(true)));
EXPECT_CALL(*crypto_session_, GetHdcpCapabilities(NotNull(), NotNull()))
.WillOnce(DoAll(SetArgPointee<0>(current_hdcp_version),
SetArgPointee<1>(max_hdcp_version), Return(NO_ERROR)));
SetArgPointee<1>(max_hdcp_version),
Return(CdmResponseType(NO_ERROR))));
EXPECT_CALL(*crypto_session_, GetSupportedCertificateTypes(NotNull()));
EXPECT_CALL(*crypto_session_, GetApiVersion(NotNull()))
.WillOnce(
@@ -449,12 +455,14 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidationV15) {
.WillOnce(DoAll(SetArgPointee<0>(resource_rating_tier), Return(true)));
EXPECT_CALL(*clock_, GetCurrentTime()).WillOnce(Return(kLicenseStartTime));
EXPECT_CALL(*crypto_session_, GenerateNonce(NotNull()))
.WillOnce(DoAll(SetArgPointee<0>(kNonce), Return(NO_ERROR)));
.WillOnce(
DoAll(SetArgPointee<0>(kNonce), Return(CdmResponseType(NO_ERROR))));
EXPECT_CALL(*crypto_session_,
PrepareAndSignLicenseRequest(_, NotNull(), NotNull()))
PrepareAndSignLicenseRequest(_, NotNull(), NotNull(), _, _))
.WillOnce(DoAll(SetArgPointee<1>(kFakeCoreMessage),
SetArgPointee<2>(kLicenseRequestSignature),
Return(NO_ERROR)));
SetArgReferee<3>(false),
Return(CdmResponseType(NO_ERROR))));
EXPECT_CALL(*crypto_session_, GetBuildInformation(NotNull()))
.WillOnce(DoAll(SetArgPointee<0>(kFakeBuildInfo), Return(true)));
EXPECT_CALL(*crypto_session_, GetWatermarkingSupport(NotNull()))
@@ -598,7 +606,7 @@ TEST_P(CdmLicenseEntitledKeyTest, LoadsEntitledKeys) {
if (variant.should_succeed) {
EXPECT_CALL(*crypto_session_, LoadEntitledContentKeys(_))
.WillOnce(Return(KEY_ADDED));
.WillOnce(Return(CdmResponseType(KEY_ADDED)));
EXPECT_CALL(*policy_engine_, SetEntitledLicenseKeys(_)).Times(1);
} else {
EXPECT_CALL(*crypto_session_, LoadEntitledContentKeys(_)).Times(0);