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

Side by Side Diff: LayoutTests/svg/animations/smil-leak-dynamically-added-element-instances.svg

Issue 220203005: Oilpan: introduce sticky forcedForTesting flag to ensure that a precise (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments. Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
1 <svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/ 1999/xlink" onload="load()"> 1 <svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/ 1999/xlink" onload="load()">
2 <defs> 2 <defs>
3 <rect id="rect" width="100" height="100" /> 3 <rect id="rect" width="100" height="100" />
4 </defs> 4 </defs>
5 <g id="g"/> 5 <g id="g"/>
6 <text x="50" y="50" id="log"/> 6 <text x="50" y="50" id="log"/>
7 <script xlink:href="../../resources/js-test.js"></script>
7 <script id="script"> 8 <script id="script">
8 <![CDATA[ 9 <![CDATA[
9 10
10 var g = document.getElementById("g"); 11 var g = document.getElementById("g");
11 12
12 function log(message) { 13 function log(message) {
13 var logDiv = document.getElementById('log'); 14 var logDiv = document.getElementById('log');
14 logDiv.appendChild(document.createTextNode(message)); 15 logDiv.appendChild(document.createTextNode(message));
15 } 16 }
16 17
17 function createAnimatedRectInstance() { 18 function createAnimatedRectInstance() {
18 var use = document.createElementNS("http://www.w3.org/2000/svg", "use"); 19 var use = document.createElementNS("http://www.w3.org/2000/svg", "use");
19 use.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#rect"); 20 use.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#rect");
20 21
21 var anim = document.createElementNS("http://www.w3.org/2000/svg", "animate") ; 22 var anim = document.createElementNS("http://www.w3.org/2000/svg", "animate") ;
22 anim.setAttribute("attributeType", "XML"); 23 anim.setAttribute("attributeType", "XML");
23 anim.setAttribute("attributeName", "x"); 24 anim.setAttribute("attributeName", "x");
24 anim.setAttribute("from", "100"); 25 anim.setAttribute("from", "100");
25 anim.setAttribute("to", "0"); 26 anim.setAttribute("to", "0");
26 anim.setAttribute("begin", "0s"); 27 anim.setAttribute("begin", "0s");
27 anim.setAttribute("dur", "10.0s"); 28 anim.setAttribute("dur", "10.0s");
28 anim.setAttribute("repeatCount", 1); 29 anim.setAttribute("repeatCount", 1);
29 30
30 use.appendChild(anim); 31 use.appendChild(anim);
31 32
32 return use; 33 return use;
33 } 34 }
34 35
35 function cleanup() { 36 function cleanup() {
36 // Collect garbage before recording starting live node count, in case there are live elements from previous tests. 37 collectGarbage(function() {
37 // FIXME: Unclear why two calls to collect() are required, see crbug.com/307 614 38 var originalLiveElements = internals.numberOfLiveNodes();
38 GCController.collect();
39 GCController.collect();
40 var originalLiveElements = internals.numberOfLiveNodes();
41 39
42 while (g.hasChildNodes()) 40 while (g.hasChildNodes())
43 g.removeChild(g.lastChild); 41 g.removeChild(g.lastChild);
44 42
45 GCController.collect(); 43 collectGarbage(function() {
44 // FIXME: Why 400 and not 200?
45 var liveDelta = originalLiveElements - internals.numberOfLiveNodes() - 400;
46 if (liveDelta == 0)
47 log("PASS");
48 else
49 log("FAIL: " + liveDelta + " extra live node(s)");
46 50
47 // FIXME: Why 400 and not 200? 51 testRunner.notifyDone();
48 var liveDelta = originalLiveElements - internals.numberOfLiveNodes() - 400; 52 });
49 if (liveDelta == 0) 53 });
50 log("PASS");
51 else
52 log("FAIL: " + liveDelta + " extra live node(s)");
53
54 testRunner.notifyDone();
55 } 54 }
56 55
57 function addMoreInstances() { 56 function addMoreInstances() {
58 for (var i = 0; i < 50; i++) 57 for (var i = 0; i < 50; i++)
59 g.appendChild(createAnimatedRectInstance()); 58 g.appendChild(createAnimatedRectInstance());
60 59
61 setTimeout(cleanup, 0); 60 setTimeout(cleanup, 0);
62 } 61 }
63 62
64 function startTest() { 63 function startTest() {
(...skipping 10 matching lines...) Expand all
75 } else { 74 } else {
76 log("This test only works when run with the testRunner, GCController, an d internals available."); 75 log("This test only works when run with the testRunner, GCController, an d internals available.");
77 return; 76 return;
78 } 77 }
79 78
80 setTimeout(startTest, 0); 79 setTimeout(startTest, 0);
81 } 80 }
82 ]]> 81 ]]>
83 </script> 82 </script>
84 </svg> 83 </svg>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698