[EME] Implement MediaKeySession::remove()
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Feb 2017 10:39:49 +0000 (10:39 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Feb 2017 10:39:49 +0000 (10:39 +0000)
commit34b912cb332767bce92af933d096ab2aa8fe5433
treef1bc290704b0878deb454fcf118bbb3a05c3a9e9
parentbdb98ee45f1ea2e74c5bbd6e72642f2179eda065
[EME] Implement MediaKeySession::remove()
https://bugs.webkit.org/show_bug.cgi?id=167870

Reviewed by Xabier Rodriguez-Calvar.

Source/WebCore:

Implement MediaKeySession::remove() as outlined in the specification.

The CDMInstance::removeSessionData() virtual method is added. CDMInstance
implementors should remove any session data stored for the session that's
represented by the passed-in session ID and session type.

Once the session data is removed, the passed-in callback should be invoked
by the CDMInstance object so that MediaKeySession can immediately queue a
task in which it updates key statuses and expiration, reject the promise if
the data removal failed, or enqueue any license-release message and finally
successfully resolve the promise.

MockCDMFactory gains the removeKeysFromSessionWithID() method that purges
the keys for a given session ID. The method is called from
MockCDMInstance::removeSessionData() implementation, which passes the
removed keys to the RemoveSessionDataCallback, along with a license-release
message that is checked in the tests. The key removal itself isn't tested
yet because the MediaKeySession's `update key statuses` algorithm isn't
implemented yet.

Test: media/encrypted-media/mock-MediaKeySession-remove.html

* Modules/encryptedmedia/CDMInstance.h:
* Modules/encryptedmedia/MediaKeySession.cpp:
(WebCore::MediaKeySession::remove):
* testing/MockCDMFactory.cpp:
(WebCore::MockCDMFactory::removeKeysFromSessionWithID):
(WebCore::MockCDMInstance::removeSessionData):
* testing/MockCDMFactory.h:

LayoutTests:

Add the mock-MediaKeySession-remove.html test that tests the functionality
of the MediaKeySession::remove() implementation. The test checks that the
calls to that method properly resolve or reject the returned promise,
depending on the object state. Another test checks the message that's
queued upon a successful removal.

Additional tests will be added later once MediaKeySession properly
implements the close() method and key status updates.

* media/encrypted-media/mock-MediaKeySession-remove-expected.txt: Added.
* media/encrypted-media/mock-MediaKeySession-remove.html: Added.
* platform/efl/TestExpectations:
* platform/mac/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211857 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/media/encrypted-media/mock-MediaKeySession-remove-expected.txt [new file with mode: 0644]
LayoutTests/media/encrypted-media/mock-MediaKeySession-remove.html [new file with mode: 0644]
LayoutTests/platform/efl/TestExpectations
LayoutTests/platform/mac/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/Modules/encryptedmedia/CDMInstance.h
Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp
Source/WebCore/testing/MockCDMFactory.cpp
Source/WebCore/testing/MockCDMFactory.h