OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Test MediaKeySession lifetime after release() without references<
/title> | 4 <title>Test MediaKeySession lifetime after release() without references<
/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 23 matching lines...) Expand all Loading... |
34 initDataType = type; | 34 initDataType = type; |
35 initData = getInitData(initDataType); | 35 initData = getInitData(initDataType); |
36 return navigator.requestMediaKeySystemAccess('org.w3.clearke
y', [{}]); | 36 return navigator.requestMediaKeySystemAccess('org.w3.clearke
y', [{}]); |
37 }).then(function(access) { | 37 }).then(function(access) { |
38 return access.createMediaKeys(); | 38 return access.createMediaKeys(); |
39 }).then(function(result) { | 39 }).then(function(result) { |
40 mediaKeys = result; | 40 mediaKeys = result; |
41 | 41 |
42 // Verify MediaKeys are not an ActiveDOMObject. | 42 // Verify MediaKeys are not an ActiveDOMObject. |
43 // In non-Oilpan, numActiveDOMObjectsCreate() == 0. | 43 // In non-Oilpan, numActiveDOMObjectsCreate() == 0. |
44 // In Oilpan, numActiveDOMObjectsCreate() <= 2. | 44 // In Oilpan, numActiveDOMObjectsCreate() <= 3. |
45 // (1 MediaKeysInitializer and | 45 // (1 MediaKeysInitializer and |
46 // 1 MediaKeySystemAccessInitializer). | 46 // 1 MediaKeySystemAccessInitializer (navigator.requestMedi
aKeySystemAccess() use above), |
47 assert_less_than_equal(numActiveDOMObjectsCreated(), 2, 'Med
iaKeys.create()'); | 47 // 1 MediaKeySystemAccessInitializer (isInitDataSupported()
(via getSupportedInitDataType()))) |
| 48 assert_less_than_equal(numActiveDOMObjectsCreated(), 3, 'Med
iaKeys.create()'); |
48 | 49 |
49 mediaKeySession1 = mediaKeys.createSession(); | 50 mediaKeySession1 = mediaKeys.createSession(); |
50 return mediaKeySession1.generateRequest(initDataType, initDa
ta); | 51 return mediaKeySession1.generateRequest(initDataType, initDa
ta); |
51 }).then(function() { | 52 }).then(function() { |
52 assert_true(mediaKeySession1.sessionId && mediaKeySession1.s
essionId.length > 0); | 53 assert_true(mediaKeySession1.sessionId && mediaKeySession1.s
essionId.length > 0); |
53 // Should be 1 MediaKeySession. | 54 // Should be 1 MediaKeySession. |
54 // In non-Oilpan, numActiveDOMObjectsCreate() == 1. | 55 // In non-Oilpan, numActiveDOMObjectsCreate() == 1. |
55 // In Oilpan, numActiveDOMObjectsCreate() <= 4. | 56 // In Oilpan, numActiveDOMObjectsCreate() <= 5. |
56 // (1 MediaKeysInitializer, | 57 // (1 MediaKeysInitializer, |
57 // 1 MediaKeySystemAccessInitializer, | 58 // 2 MediaKeySystemAccessInitializer, |
58 // 1 ContentDecryptionModuleResultPromise and | 59 // 1 ContentDecryptionModuleResultPromise and |
59 // 1 MediaKeySession). | 60 // 1 MediaKeySession). |
60 assert_less_than_equal(numActiveDOMObjectsCreated(), 4, 'Med
iaKeys.createSession(1)'); | 61 assert_less_than_equal(numActiveDOMObjectsCreated(), 5, 'Med
iaKeys.createSession(1)'); |
61 mediaKeySession2 = mediaKeys.createSession(); | 62 mediaKeySession2 = mediaKeys.createSession(); |
62 return mediaKeySession2.generateRequest(initDataType, initDa
ta); | 63 return mediaKeySession2.generateRequest(initDataType, initDa
ta); |
63 }).then(function() { | 64 }).then(function() { |
64 assert_true(mediaKeySession2.sessionId && mediaKeySession2.s
essionId.length > 0); | 65 assert_true(mediaKeySession2.sessionId && mediaKeySession2.s
essionId.length > 0); |
65 // Should be 2 MediaKeySessions. | 66 // Should be 2 MediaKeySessions. |
66 // In non-Oilpan, numActiveDOMObjectsCreate() == 2. | 67 // In non-Oilpan, numActiveDOMObjectsCreate() == 2. |
67 // In Oilpan, numActiveDOMObjectsCreate() <= 6. | 68 // In Oilpan, numActiveDOMObjectsCreate() <= 7. |
68 // (1 MediaKeysInitializer, | 69 // (1 MediaKeysInitializer, |
69 // 1 MediaKeySystemAccessInitializer, | 70 // 2 MediaKeySystemAccessInitializers, |
70 // 2 ContentDecryptionModuleResultPromise and | 71 // 2 ContentDecryptionModuleResultPromise and |
71 // 2 MediaKeySession). | 72 // 2 MediaKeySession). |
72 assert_less_than_equal(numActiveDOMObjectsCreated(), 6, 'med
iaKeys.createSession(2)'); | 73 assert_less_than_equal(numActiveDOMObjectsCreated(), 7, 'med
iaKeys.createSession(2)'); |
73 }).then(function(result) { | 74 }).then(function(result) { |
74 // Run gc(). All sessions should remain as we have a | 75 // Run gc(). All sessions should remain as we have a |
75 // reference to each one. | 76 // reference to each one. |
76 return createGCPromise(); | 77 return createGCPromise(); |
77 }).then(function(result) { | 78 }).then(function(result) { |
78 // Should be just the 2 MediaKeySessions. | 79 // Should be just the 2 MediaKeySessions. |
79 assert_less_than_equal(numActiveDOMObjectsCreated(), 3, 'Aft
er gc()'); | 80 assert_less_than_equal(numActiveDOMObjectsCreated(), 3, 'Aft
er gc()'); |
80 | 81 |
81 // Close the sessions. Once the close() event is received, | 82 // Close the sessions. Once the close() event is received, |
82 // they should get garbage collected as there are no JS | 83 // they should get garbage collected as there are no JS |
(...skipping 23 matching lines...) Expand all Loading... |
106 assert_less_than_equal(numActiveDOMObjectsCreated(), 1); | 107 assert_less_than_equal(numActiveDOMObjectsCreated(), 1); |
107 assert_not_equals(mediaKeys, null); | 108 assert_not_equals(mediaKeys, null); |
108 test.done(); | 109 test.done(); |
109 }).catch(function(error) { | 110 }).catch(function(error) { |
110 forceTestFailureFromPromise(test, error); | 111 forceTestFailureFromPromise(test, error); |
111 }); | 112 }); |
112 }, 'MediaKeySession lifetime after release() without references'); | 113 }, 'MediaKeySession lifetime after release() without references'); |
113 </script> | 114 </script> |
114 </body> | 115 </body> |
115 </html> | 116 </html> |
OLD | NEW |