blob: 22c2f0bd2603d69247047578cd1d5c8eb1eda5e9 [file] [log] [blame]
RUN(internals.initializeMockMediaSource())
RUN(mock = internals.registerMockCDM())
RUN(mock.supportedDataTypes = ["keyids"])
RUN(capabilities.initDataTypes = ["keyids"])
RUN(capabilities.videoCapabilities = [{ contentType: 'video/mock; codecs="mock"' }] )
RUN(promise = navigator.requestMediaKeySystemAccess("org.webkit.mock", [capabilities]))
Promise resolved OK
RUN(promise = mediaKeySystemAccess.createMediaKeys())
Promise resolved OK
Removing from a non-callable MediaKeySession should reject.
RUN(mediaKeySession = mediaKeys.createSession("temporary"))
EXPECTED (typeof mediaKeySession == 'object') OK
RUN(promise = mediaKeySession.remove())
Promise rejected correctly OK
Removing from a failed MediaKeySession should reject.
RUN(kids = JSON.stringify({ invalid: "invalid" }))
RUN(mediaKeySession = mediaKeys.createSession("temporary"))
RUN(promise = mediaKeySession.generateRequest("keyids", encoder.encode(kids)))
Promise rejected correctly OK
RUN(promise = mediaKeySession.remove())
Promise rejected correctly OK
Removing from a valid MediaKeySession should resolve.
RUN(kids = JSON.stringify({ kids: [ "MTIzNDU=" ] }))
RUN(mediaKeySession = mediaKeys.createSession("temporary"))
RUN(promise = mediaKeySession.generateRequest("keyids", encoder.encode(kids)))
Promise resolved OK
RUN(promise = mediaKeySession.remove())
Promise resolved OK
Removing from a valid MediaKeySession should dispatch a license-release message.
RUN(kids = JSON.stringify({ kids: [ "MTIzNDU=" ] }))
RUN(mediaKeySession = mediaKeys.createSession("temporary"))
RUN(promise = mediaKeySession.generateRequest("keyids", encoder.encode(kids)))
Promise resolved OK
RUN(promise = mediaKeySession.remove())
EXPECTED (event.messageType == 'license-release') OK
EXPECTED (new Uint8Array(event.message).length == '14') OK
EXPECTED (new Uint8Array(event.message)[0] == '114') OK
EXPECTED (new Uint8Array(event.message)[1] == '101') OK
EXPECTED (new Uint8Array(event.message)[2] == '109') OK
EXPECTED (new Uint8Array(event.message)[3] == '111') OK
EXPECTED (new Uint8Array(event.message)[4] == '118') OK
EXPECTED (new Uint8Array(event.message)[5] == '101') OK
EXPECTED (new Uint8Array(event.message)[6] == '45') OK
EXPECTED (new Uint8Array(event.message)[7] == '109') OK
EXPECTED (new Uint8Array(event.message)[8] == '101') OK
EXPECTED (new Uint8Array(event.message)[9] == '115') OK
EXPECTED (new Uint8Array(event.message)[10] == '115') OK
EXPECTED (new Uint8Array(event.message)[11] == '97') OK
EXPECTED (new Uint8Array(event.message)[12] == '103') OK
EXPECTED (new Uint8Array(event.message)[13] == '101') OK
Promise resolved OK
END OF TEST