4 <title>Test MediaKeySession closed event</title>
5 <script src="encrypted-media-utils.js"></script>
6 <script src="../../resources/testharness.js"></script>
7 <script src="../../resources/testharnessreport.js"></script>
12 async_test(function(test)
15 navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(function(access) {
16 return access.createMediaKeys();
17 }).then(function(mediaKeys) {
18 var initDataType = getInitDataType();
19 mediaKeySession = mediaKeys.createSession();
20 return mediaKeySession.generateRequest(initDataType, getInitData(initDataType));
22 // Wait for the session to be closed.
23 mediaKeySession.closed.then(function(result) {
24 assert_equals(result, undefined);
25 // Now that the session is closed, verify that the
26 // closed attribute immediately returns a fulfilled
28 return mediaKeySession.closed;
29 }).then(function(result) {
30 assert_equals(result, undefined);
34 // release() should result in the closed promise being
36 return mediaKeySession.close();
37 }).catch(function(error) {
38 forceTestFailureFromPromise(test, error);
40 }, 'Test MediaKeySession closed event.');