OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Test asynchronous creation of MediaKeys and MediaKeySession while
running garbage collection</title> | 4 <title>Test asynchronous creation of MediaKeys and MediaKeySession while
running garbage collection</title> |
5 <script src="encrypted-media-utils.js"></script> | 5 <script src="encrypted-media-utils.js"></script> |
6 <script src="../../resources/testharness.js"></script> | 6 <script src="../../resources/testharness.js"></script> |
7 <script src="../../resources/testharnessreport.js"></script> | 7 <script src="../../resources/testharnessreport.js"></script> |
8 </head> | 8 </head> |
9 <body> | 9 <body> |
10 <div id="log"></div> | 10 <div id="log"></div> |
11 <script> | 11 <script> |
12 async_test(function(test) | 12 async_test(function(test) |
13 { | 13 { |
14 // Run garbage collection often. | 14 // Run garbage collection often. |
15 setInterval(asyncGC, 0); | 15 setInterval(asyncGC, 0); |
16 | 16 |
17 var initDataType; | 17 var initDataType; |
18 var initData; | 18 var initData; |
19 var mediaKeySession; | 19 var mediaKeySession; |
20 getSupportedInitDataType().then(function(type) { | 20 navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimp
leConfiguration()).then(function(access) { |
21 initDataType = type; | 21 initDataType = access.getConfiguration().initDataTypes[0]; |
22 initData = getInitData(initDataType); | 22 initData = getInitData(initDataType); |
23 return navigator.requestMediaKeySystemAccess('org.w3.clearke
y', [{}]); | |
24 }).then(function(access) { | |
25 return access.createMediaKeys(); | 23 return access.createMediaKeys(); |
26 }).then(function(mediaKeys) { | 24 }).then(function(mediaKeys) { |
27 mediaKeySession = mediaKeys.createSession(); | 25 mediaKeySession = mediaKeys.createSession(); |
28 return mediaKeySession.generateRequest(initDataType, initDat
a); | 26 return mediaKeySession.generateRequest(initDataType, initDat
a); |
29 }).then(function() { | 27 }).then(function() { |
30 return mediaKeySession.close(); | 28 return mediaKeySession.close(); |
31 }).then(function(result) { | 29 }).then(function(result) { |
32 test.done(); | 30 test.done(); |
33 }).catch(function(error) { | 31 }).catch(function(error) { |
34 forceTestFailureFromPromise(test, error); | 32 forceTestFailureFromPromise(test, error); |
35 }); | 33 }); |
36 }, 'Test asynchronous creation of MediaKeys and MediaKeySession whil
e running garbage collection.'); | 34 }, 'Test asynchronous creation of MediaKeys and MediaKeySession whil
e running garbage collection.'); |
37 </script> | 35 </script> |
38 </body> | 36 </body> |
39 </html> | 37 </html> |
OLD | NEW |