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

Side by Side Diff: third_party/WebKit/LayoutTests/media/remoteplayback/availability-callback-gc.html

Issue 2847943002: Cleanup LayoutTests that define a function gc(). (Closed)
Patch Set: Fixing Layout Tests Failures Created 3 years, 7 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
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <title>Test that the callback is not garbage collected if registered.</t itle> 4 <title>Test that the callback is not garbage collected if registered.</t itle>
5 <script src="../../resources/testharness.js"></script> 5 <script src="../../resources/testharness.js"></script>
6 <script src="../../resources/testharnessreport.js"></script> 6 <script src="../../resources/testharnessreport.js"></script>
7 <script src="../../resources/gc.js"></script>
7 <script src="../media-file.js"></script> 8 <script src="../media-file.js"></script>
8 </head> 9 </head>
9 <body> 10 <body>
10 <script> 11 <script>
11 // WPT: this test can't be moved to WPT because of its usage of:
12 // - GCController.collect()
13
14 function gc() {
15 if (window.GCController)
16 GCController.collect();
17 else {
18 for (var i = 0; i < 10000; ++i) {
19 ({ });
20 }
21 }
22 }
23
24 async_test(function(t) 12 async_test(function(t)
25 { 13 {
26 var v = document.createElement('video'); 14 var v = document.createElement('video');
27 v.src = findMediaFile('video', 'content/test'); 15 v.src = findMediaFile('video', 'content/test');
28 document.body.appendChild(v); 16 document.body.appendChild(v);
29 17
30 function callback(available) {} 18 function callback(available) {}
31 var callbackRef = t.step_func_done(callback); 19 var callbackRef = t.step_func_done(callback);
32 20
33 v.remote.watchAvailability(callbackRef).then( 21 v.remote.watchAvailability(callbackRef).then(
34 function() { callbackRef = null; gc(); }, 22 function() { callbackRef = null; gc(); },
35 t.unreached_func()); 23 t.unreached_func());
36 }, 'Test that the callback is not garbage collected if registered.') ; 24 }, 'Test that the callback is not garbage collected if registered.') ;
37 </script> 25 </script>
38 </body> 26 </body>
39 </html> 27 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698