| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <title>Test multiple calls to MediaKeySession.close()</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 <script> |
| 11 // This test verifies that Chrome handles multiple close() calls |
| 12 // correctly. Currently the EME spec has the check for session |
| 13 // already closed happen immediately when the method is called, |
| 14 // but the action is performed asynchronously. |
| 15 // https://github.com/w3c/encrypted-media/issues/365 |
| 16 |
| 17 async_test(function(test) |
| 18 { |
| 19 var initDataType; |
| 20 var initData; |
| 21 var mediaKeySession; |
| 22 |
| 23 navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimp
leConfiguration()).then(function(access) { |
| 24 initDataType = access.getConfiguration().initDataTypes[0]; |
| 25 initData = getInitData(initDataType); |
| 26 return access.createMediaKeys(); |
| 27 }).then(function(mediaKeys) { |
| 28 mediaKeySession = mediaKeys.createSession(); |
| 29 return mediaKeySession.generateRequest(initDataType, initDat
a); |
| 30 }).then(function() { |
| 31 // Call close() multiple times. |
| 32 return Promise.all([mediaKeySession.close(), mediaKeySession
.close(), mediaKeySession.close()]); |
| 33 }).then(function() { |
| 34 test.done(); |
| 35 }).catch(function(error) { |
| 36 forceTestFailureFromPromise(test, error); |
| 37 }); |
| 38 }, 'Test multiple calls to MediaKeySession.close().'); |
| 39 </script> |
| 40 </body> |
| 41 </html> |
| OLD | NEW |