Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / media / encrypted-media / encrypted-media-session-closed-event.html
1 <!DOCTYPE html>
2 <html>
3     <head>
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>
8     </head>
9     <body>
10         <div id="log"></div>
11         <script>
12             async_test(function(test)
13             {
14                 var mediaKeySession;
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));
21                 }).then(function() {
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
27                         // promise.
28                         return mediaKeySession.closed;
29                     }).then(function(result) {
30                         assert_equals(result, undefined);
31                         test.done();
32                     });
33
34                     // release() should result in the closed promise being
35                     // fulfilled.
36                     return mediaKeySession.close();
37                 }).catch(function(error) {
38                     forceTestFailureFromPromise(test, error);
39                 });
40             }, 'Test MediaKeySession closed event.');
41         </script>
42     </body>
43 </html>