| <!DOCTYPE html> |
| <html> |
| <head> |
| <title>Test asynchronous creation of MediaKeys and MediaKeySession while running garbage collection</title> |
| <script src="encrypted-media-utils.js"></script> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| </head> |
| <body> |
| <script> |
| async_test(function(test) |
| { |
| // Run garbage collection often. |
| setInterval(asyncGC, 0); |
| |
| var initDataType; |
| var initData; |
| var mediaKeySession; |
| navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimpleConfiguration()).then(function(access) { |
| initDataType = access.getConfiguration().initDataTypes[0]; |
| initData = getInitData(initDataType); |
| return access.createMediaKeys(); |
| }).then(function(mediaKeys) { |
| mediaKeySession = mediaKeys.createSession(); |
| return mediaKeySession.generateRequest(initDataType, initData); |
| }).then(function() { |
| return mediaKeySession.close(); |
| }).then(function(result) { |
| test.done(); |
| }).catch(function(error) { |
| forceTestFailureFromPromise(test, error); |
| }); |
| }, 'Test asynchronous creation of MediaKeys and MediaKeySession while running garbage collection.'); |
| </script> |
| </body> |
| </html> |