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

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

Issue 2144473002: rewrite smil-leak tests to rely on layout test leak detector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | third_party/WebKit/LayoutTests/svg/animations/smil-leak-dynamically-added-element-instances-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"/>
7 <script xlink:href="../../resources/js-test.js"></script> 6 <script xlink:href="../../resources/js-test.js"></script>
8 <script id="script"> 7 <script id="script">
9 <![CDATA[ 8 <![CDATA[
9 // This test relies on --enable-leak-detection to catch leaks
10 10
11 var g = document.getElementById("g"); 11 var g = document.getElementById("g");
12 12
13 function log(message) {
14 var logDiv = document.getElementById('log');
15 logDiv.appendChild(document.createTextNode(message));
16 }
17
18 function createAnimatedRectInstance() { 13 function createAnimatedRectInstance() {
19 var use = document.createElementNS("http://www.w3.org/2000/svg", "use"); 14 var use = document.createElementNS("http://www.w3.org/2000/svg", "use");
20 use.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#rect"); 15 use.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#rect");
21 16
22 var anim = document.createElementNS("http://www.w3.org/2000/svg", "animate") ; 17 var anim = document.createElementNS("http://www.w3.org/2000/svg", "animate") ;
23 anim.setAttribute("attributeType", "XML"); 18 anim.setAttribute("attributeType", "XML");
24 anim.setAttribute("attributeName", "x"); 19 anim.setAttribute("attributeName", "x");
25 anim.setAttribute("from", "100"); 20 anim.setAttribute("from", "100");
26 anim.setAttribute("to", "0"); 21 anim.setAttribute("to", "0");
27 anim.setAttribute("begin", "0s"); 22 anim.setAttribute("begin", "0s");
28 anim.setAttribute("dur", "10.0s"); 23 anim.setAttribute("dur", "10.0s");
29 anim.setAttribute("repeatCount", 1); 24 anim.setAttribute("repeatCount", 1);
30 25
31 use.appendChild(anim); 26 use.appendChild(anim);
32 27
33 return use; 28 return use;
34 } 29 }
35 30
36 function cleanup() { 31 function load() {
37 asyncGC(function() {
38 var originalLiveElements = internals.numberOfLiveNodes();
39
40 while (g.hasChildNodes())
41 g.removeChild(g.lastChild);
42
43 asyncGC(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)");
50
51 testRunner.notifyDone();
52 });
53 });
54 }
55
56 function addMoreInstances() {
57 for (var i = 0; i < 50; i++)
58 g.appendChild(createAnimatedRectInstance());
59
60 setTimeout(cleanup, 0);
61 }
62
63 function startTest() {
64 for (var i = 0; i < 50; i++) 32 for (var i = 0; i < 50; i++)
65 g.appendChild(createAnimatedRectInstance()); 33 g.appendChild(createAnimatedRectInstance());
66 34
67 setTimeout(addMoreInstances, 100); 35 for (var i = 0; i < 50; i++)
68 } 36 g.appendChild(createAnimatedRectInstance());
69
70 function load() {
71 if (window.testRunner && window.GCController && window.internals) {
72 testRunner.dumpAsText();
73 testRunner.waitUntilDone();
74 } else {
75 log("This test only works when run with the testRunner, GCController, an d internals available.");
76 return;
77 }
78
79 setTimeout(startTest, 0);
80 } 37 }
81 ]]> 38 ]]>
82 </script> 39 </script>
83 </svg> 40 </svg>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/svg/animations/smil-leak-dynamically-added-element-instances-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698