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> | |
11 <script> | 10 <script> |
12 async_test(function(test) | 11 async_test(function(test) |
13 { | 12 { |
14 // Run garbage collection often. | 13 // Run garbage collection often. |
15 setInterval(asyncGC, 0); | 14 setInterval(asyncGC, 0); |
16 | 15 |
17 var initDataType; | 16 var initDataType; |
18 var initData; | 17 var initData; |
19 var mediaKeySession; | 18 var mediaKeySession; |
20 navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimp
leConfiguration()).then(function(access) { | 19 navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimp
leConfiguration()).then(function(access) { |
21 initDataType = access.getConfiguration().initDataTypes[0]; | 20 initDataType = access.getConfiguration().initDataTypes[0]; |
22 initData = getInitData(initDataType); | 21 initData = getInitData(initDataType); |
23 return access.createMediaKeys(); | 22 return access.createMediaKeys(); |
24 }).then(function(mediaKeys) { | 23 }).then(function(mediaKeys) { |
25 mediaKeySession = mediaKeys.createSession(); | 24 mediaKeySession = mediaKeys.createSession(); |
26 return mediaKeySession.generateRequest(initDataType, initDat
a); | 25 return mediaKeySession.generateRequest(initDataType, initDat
a); |
27 }).then(function() { | 26 }).then(function() { |
28 return mediaKeySession.close(); | 27 return mediaKeySession.close(); |
29 }).then(function(result) { | 28 }).then(function(result) { |
30 test.done(); | 29 test.done(); |
31 }).catch(function(error) { | 30 }).catch(function(error) { |
32 forceTestFailureFromPromise(test, error); | 31 forceTestFailureFromPromise(test, error); |
33 }); | 32 }); |
34 }, 'Test asynchronous creation of MediaKeys and MediaKeySession whil
e running garbage collection.'); | 33 }, 'Test asynchronous creation of MediaKeys and MediaKeySession whil
e running garbage collection.'); |
35 </script> | 34 </script> |
36 </body> | 35 </body> |
37 </html> | 36 </html> |
OLD | NEW |