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

Unified Diff: third_party/WebKit/LayoutTests/svg/animations/smil-leak-elements.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-elements.svg
diff --git a/third_party/WebKit/LayoutTests/svg/animations/smil-leak-elements.svg b/third_party/WebKit/LayoutTests/svg/animations/smil-leak-elements.svg
index 3dce2fabf350f20634585372efce56cfadb63ec6..85e613d6404649ea39afc9be1ca5b3680db1f21e 100644
--- a/third_party/WebKit/LayoutTests/svg/animations/smil-leak-elements.svg
+++ b/third_party/WebKit/LayoutTests/svg/animations/smil-leak-elements.svg
@@ -1,17 +1,12 @@
<svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="load()">
<g id="g"/>
-<text x="50" y="50" id="log"/>
-<script xlink:href="../../resources/js-test.js"></script>
<script id="script">
+<script xlink:href="../../resources/js-test.js"></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 createAnimatedRect() {
var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
rect.setAttribute("width", 10);
@@ -31,41 +26,9 @@ function createAnimatedRect() {
return rect;
}
-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() {
- var liveDelta = originalLiveElements - internals.numberOfLiveNodes() - 200;
- if (liveDelta == 0)
- log("PASS");
- else
- log("FAIL: " + liveDelta + " extra live node(s)");
- testRunner.notifyDone();
- });
- });
-}
-
-function startTest() {
+function load() {
for (var i = 0; i < 100; i++)
g.appendChild(createAnimatedRect());
-
- setTimeout(cleanup, 0);
-}
-
-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;
- }
-
- setTimeout(startTest, 0);
}
]]>
</script>

Powered by Google App Engine
This is Rietveld 408576698