am 5f227dd8: Avoid throwing exceptions when sessions are closed
* commit '5f227dd85d5407620cd68c17caae6e1949cd06c9': Avoid throwing exceptions when sessions are closed
This commit is contained in:
@@ -139,9 +139,9 @@ status_t WVDrmPlugin::openSession(Vector<uint8_t>& sessionId) {
|
|||||||
|
|
||||||
status_t WVDrmPlugin::closeSession(const Vector<uint8_t>& sessionId) {
|
status_t WVDrmPlugin::closeSession(const Vector<uint8_t>& sessionId) {
|
||||||
CdmSessionId cdmSessionId(sessionId.begin(), sessionId.end());
|
CdmSessionId cdmSessionId(sessionId.begin(), sessionId.end());
|
||||||
CdmResponseType res = mCDM->CloseSession(cdmSessionId);
|
mCDM->CloseSession(cdmSessionId);
|
||||||
mCryptoSessions.erase(cdmSessionId);
|
mCryptoSessions.erase(cdmSessionId);
|
||||||
return mapAndNotifyOfCdmResponseType(sessionId, res);
|
return android::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t WVDrmPlugin::getKeyRequest(
|
status_t WVDrmPlugin::getKeyRequest(
|
||||||
|
|||||||
@@ -220,6 +220,19 @@ TEST_F(WVDrmPluginTest, ClosesSessions) {
|
|||||||
ASSERT_EQ(OK, res);
|
ASSERT_EQ(OK, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(WVDrmPluginTest, ClosesSessionWithoutReturningError) {
|
||||||
|
StrictMock<MockCDM> cdm;
|
||||||
|
StrictMock<MockCrypto> crypto;
|
||||||
|
WVDrmPlugin plugin(&cdm, &crypto);
|
||||||
|
|
||||||
|
EXPECT_CALL(cdm, CloseSession(cdmSessionId))
|
||||||
|
.WillOnce(Return(SESSION_NOT_FOUND_1));
|
||||||
|
|
||||||
|
status_t res = plugin.closeSession(sessionId);
|
||||||
|
|
||||||
|
ASSERT_EQ(OK, res);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_F(WVDrmPluginTest, GeneratesKeyRequests) {
|
TEST_F(WVDrmPluginTest, GeneratesKeyRequests) {
|
||||||
StrictMock<MockCDM> cdm;
|
StrictMock<MockCDM> cdm;
|
||||||
StrictMock<MockCrypto> crypto;
|
StrictMock<MockCrypto> crypto;
|
||||||
|
|||||||
Reference in New Issue
Block a user