Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: LayoutTests/media/encrypted-media/encrypted-media-lifetime-mediakeysession-reference.html

Issue 465833003: Fix failing EME layout test. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 17 matching lines...) Expand all
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 MediaKeys.create('org.w3.clearkey').then(function(result) {
35 mediaKeys = result; 35 mediaKeys = result;
36 assert_equals(mediaKeys.keySystem, 'org.w3.clearkey'); 36 assert_equals(mediaKeys.keySystem, 'org.w3.clearkey');
37 37
38 // Verify MediaKeys are not an ActiveDOMObject. However, the 38 // Verify MediaKeys are not an ActiveDOMObject.
39 // PromiseResolver objects used by MediaKeys/MediaKeySession 39 assert_equals(numActiveDOMObjectsCreated(), 0, 'MediaKeys.cr eate()');
40 // are ActiveDOMObjects, and they stay active until the end
41 // of the associated then/catch function.
42 assert_equals(numActiveDOMObjectsCreated(), 1, 'MediaKeys.cr eate()');
43 40
44 // Create 3 sessions. 41 // Create 3 sessions.
45 return mediaKeys.createSession(initDataType, initData); 42 return mediaKeys.createSession(initDataType, initData);
46 }).then(function(result) { 43 }).then(function(result) {
47 mediaKeySession1 = result; 44 mediaKeySession1 = result;
48 assert_true(mediaKeySession1.sessionId && mediaKeySession1.s essionId.length > 0); 45 assert_true(mediaKeySession1.sessionId && mediaKeySession1.s essionId.length > 0);
49 // Should be 1 MediaKeySession + 1 PromiseResolver from 46 // Should be 1 MediaKeySession.
50 // createSession(). 47 assert_equals(numActiveDOMObjectsCreated(), 1, 'mediaKeys.cr eateSession(1)');
51 assert_equals(numActiveDOMObjectsCreated(), 2, 'mediaKeys.cr eateSession(1)');
52 return mediaKeys.createSession(initDataType, initData); 48 return mediaKeys.createSession(initDataType, initData);
53 }).then(function(result) { 49 }).then(function(result) {
54 mediaKeySession2 = result; 50 mediaKeySession2 = result;
55 assert_true(mediaKeySession2.sessionId && mediaKeySession2.s essionId.length > 0); 51 assert_true(mediaKeySession2.sessionId && mediaKeySession2.s essionId.length > 0);
56 // Should be 2 MediaKeySessions + 1 PromiseResolver from the 52 // Should be 2 MediaKeySessions.
57 // last createSession(). 53 assert_equals(numActiveDOMObjectsCreated(), 2, 'mediaKeys.cr eateSession(2)');
58 assert_equals(numActiveDOMObjectsCreated(), 3, 'mediaKeys.cr eateSession(2)');
59 return mediaKeys.createSession(initDataType, initData); 54 return mediaKeys.createSession(initDataType, initData);
60 }).then(function(result) { 55 }).then(function(result) {
61 mediaKeySession3 = result; 56 mediaKeySession3 = result;
62 assert_true(mediaKeySession3.sessionId && mediaKeySession3.s essionId.length > 0); 57 assert_true(mediaKeySession3.sessionId && mediaKeySession3.s essionId.length > 0);
63 // Should be 3 MediaKeySessions + 1 PromiseResolver from the 58 // Should be 3 MediaKeySessions.
64 // last createSession(). 59 assert_equals(numActiveDOMObjectsCreated(), 3, 'mediaKeys.cr eateSession(3)');
65 assert_equals(numActiveDOMObjectsCreated(), 4, 'mediaKeys.cr eateSession(3)');
66 60
67 // Run gc(). All sessions should remain as we have a 61 // Run gc(). All sessions should remain as we have a
68 // reference to each one. However, running gc() 62 // reference to each one. However, running gc()
69 // asynchronously should free up the last PromiseResolver. 63 // asynchronously should free up the last PromiseResolver.
70 return createGCPromise(); 64 return createGCPromise();
71 }).then(function(result) { 65 }).then(function(result) {
72 assert_equals(numActiveDOMObjectsCreated(), 3, 'After gc()') ; 66 assert_equals(numActiveDOMObjectsCreated(), 3, 'After gc()') ;
73 67
74 // Now drop references to 2 of the sessions. Even though we 68 // Now drop references to 2 of the sessions. Even though we
75 // don't have a reference, MediaKeys is still around (and 69 // don't have a reference, MediaKeys is still around (and
(...skipping 29 matching lines...) Expand all
105 }).then(function(result) { 99 }).then(function(result) {
106 assert_equals(numActiveDOMObjectsCreated(), 0); 100 assert_equals(numActiveDOMObjectsCreated(), 0);
107 test.done(); 101 test.done();
108 }).catch(function(error) { 102 }).catch(function(error) {
109 forceTestFailureFromPromise(test, error); 103 forceTestFailureFromPromise(test, error);
110 }); 104 });
111 }, 'MediaKeySession lifetime without release()'); 105 }, 'MediaKeySession lifetime without release()');
112 </script> 106 </script>
113 </body> 107 </body>
114 </html> 108 </html>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698