| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Test MediaKeySession lifetime without release()</title> | 4 <title>Test MediaKeySession lifetime without release()</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> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 var mediaKeySession3; | 24 var mediaKeySession3; |
| 25 var initDataType = getInitDataType(); | 25 var initDataType = getInitDataType(); |
| 26 var initData = getInitData(initDataType); | 26 var initData = getInitData(initDataType); |
| 27 var startingActiveDOMObjectCount = window.internals.activeDOMObj
ectCount(document); | 27 var startingActiveDOMObjectCount = window.internals.activeDOMObj
ectCount(document); |
| 28 | 28 |
| 29 function numActiveDOMObjectsCreated() | 29 function numActiveDOMObjectsCreated() |
| 30 { | 30 { |
| 31 return window.internals.activeDOMObjectCount(document) - sta
rtingActiveDOMObjectCount; | 31 return window.internals.activeDOMObjectCount(document) - sta
rtingActiveDOMObjectCount; |
| 32 } | 32 } |
| 33 | 33 |
| 34 MediaKeys.create('org.w3.clearkey').then(function(result) { | 34 navigator.requestMediaKeySystemAccess('org.w3.clearkey').then(fu
nction(access) { |
| 35 assert_equals(access.keySystem, 'org.w3.clearkey'); |
| 36 return access.createMediaKeys(); |
| 37 }).then(function(result) { |
| 35 mediaKeys = result; | 38 mediaKeys = result; |
| 36 assert_equals(mediaKeys.keySystem, 'org.w3.clearkey'); | |
| 37 | 39 |
| 38 // Verify MediaKeys are not an ActiveDOMObject. | 40 // Verify MediaKeys are not an ActiveDOMObject. |
| 39 assert_equals(numActiveDOMObjectsCreated(), 0, 'MediaKeys.cr
eate()'); | 41 assert_equals(numActiveDOMObjectsCreated(), 0, 'MediaKeys.cr
eate()'); |
| 40 | 42 |
| 41 // Create 3 sessions. | 43 // Create 3 sessions. |
| 42 mediaKeySession1 = mediaKeys.createSession(); | 44 mediaKeySession1 = mediaKeys.createSession(); |
| 43 return mediaKeySession1.generateRequest(initDataType, initDa
ta); | 45 return mediaKeySession1.generateRequest(initDataType, initDa
ta); |
| 44 }).then(function() { | 46 }).then(function() { |
| 45 assert_true(mediaKeySession1.sessionId && mediaKeySession1.s
essionId.length > 0); | 47 assert_true(mediaKeySession1.sessionId && mediaKeySession1.s
essionId.length > 0); |
| 46 // Should be 1 MediaKeySession. | 48 // Should be 1 MediaKeySession. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 }).then(function(result) { | 101 }).then(function(result) { |
| 100 assert_equals(numActiveDOMObjectsCreated(), 0); | 102 assert_equals(numActiveDOMObjectsCreated(), 0); |
| 101 test.done(); | 103 test.done(); |
| 102 }).catch(function(error) { | 104 }).catch(function(error) { |
| 103 forceTestFailureFromPromise(test, error); | 105 forceTestFailureFromPromise(test, error); |
| 104 }); | 106 }); |
| 105 }, 'MediaKeySession lifetime without release()'); | 107 }, 'MediaKeySession lifetime without release()'); |
| 106 </script> | 108 </script> |
| 107 </body> | 109 </body> |
| 108 </html> | 110 </html> |
| OLD | NEW |