OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Test MediaKeys lifetime when adding a session</title> | 4 <title>Test MediaKeys lifetime when adding a session</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 initData; | 24 var initData; |
25 var mediaKeys; | 25 var mediaKeys; |
26 var startingActiveDOMObjectCount = window.internals.activeDOMObj
ectCount(document); | 26 var startingActiveDOMObjectCount = window.internals.activeDOMObj
ectCount(document); |
27 | 27 |
28 function numActiveDOMObjectsCreated() | 28 function numActiveDOMObjectsCreated() |
29 { | 29 { |
30 return window.internals.activeDOMObjectCount(document) - sta
rtingActiveDOMObjectCount; | 30 return window.internals.activeDOMObjectCount(document) - sta
rtingActiveDOMObjectCount; |
31 } | 31 } |
32 | 32 |
33 // Create a MediaKeys object with a session. | 33 // Create a MediaKeys object with a session. |
34 getSupportedInitDataType().then(function(type) { | 34 navigator.requestMediaKeySystemAccess('org.w3.clearkey', getSimp
leConfiguration()).then(function(access) { |
35 initDataType = type; | 35 initDataType = access.getConfiguration().initDataTypes[0]; |
36 initData = getInitData(initDataType); | 36 initData = getInitData(initDataType); |
37 return navigator.requestMediaKeySystemAccess('org.w3.clearke
y', [{}]); | |
38 }).then(function(access) { | |
39 assert_equals(access.keySystem, 'org.w3.clearkey'); | |
40 return access.createMediaKeys(); | 37 return access.createMediaKeys(); |
41 }).then(function(result) { | 38 }).then(function(result) { |
42 mediaKeys = result; | 39 mediaKeys = result; |
43 | 40 |
44 // Verify MediaKeys is an ActiveDOMObject. | 41 // Verify MediaKeys is an ActiveDOMObject. |
45 // In non-Oilpan, numActiveDOMObjectsCreate() == 1. | 42 // In non-Oilpan, numActiveDOMObjectsCreate() == 1. |
46 // In Oilpan, numActiveDOMObjectsCreate() <= 4. | 43 // In Oilpan, numActiveDOMObjectsCreate() <= 4. |
47 // (1 MediaKeys, | 44 // (1 MediaKeys, |
48 // 1 MediaKeysInitializer and | 45 // 1 MediaKeysInitializer and |
49 // 1 MediaKeySystemAccessInitializer (navigator.requestMedi
aKeySystemAccess() use above), | 46 // 1 MediaKeySystemAccessInitializer (navigator.requestMedi
aKeySystemAccess() use above), |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 assert_between_inclusive(numActiveDOMObjectsCreated(), 0, 1,
'After final gc()'); | 91 assert_between_inclusive(numActiveDOMObjectsCreated(), 0, 1,
'After final gc()'); |
95 | 92 |
96 test.done(); | 93 test.done(); |
97 }).catch(function(error) { | 94 }).catch(function(error) { |
98 forceTestFailureFromPromise(test, error); | 95 forceTestFailureFromPromise(test, error); |
99 }); | 96 }); |
100 }, 'MediaKeys lifetime with session'); | 97 }, 'MediaKeys lifetime with session'); |
101 </script> | 98 </script> |
102 </body> | 99 </body> |
103 </html> | 100 </html> |
OLD | NEW |