Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / svg / animations / smil-leak-dynamically-added-element-instances.svg
blobe3e7dc4814551069d1fe7747d864c5224fa57c85
1 <svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="load()">
2 <defs>
3 <rect id="rect" width="100" height="100" />
4 </defs>
5 <g id="g"/>
6 <text x="50" y="50" id="log"/>
7 <script xlink:href="../../resources/js-test.js"></script>
8 <script id="script">
9 <![CDATA[
11 var g = document.getElementById("g");
13 function log(message) {
14 var logDiv = document.getElementById('log');
15 logDiv.appendChild(document.createTextNode(message));
18 function createAnimatedRectInstance() {
19 var use = document.createElementNS("http://www.w3.org/2000/svg", "use");
20 use.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#rect");
22 var anim = document.createElementNS("http://www.w3.org/2000/svg", "animate");
23 anim.setAttribute("attributeType", "XML");
24 anim.setAttribute("attributeName", "x");
25 anim.setAttribute("from", "100");
26 anim.setAttribute("to", "0");
27 anim.setAttribute("begin", "0s");
28 anim.setAttribute("dur", "10.0s");
29 anim.setAttribute("repeatCount", 1);
31 use.appendChild(anim);
33 return use;
36 function cleanup() {
37 asyncGC(function() {
38 var originalLiveElements = internals.numberOfLiveNodes();
40 while (g.hasChildNodes())
41 g.removeChild(g.lastChild);
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)");
51 testRunner.notifyDone();
52 });
53 });
56 function addMoreInstances() {
57 for (var i = 0; i < 50; i++)
58 g.appendChild(createAnimatedRectInstance());
60 setTimeout(cleanup, 0);
63 function startTest() {
64 for (var i = 0; i < 50; i++)
65 g.appendChild(createAnimatedRectInstance());
67 setTimeout(addMoreInstances, 100);
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, and internals available.");
76 return;
79 setTimeout(startTest, 0);
81 ]]>
82 </script>
83 </svg>