Correct OpenSessions_1_1 test failure

[ Merge of http://go/wvgerrit/98025 ]

This adds mocking for WvContentDecryptionModule::QuerySessionStatus
to WvDrmPluginTest which was missing. This corrects the failure in
WVDrmPluginTest.OpensSessions_1_1 from libwvdrmdrmplugin_hidl_test

Bug: 154011452
Test: wv unit/integration tests
Change-Id: I9904595a62a71541ab534aca7d7dfbf95f3225c9
This commit is contained in:
Rahul Frias
2020-04-14 11:35:42 -07:00
parent d260c2cf2d
commit 3df8bc5133

View File

@@ -165,6 +165,9 @@ class MockCDM : public WvContentDecryptionModule {
const std::string&,
std::string*));
MOCK_METHOD2(QuerySessionStatus, CdmResponseType(const CdmSessionId&,
CdmQueryMap*));
MOCK_METHOD2(QueryKeyStatus, CdmResponseType(const CdmSessionId&,
CdmQueryMap*));
@@ -384,6 +387,14 @@ TEST_F(WVDrmPluginTest, OpensSessions_1_1) {
.WillOnce(DoAll(SetArgPointee<2>(QUERY_VALUE_SECURITY_LEVEL_L3),
testing::Return(wvcdm::NO_ERROR)));
CdmQueryMap securityLevelQueryMap;
securityLevelQueryMap[wvcdm::QUERY_KEY_SECURITY_LEVEL] =
wvcdm::QUERY_VALUE_SECURITY_LEVEL_L3;
EXPECT_CALL(*cdm, QuerySessionStatus(_, NotNull()))
.WillOnce(DoAll(SetArgPointee<1>(securityLevelQueryMap),
testing::Return(wvcdm::NO_ERROR)));
EXPECT_CALL(*cdm, OpenSession(_, _, _, _, _))
.WillRepeatedly(DoAll(SetArgPointee<4>(cdmSessionId),
SaveArg<1>(&propertySet),
@@ -402,7 +413,7 @@ TEST_F(WVDrmPluginTest, OpensSessions_1_1) {
plugin.openSession_1_1(android::hardware::drm::V1_1::SecurityLevel::SW_SECURE_CRYPTO,
[&](Status status, hidl_vec<uint8_t> hSessionId) {
ASSERT_EQ(Status::ERROR_DRM_INVALID_STATE, status);
ASSERT_EQ(Status::OK, status);
sessionId.clear();
sessionId.assign(hSessionId.data(), hSessionId.data() + hSessionId.size());
});