OLD | NEW |
1 <svg id="svg" xmlns="http://www.w3.org/2000/svg" onload="load()"> | 1 <svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/
1999/xlink" onload="load()"> |
2 <g id="g"/> | 2 <g id="g"/> |
3 <text x="50" y="50" id="log"/> | 3 <text x="50" y="50" id="log"/> |
| 4 <script xlink:href="../../resources/js-test.js"></script> |
4 <script id="script"> | 5 <script id="script"> |
5 <![CDATA[ | 6 <![CDATA[ |
6 | 7 |
7 var g = document.getElementById("g"); | 8 var g = document.getElementById("g"); |
8 | 9 |
9 function log(message) { | 10 function log(message) { |
10 var logDiv = document.getElementById('log'); | 11 var logDiv = document.getElementById('log'); |
11 logDiv.appendChild(document.createTextNode(message)); | 12 logDiv.appendChild(document.createTextNode(message)); |
12 } | 13 } |
13 | 14 |
(...skipping 11 matching lines...) Expand all Loading... |
25 anim.setAttribute("dur", "10.0s"); | 26 anim.setAttribute("dur", "10.0s"); |
26 anim.setAttribute("repeatCount", 1); | 27 anim.setAttribute("repeatCount", 1); |
27 | 28 |
28 rect.appendChild(anim); | 29 rect.appendChild(anim); |
29 | 30 |
30 return rect; | 31 return rect; |
31 } | 32 } |
32 | 33 |
33 function cleanup() { | 34 function cleanup() { |
34 // Collect garbage before recording starting live node count, in case there
are live elements from previous tests. | 35 // Collect garbage before recording starting live node count, in case there
are live elements from previous tests. |
35 GCController.collectAll(); | 36 collectGarbage(function() { |
36 var originalLiveElements = internals.numberOfLiveNodes(); | 37 var originalLiveElements = internals.numberOfLiveNodes(); |
37 | 38 |
38 while (g.hasChildNodes()) | 39 while (g.hasChildNodes()) |
39 g.removeChild(g.lastChild); | 40 g.removeChild(g.lastChild); |
40 | 41 collectGarbage(function() { |
41 GCController.collectAll(); | 42 var liveDelta = originalLiveElements - internals.numberOfLiveNodes()
- 200; |
42 | 43 if (liveDelta == 0) |
43 var liveDelta = originalLiveElements - internals.numberOfLiveNodes() - 200; | 44 log("PASS"); |
44 if (liveDelta == 0) | 45 else |
45 log("PASS"); | 46 log("FAIL: " + liveDelta + " extra live node(s)"); |
46 else | 47 testRunner.notifyDone(); |
47 log("FAIL: " + liveDelta + " extra live node(s)"); | 48 }); |
48 | 49 }); |
49 testRunner.notifyDone(); | |
50 } | 50 } |
51 | 51 |
52 function startTest() { | 52 function startTest() { |
53 for (var i = 0; i < 100; i++) | 53 for (var i = 0; i < 100; i++) |
54 g.appendChild(createAnimatedRect()); | 54 g.appendChild(createAnimatedRect()); |
55 | 55 |
56 setTimeout(cleanup, 0); | 56 setTimeout(cleanup, 0); |
57 } | 57 } |
58 | 58 |
59 function load() { | 59 function load() { |
60 if (window.testRunner && window.GCController && window.internals) { | 60 if (window.testRunner && window.GCController && window.internals) { |
61 testRunner.dumpAsText(); | 61 testRunner.dumpAsText(); |
62 testRunner.waitUntilDone(); | 62 testRunner.waitUntilDone(); |
63 } else { | 63 } else { |
64 log("This test only works when run with the testRunner, GCController, an
d internals available."); | 64 log("This test only works when run with the testRunner, GCController, an
d internals available."); |
65 return; | 65 return; |
66 } | 66 } |
67 | 67 |
68 setTimeout(startTest, 0); | 68 setTimeout(startTest, 0); |
69 } | 69 } |
70 ]]> | 70 ]]> |
71 </script> | 71 </script> |
72 </svg> | 72 </svg> |
OLD | NEW |