Add recoverable errors
[ Merge of http://go/wvgerrit/71326 ] Nonce flood, frame size, session and system invalidation errors will now bubble up to the app. OEMCrypto v15 returns OEMCrypto_ERROR_BUFFER_TOO_LARGE, OEMCrypto_ERROR_SESSION_LOST_STATE, OEMCrypto_ERROR_SYSTEM_INVALIDATED and a variety of nonce errors. These will be reported to HIDL as OUTPUT_TOO_LARGE_ERROR, ERROR_DRM_SESSION_LOST_STATE, ERROR_DRM_INVALID_STATE and ERROR_DRM_RESOURCE_CONTENTION. Bug: 120572706 Test: Unit/Integration tests Change-Id: Ida177300046327ce81592a273028ef6c3a0d9fd9
This commit is contained in:
@@ -140,11 +140,13 @@ class MockCryptoSession : public TestCryptoSession {
|
||||
MOCK_METHOD0(IsOpen, bool());
|
||||
MOCK_METHOD0(request_id, const std::string&());
|
||||
MOCK_METHOD1(UsageInformationSupport, bool(bool*));
|
||||
MOCK_METHOD2(GetHdcpCapabilities, bool(HdcpCapability*, HdcpCapability*));
|
||||
MOCK_METHOD2(GetHdcpCapabilities,
|
||||
CdmResponseType(HdcpCapability*, HdcpCapability*));
|
||||
MOCK_METHOD1(GetSupportedCertificateTypes, bool(SupportedCertificateTypes*));
|
||||
MOCK_METHOD1(GetApiVersion, bool(uint32_t*));
|
||||
MOCK_METHOD1(GenerateNonce, bool(uint32_t*));
|
||||
MOCK_METHOD3(PrepareRequest, bool(const std::string&, bool, std::string*));
|
||||
MOCK_METHOD1(GenerateNonce, CdmResponseType(uint32_t*));
|
||||
MOCK_METHOD3(PrepareRequest,
|
||||
CdmResponseType(const std::string&, bool, std::string*));
|
||||
MOCK_METHOD1(LoadEntitledContentKeys,
|
||||
CdmResponseType(const std::vector<CryptoKey>& key_array));
|
||||
MOCK_METHOD1(GetResourceRatingTier, bool(uint32_t*));
|
||||
@@ -318,7 +320,7 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidation) {
|
||||
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(true)));
|
||||
SetArgPointee<1>(max_hdcp_version), Return(NO_ERROR)));
|
||||
EXPECT_CALL(*crypto_session_, GetSupportedCertificateTypes(NotNull()));
|
||||
EXPECT_CALL(*crypto_session_, GetApiVersion(NotNull()))
|
||||
.Times(2)
|
||||
@@ -326,10 +328,10 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidation) {
|
||||
DoAll(SetArgPointee<0>(crypto_session_api_version), Return(true)));
|
||||
EXPECT_CALL(*clock_, GetCurrentTime()).WillOnce(Return(kLicenseStartTime));
|
||||
EXPECT_CALL(*crypto_session_, GenerateNonce(NotNull()))
|
||||
.WillOnce(DoAll(SetArgPointee<0>(kNonce), Return(true)));
|
||||
.WillOnce(DoAll(SetArgPointee<0>(kNonce), Return(NO_ERROR)));
|
||||
EXPECT_CALL(*crypto_session_, PrepareRequest(_, Eq(false), NotNull()))
|
||||
.WillOnce(
|
||||
DoAll(SetArgPointee<2>(kLicenseRequestSignature), Return(true)));
|
||||
DoAll(SetArgPointee<2>(kLicenseRequestSignature), Return(NO_ERROR)));
|
||||
|
||||
CreateCdmLicense();
|
||||
EXPECT_TRUE(cdm_license_->Init(
|
||||
@@ -438,7 +440,7 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidationV15) {
|
||||
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(true)));
|
||||
SetArgPointee<1>(max_hdcp_version), Return(NO_ERROR)));
|
||||
EXPECT_CALL(*crypto_session_, GetSupportedCertificateTypes(NotNull()));
|
||||
EXPECT_CALL(*crypto_session_, GetApiVersion(NotNull()))
|
||||
.Times(2)
|
||||
@@ -449,10 +451,10 @@ TEST_F(CdmLicenseTest, PrepareKeyRequestValidationV15) {
|
||||
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(true)));
|
||||
.WillOnce(DoAll(SetArgPointee<0>(kNonce), Return(NO_ERROR)));
|
||||
EXPECT_CALL(*crypto_session_, PrepareRequest(_, Eq(false), NotNull()))
|
||||
.WillOnce(
|
||||
DoAll(SetArgPointee<2>(kLicenseRequestSignature), Return(true)));
|
||||
DoAll(SetArgPointee<2>(kLicenseRequestSignature), Return(NO_ERROR)));
|
||||
|
||||
CreateCdmLicense();
|
||||
EXPECT_TRUE(cdm_license_->Init(
|
||||
|
||||
Reference in New Issue
Block a user