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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/workers/worker-supplement-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 <script src="../../resources/js-test.js"></script> 2 <script src="../../resources/js-test.js"></script>
3 <script src="../../resources/gc.js"></script>
3 <script src="resources/worker-create-common.js"></script> 4 <script src="resources/worker-create-common.js"></script>
4 <script> 5 <script>
5 description("Test GCing of WorkerGlobalScope supplementable"); 6 description("Test GCing of WorkerGlobalScope supplementable");
6 window.jsTestIsAsync = true; 7 window.jsTestIsAsync = true;
7 if (window.testRunner) { 8 if (window.testRunner) {
8 testRunner.dumpAsText(); 9 testRunner.dumpAsText();
9 testRunner.waitUntilDone(); 10 testRunner.waitUntilDone();
10 } 11 }
11 function gc()
12 {
13 if (window.GCController)
14 return GCController.collect();
15
16 for (var i = 0; i < 10000; i++) { // > force garbage collection (FF requires about 9K allocations before a collect)
17 var s = new String("abc");
18 }
19 }
20 12
21 // Test that garbage collection of 'supplements' that extend the 13 // Test that garbage collection of 'supplements' that extend the
22 // WorkerGlobalScope object is well behaved. 14 // WorkerGlobalScope object is well behaved.
23 var worker = createWorker(); 15 var worker = createWorker();
24 var count = 0; 16 var count = 0;
25 17
26 function ping() 18 function ping()
27 { 19 {
28 worker.postMessage("eval gc(); self.performance && self.performance.now()"); 20 worker.postMessage("eval gc(); self.performance && self.performance.now()");
29 } 21 }
30 worker.onmessage = function (e) { 22 worker.onmessage = function (e) {
31 if (count++ > 4) 23 if (count++ > 4)
32 finishJSTest(); 24 finishJSTest();
33 else 25 else
34 ping(); 26 ping();
35 gc(); 27 gc();
36 } 28 }
37 ping(); 29 ping();
38 </script> 30 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698