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
)
17 getSupportedInitDataType().then(function(type
) {
19 initData
= getInitData(initDataType
);
20 return navigator
.requestMediaKeySystemAccess('org.w3.clearkey', [{}]);
21 }).then(function(access
) {
22 return access
.createMediaKeys();
23 }).then(function(mediaKeys
) {
24 mediaKeySession
= mediaKeys
.createSession();
25 return mediaKeySession
.generateRequest(initDataType
, initData
);
27 // Wait for the session to be closed.
28 mediaKeySession
.closed
.then(function(result
) {
29 assert_equals(result
, undefined);
30 // Now that the session is closed, verify that the
31 // closed attribute immediately returns a fulfilled
33 return mediaKeySession
.closed
;
34 }).then(function(result
) {
35 assert_equals(result
, undefined);
39 // release() should result in the closed promise being
41 return mediaKeySession
.close();
42 }).catch(function(error
) {
43 forceTestFailureFromPromise(test
, error
);
45 }, 'Test MediaKeySession closed event.');