Pick widevine oemcrypto-v18 change

No-Typo-Check: From a third party header file
Bug: 260918793
Test: unit tests
Test: atp v2/widevine-eng/drm_compliance
Change-Id: I36effd6a10a99bdb2399ab1f4a0fad026d607c70
This commit is contained in:
Kyle Zhang
2022-12-16 03:21:08 +00:00
parent 4586522c07
commit 11255b7426
105 changed files with 324641 additions and 299787 deletions

View File

@@ -1510,6 +1510,51 @@ TEST_P(CdmUseCase_LimitedDurationLicense, Case6) {
AllowPlayback(start_of_playback_, end_of_play);
}
// Limited Duration License with Clear lead. (See above for notes on Use Case
// tests). The user has 15 minutes to begin watching the movie. If a renewal is
// not received, playback is terminated after 30 seconds. If a renewal is
// received, playback may continue for two hours from playback start.
class CdmUseCase_RenewOnLicenseLoad : public RenewalTest {
public:
CdmUseCase_RenewOnLicenseLoad() : RenewalTest("CDM_RenewOnLicenseLoad") {
renewal_delay_ = 5u;
renewal_recovery_ = 15;
// Pick a start of playback that is within the rental window, but so that
// the initial renewal window is after rental window.
start_of_playback_ = 10;
timer_limits_.soft_enforce_rental_duration = true;
timer_limits_.rental_duration_seconds = 20;
timer_limits_.soft_enforce_playback_duration = false;
timer_limits_.total_playback_duration_seconds = 50;
timer_limits_.initial_renewal_duration_seconds =
renewal_delay_ + renewal_recovery_;
// Load the renewal just before the cutoff:
renewal_load_time_ =
start_of_playback_ + renewal_delay_ + renewal_recovery_ - 1;
}
void SetUp() override {
RenewalTest::SetUp();
// The Renew on License Load feature is only supported on v18+ servers.
if (config_.ServerOlderThan(18)) {
GTEST_SKIP() << "Renew on License Load supported on v18+ servers only.";
}
}
uint64_t renewal_delay_;
uint64_t renewal_load_time_;
uint64_t renewal_recovery_;
};
// TODO(b/253513745): Replace this with some real tests.
TEST_P(CdmUseCase_RenewOnLicenseLoad, FakeTest) {
FAIL() << "This test will fail on a v18 server, but "
<< "should be skipped on all existing servers.";
}
// Heartbeat Playback Window License. (See above for notes on Use Case tests).
// This is similar to the renewal, but the renewal recovery is larger than the
// renewal delay.
@@ -1751,6 +1796,8 @@ INSTANTIATE_TEST_SUITE_P(Both, CdmUseCase_LicenseWithRenewalPlayback,
::testing::Values(false, true));
INSTANTIATE_TEST_SUITE_P(Both, CdmUseCase_LimitedDurationLicense,
::testing::Values(false, true));
INSTANTIATE_TEST_SUITE_P(Both, CdmUseCase_RenewOnLicenseLoad,
::testing::Values(false, true));
INSTANTIATE_TEST_SUITE_P(Both, CdmUseCase_InfiniteRenewal,
::testing::Values(false, true));
INSTANTIATE_TEST_SUITE_P(Both, CdmUseCase_LicenseDuration,

View File

@@ -335,7 +335,7 @@ bool FakeProvisioningServer::MakeResponse(
std::string core_response;
oemcrypto_core_message::serialize::CreateCoreProvisioningResponseFromProto(
oemcrypto_core_message::features::CoreMessageFeatures::kDefaultFeatures,
message, core_request_data, &core_response);
message, core_request_data, OEMCrypto_RSA_Private_Key, &core_response);
signed_response.set_oemcrypto_core_message(core_response);
// Also, the signature should be over the concatenation of the core message
// and the message body. This is done to ensure that neither the message

View File

@@ -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));
@@ -194,6 +196,7 @@ using ::testing::PrintToStringParamName;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::SetArgPointee;
using ::testing::SetArgReferee;
using ::testing::UnorderedElementsAre;
using ::testing::Values;
@@ -322,9 +325,10 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidation) {
.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),
SetArgReferee<3>(false),
Return(CdmResponseType(NO_ERROR))));
EXPECT_CALL(*crypto_session_, GetBuildInformation(NotNull()))
.WillOnce(DoAll(SetArgPointee<0>(kFakeBuildInfo), Return(true)));
@@ -455,9 +459,10 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidationV15) {
.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),
SetArgReferee<3>(false),
Return(CdmResponseType(NO_ERROR))));
EXPECT_CALL(*crypto_session_, GetBuildInformation(NotNull()))
.WillOnce(DoAll(SetArgPointee<0>(kFakeBuildInfo), Return(true)));