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

Unified Diff: third_party/WebKit/LayoutTests/svg/animations/smil-leak-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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/svg/animations/smil-leak-element-instances.svg
diff --git a/third_party/WebKit/LayoutTests/svg/animations/smil-leak-element-instances.svg b/third_party/WebKit/LayoutTests/svg/animations/smil-leak-element-instances.svg
index 183be326317068005632028a448c9f5f22731ac3..23da5cfce16279ea6643a068ccd64e20bb5bb485 100644
--- a/third_party/WebKit/LayoutTests/svg/animations/smil-leak-element-instances.svg
+++ b/third_party/WebKit/LayoutTests/svg/animations/smil-leak-element-instances.svg
@@ -3,18 +3,13 @@
<rect id="rect" width="100" height="100" />
</defs>
<g id="g"/>
-<text x="50" y="50" id="log"/>
<script xlink:href="../../resources/js-test.js"></script>
<script id="script">
<![CDATA[
+// This test relies on --enable-leak-detection to catch leaks
var g = document.getElementById("g");
-function log(message) {
- var logDiv = document.getElementById('log');
- logDiv.appendChild(document.createTextNode(message));
-}
-
function createAnimatedRectInstance() {
var use = document.createElementNS("http://www.w3.org/2000/svg", "use");
use.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#rect");
@@ -33,49 +28,12 @@ function createAnimatedRectInstance() {
return use;
}
-function cleanup() {
- // Collect garbage before recording starting live node count, in case there are live elements from previous tests.
- asyncGC(function() {
- var originalLiveElements = internals.numberOfLiveNodes();
-
- while (g.hasChildNodes())
- g.removeChild(g.lastChild);
-
- asyncGC(function() {
- // This is 400 instead of 200 as it creates shadow tree elements.
- var liveDelta = originalLiveElements - internals.numberOfLiveNodes() - 400;
- if (liveDelta == 0)
- log("PASS");
- else
- log("FAIL: " + liveDelta + " extra live node(s)");
-
- testRunner.notifyDone();
- });
- });
-}
-
-function startTest() {
+function load() {
// Hold a reference to rect.x.baseVal on the root instance.
xBaseVal = document.getElementById("rect").x.baseVal;
for (var i = 0; i < 100; i++)
g.appendChild(createAnimatedRectInstance());
-
- // FIXME: we need a better way of waiting for chromium events to happen
- setTimeout(cleanup, 1);
-}
-
-function load() {
- if (window.testRunner && window.GCController && window.internals) {
- testRunner.dumpAsText();
- testRunner.waitUntilDone();
- } else {
- log("This test only works when run with the testRunner, GCController, and internals available.");
- return;
- }
-
- // FIXME: we need a better way of waiting for chromium events to happen
- setTimeout(startTest, 1);
}
]]>
</script>

Powered by Google App Engine
This is Rietveld 408576698