Title: [176333] trunk/LayoutTests
Revision
176333
Author
[email protected]
Date
2014-11-19 13:15:00 -0800 (Wed, 19 Nov 2014)

Log Message

Add layout test for throttling of DOM timer changing the style of visible and invisible elements
https://bugs.webkit.org/show_bug.cgi?id=138875

Reviewed by Simon Fraser.

Add a layout test to test that a repeating DOM timer changing the style
of both visible and invisible elements does not get throttled.

Also rename existing tests to use "display-none" instead of "invisible"
for clarity.

* fast/dom/nested-timer-display-none-element-throttling-expected.txt: Renamed from LayoutTests/fast/dom/nested-timer-invisible-element-throttling-expected.txt.
* fast/dom/nested-timer-display-none-element-throttling.html: Renamed from LayoutTests/fast/dom/nested-timer-invisible-element-throttling.html.
* fast/dom/repeating-timer-display-none-element-throttling-expected.txt: Renamed from LayoutTests/fast/dom/repeating-timer-invisible-element-throttling-expected.txt.
* fast/dom/repeating-timer-display-none-element-throttling.html: Renamed from LayoutTests/fast/dom/repeating-timer-invisible-element-throttling.html.
* fast/dom/repeating-timer-mixed-visible-display-none-elements-throttling-expected.txt: Added.
* fast/dom/repeating-timer-mixed-visible-display-none-elements-throttling.html: Added.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (176332 => 176333)


--- trunk/LayoutTests/ChangeLog	2014-11-19 21:01:55 UTC (rev 176332)
+++ trunk/LayoutTests/ChangeLog	2014-11-19 21:15:00 UTC (rev 176333)
@@ -1,5 +1,25 @@
 2014-11-19  Chris Dumez  <[email protected]>
 
+        Add layout test for throttling of DOM timer changing the style of visible and invisible elements
+        https://bugs.webkit.org/show_bug.cgi?id=138875
+
+        Reviewed by Simon Fraser.
+
+        Add a layout test to test that a repeating DOM timer changing the style
+        of both visible and invisible elements does not get throttled.
+
+        Also rename existing tests to use "display-none" instead of "invisible"
+        for clarity.
+
+        * fast/dom/nested-timer-display-none-element-throttling-expected.txt: Renamed from LayoutTests/fast/dom/nested-timer-invisible-element-throttling-expected.txt.
+        * fast/dom/nested-timer-display-none-element-throttling.html: Renamed from LayoutTests/fast/dom/nested-timer-invisible-element-throttling.html.
+        * fast/dom/repeating-timer-display-none-element-throttling-expected.txt: Renamed from LayoutTests/fast/dom/repeating-timer-invisible-element-throttling-expected.txt.
+        * fast/dom/repeating-timer-display-none-element-throttling.html: Renamed from LayoutTests/fast/dom/repeating-timer-invisible-element-throttling.html.
+        * fast/dom/repeating-timer-mixed-visible-display-none-elements-throttling-expected.txt: Added.
+        * fast/dom/repeating-timer-mixed-visible-display-none-elements-throttling.html: Added.
+
+2014-11-19  Chris Dumez  <[email protected]>
+
         Add layout test for DOM timer throttling and element moving into view after layout
         https://bugs.webkit.org/show_bug.cgi?id=138874
 

Copied: trunk/LayoutTests/fast/dom/nested-timer-display-none-element-throttling-expected.txt (from rev 176331, trunk/LayoutTests/fast/dom/nested-timer-invisible-element-throttling-expected.txt) (0 => 176333)


--- trunk/LayoutTests/fast/dom/nested-timer-display-none-element-throttling-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/nested-timer-display-none-element-throttling-expected.txt	2014-11-19 21:15:00 UTC (rev 176333)
@@ -0,0 +1,18 @@
+Tests that a nested timer changing the style of a display:none element gets throttled.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+The timer should initially not be throttled.
+PASS internals.isTimerThrottled(timeoutId) is false
+5th iteration, timer should have been throttled.
+PASS wasThrottled is true
+6th iteration, timer should still be throttled.
+PASS internals.isTimerThrottled(timeoutId) is true
+Timer mutated the DOM tree.
+7th iteration, timer should no longer be throttled.
+PASS internals.isTimerThrottled(timeoutId) is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: trunk/LayoutTests/fast/dom/nested-timer-display-none-element-throttling.html (from rev 176331, trunk/LayoutTests/fast/dom/nested-timer-invisible-element-throttling.html) (0 => 176333)


--- trunk/LayoutTests/fast/dom/nested-timer-display-none-element-throttling.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/nested-timer-display-none-element-throttling.html	2014-11-19 21:15:00 UTC (rev 176333)
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<body>
+<script src=""
+<div id="testElement" style="display: none">Test</div>
+<script>
+description("Tests that a nested timer changing the style of a display:none element gets throttled.");
+jsTestIsAsync = true;
+
+var iterationCount = 0;
+var timeoutId;
+var testElement = document.getElementById("testElement");
+var wasThrottled = false;
+
+function checkTimerThrottleState()
+{
+  if (iterationCount == 5) {
+    // Do not use shouldBeTrue() here because it would cause a DOM tree mutation and
+    // unthrottle the DOM Timer.
+    wasThrottled = internals.isTimerThrottled(timeoutId);
+  } else if (iterationCount == 6) {
+    debug("5th iteration, timer should have been throttled.");
+    shouldBeTrue("wasThrottled");
+    debug("6th iteration, timer should still be throttled.");
+    shouldBeTrue("internals.isTimerThrottled(timeoutId)");
+  } else if (iterationCount >= 6) {
+    // Timer should be unthrottled due to the DOM tree mutation caused by shouldBeTrue() in
+    // the previous iteration.
+    debug("" + iterationCount + "th iteration, timer should no longer be throttled.");
+    shouldBeFalse("internals.isTimerThrottled(timeoutId)");
+    clearTimeout(timeoutId);
+    finishJSTest();
+  }
+}
+
+function timerCallback()
+{
+  ++iterationCount;
+  // Interact with the style of the element.
+  testElement.style["left"] = "" + iterationCount + "px";
+
+  // 5 iterations should be sufficient to throttle the timer.
+  if (iterationCount >= 5) {
+    setTimeout(checkTimerThrottleState, 0);
+    if (iterationCount == 7) {
+      // The call to debug() mutates the DOM tree.
+      debug("Timer mutated the DOM tree.");
+    }
+  }
+
+  timeoutId = setTimeout(timerCallback, 0);
+}
+
+timeoutId = setTimeout(timerCallback, 0);
+debug("The timer should initially not be throttled.");
+shouldBeFalse("internals.isTimerThrottled(timeoutId)");
+</script>
+<script src=""
+</body>

Deleted: trunk/LayoutTests/fast/dom/nested-timer-invisible-element-throttling-expected.txt (176332 => 176333)


--- trunk/LayoutTests/fast/dom/nested-timer-invisible-element-throttling-expected.txt	2014-11-19 21:01:55 UTC (rev 176332)
+++ trunk/LayoutTests/fast/dom/nested-timer-invisible-element-throttling-expected.txt	2014-11-19 21:15:00 UTC (rev 176333)
@@ -1,18 +0,0 @@
-Tests that a nested timer changing the style of a non-visible element gets throttled.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-The timer should initially not be throttled.
-PASS internals.isTimerThrottled(timeoutId) is false
-5th iteration, timer should have been throttled.
-PASS wasThrottled is true
-6th iteration, timer should still be throttled.
-PASS internals.isTimerThrottled(timeoutId) is true
-Timer mutated the DOM tree.
-7th iteration, timer should no longer be throttled.
-PASS internals.isTimerThrottled(timeoutId) is false
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/fast/dom/nested-timer-invisible-element-throttling.html (176332 => 176333)


--- trunk/LayoutTests/fast/dom/nested-timer-invisible-element-throttling.html	2014-11-19 21:01:55 UTC (rev 176332)
+++ trunk/LayoutTests/fast/dom/nested-timer-invisible-element-throttling.html	2014-11-19 21:15:00 UTC (rev 176333)
@@ -1,58 +0,0 @@
-<!DOCTYPE html>
-<body>
-<script src=""
-<div id="testElement" style="display: none">Test</div>
-<script>
-description("Tests that a nested timer changing the style of a non-visible element gets throttled.");
-jsTestIsAsync = true;
-
-var iterationCount = 0;
-var timeoutId;
-var testElement = document.getElementById("testElement");
-var wasThrottled = false;
-
-function checkTimerThrottleState()
-{
-  if (iterationCount == 5) {
-    // Do not use shouldBeTrue() here because it would cause a DOM tree mutation and
-    // unthrottle the DOM Timer.
-    wasThrottled = internals.isTimerThrottled(timeoutId);
-  } else if (iterationCount == 6) {
-    debug("5th iteration, timer should have been throttled.");
-    shouldBeTrue("wasThrottled");
-    debug("6th iteration, timer should still be throttled.");
-    shouldBeTrue("internals.isTimerThrottled(timeoutId)");
-  } else if (iterationCount >= 6) {
-    // Timer should be unthrottled due to the DOM tree mutation caused by shouldBeTrue() in
-    // the previous iteration.
-    debug("" + iterationCount + "th iteration, timer should no longer be throttled.");
-    shouldBeFalse("internals.isTimerThrottled(timeoutId)");
-    clearTimeout(timeoutId);
-    finishJSTest();
-  }
-}
-
-function timerCallback()
-{
-  ++iterationCount;
-  // Interact with the style of the element.
-  testElement.style["left"] = "" + iterationCount + "px";
-
-  // 5 iterations should be sufficient to throttle the timer.
-  if (iterationCount >= 5) {
-    setTimeout(checkTimerThrottleState, 0);
-    if (iterationCount == 7) {
-      // The call to debug() mutates the DOM tree.
-      debug("Timer mutated the DOM tree.");
-    }
-  }
-
-  timeoutId = setTimeout(timerCallback, 0);
-}
-
-timeoutId = setTimeout(timerCallback, 0);
-debug("The timer should initially not be throttled.");
-shouldBeFalse("internals.isTimerThrottled(timeoutId)");
-</script>
-<script src=""
-</body>

Copied: trunk/LayoutTests/fast/dom/repeating-timer-display-none-element-throttling-expected.txt (from rev 176331, trunk/LayoutTests/fast/dom/repeating-timer-invisible-element-throttling-expected.txt) (0 => 176333)


--- trunk/LayoutTests/fast/dom/repeating-timer-display-none-element-throttling-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/repeating-timer-display-none-element-throttling-expected.txt	2014-11-19 21:15:00 UTC (rev 176333)
@@ -0,0 +1,18 @@
+Tests that a repeating timer changing the style of a display:none element gets throttled.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+The timer should initially not be throttled.
+PASS internals.isTimerThrottled(timeoutId) is false
+5th iteration, timer should have been throttled.
+PASS wasThrottled is true
+6th iteration, timer should still be throttled.
+PASS internals.isTimerThrottled(timeoutId) is true
+Timer mutated the DOM tree.
+7th iteration, timer should no longer be throttled.
+PASS internals.isTimerThrottled(timeoutId) is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: trunk/LayoutTests/fast/dom/repeating-timer-display-none-element-throttling.html (from rev 176331, trunk/LayoutTests/fast/dom/repeating-timer-invisible-element-throttling.html) (0 => 176333)


--- trunk/LayoutTests/fast/dom/repeating-timer-display-none-element-throttling.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/repeating-timer-display-none-element-throttling.html	2014-11-19 21:15:00 UTC (rev 176333)
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<body>
+<script src=""
+<div id="testElement" style="display: none">Test</div>
+<script>
+description("Tests that a repeating timer changing the style of a display:none element gets throttled.");
+jsTestIsAsync = true;
+
+var iterationCount = 0;
+var timeoutId;
+var testElement = document.getElementById("testElement");
+var wasThrottled = false;
+
+function timerCallback()
+{
+  ++iterationCount;
+  // Interact with the style of the element.
+  testElement.style["left"] = "" + iterationCount + "px";
+
+  // 5 iterations should suffice to throttle the timer.
+  if (iterationCount == 5) {
+    // Do not use shouldBeTrue() here because it would cause a DOM tree mutation and
+    // unthrottle the DOM Timer.
+    wasThrottled = internals.isTimerThrottled(timeoutId);
+  } else if (iterationCount == 6) {
+    debug("5th iteration, timer should have been throttled.");
+    shouldBeTrue("wasThrottled");
+    debug("6th iteration, timer should still be throttled.");
+    shouldBeTrue("internals.isTimerThrottled(timeoutId)");
+    debug("Timer mutated the DOM tree.");
+  } else if (iterationCount >= 6) {
+    // Timer should be unthrottled due to the DOM tree mutation caused by shouldBeTrue() in
+    // the previous iteration.
+    debug("" + iterationCount + "th iteration, timer should no longer be throttled.");
+    shouldBeFalse("internals.isTimerThrottled(timeoutId)");
+    clearInterval(timeoutId);
+    finishJSTest();
+  }
+}
+
+timeoutId = setInterval(timerCallback, 0);
+debug("The timer should initially not be throttled.");
+shouldBeFalse("internals.isTimerThrottled(timeoutId)");
+</script>
+<script src=""
+</body>

Deleted: trunk/LayoutTests/fast/dom/repeating-timer-invisible-element-throttling-expected.txt (176332 => 176333)


--- trunk/LayoutTests/fast/dom/repeating-timer-invisible-element-throttling-expected.txt	2014-11-19 21:01:55 UTC (rev 176332)
+++ trunk/LayoutTests/fast/dom/repeating-timer-invisible-element-throttling-expected.txt	2014-11-19 21:15:00 UTC (rev 176333)
@@ -1,18 +0,0 @@
-Tests that a repeating timer changing the style of a non-visible element gets throttled.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-The timer should initially not be throttled.
-PASS internals.isTimerThrottled(timeoutId) is false
-5th iteration, timer should have been throttled.
-PASS wasThrottled is true
-6th iteration, timer should still be throttled.
-PASS internals.isTimerThrottled(timeoutId) is true
-Timer mutated the DOM tree.
-7th iteration, timer should no longer be throttled.
-PASS internals.isTimerThrottled(timeoutId) is false
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/fast/dom/repeating-timer-invisible-element-throttling.html (176332 => 176333)


--- trunk/LayoutTests/fast/dom/repeating-timer-invisible-element-throttling.html	2014-11-19 21:01:55 UTC (rev 176332)
+++ trunk/LayoutTests/fast/dom/repeating-timer-invisible-element-throttling.html	2014-11-19 21:15:00 UTC (rev 176333)
@@ -1,46 +0,0 @@
-<!DOCTYPE html>
-<body>
-<script src=""
-<div id="testElement" style="display: none">Test</div>
-<script>
-description("Tests that a repeating timer changing the style of a non-visible element gets throttled.");
-jsTestIsAsync = true;
-
-var iterationCount = 0;
-var timeoutId;
-var testElement = document.getElementById("testElement");
-var wasThrottled = false;
-
-function timerCallback()
-{
-  ++iterationCount;
-  // Interact with the style of the element.
-  testElement.style["left"] = "" + iterationCount + "px";
-
-  // 5 iterations should suffice to throttle the timer.
-  if (iterationCount == 5) {
-    // Do not use shouldBeTrue() here because it would cause a DOM tree mutation and
-    // unthrottle the DOM Timer.
-    wasThrottled = internals.isTimerThrottled(timeoutId);
-  } else if (iterationCount == 6) {
-    debug("5th iteration, timer should have been throttled.");
-    shouldBeTrue("wasThrottled");
-    debug("6th iteration, timer should still be throttled.");
-    shouldBeTrue("internals.isTimerThrottled(timeoutId)");
-    debug("Timer mutated the DOM tree.");
-  } else if (iterationCount >= 6) {
-    // Timer should be unthrottled due to the DOM tree mutation caused by shouldBeTrue() in
-    // the previous iteration.
-    debug("" + iterationCount + "th iteration, timer should no longer be throttled.");
-    shouldBeFalse("internals.isTimerThrottled(timeoutId)");
-    clearInterval(timeoutId);
-    finishJSTest();
-  }
-}
-
-timeoutId = setInterval(timerCallback, 0);
-debug("The timer should initially not be throttled.");
-shouldBeFalse("internals.isTimerThrottled(timeoutId)");
-</script>
-<script src=""
-</body>

Added: trunk/LayoutTests/fast/dom/repeating-timer-mixed-visible-display-none-elements-throttling-expected.txt (0 => 176333)


--- trunk/LayoutTests/fast/dom/repeating-timer-mixed-visible-display-none-elements-throttling-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/repeating-timer-mixed-visible-display-none-elements-throttling-expected.txt	2014-11-19 21:15:00 UTC (rev 176333)
@@ -0,0 +1,12 @@
+Tests that a repeating timer changing the style of both visible and display:none elements does not throttled.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+The timer should initially not be throttled.
+PASS internals.isTimerThrottled(timeoutId) is false
+PASS internals.isTimerThrottled(timeoutId) is false
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Visible

Added: trunk/LayoutTests/fast/dom/repeating-timer-mixed-visible-display-none-elements-throttling.html (0 => 176333)


--- trunk/LayoutTests/fast/dom/repeating-timer-mixed-visible-display-none-elements-throttling.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/repeating-timer-mixed-visible-display-none-elements-throttling.html	2014-11-19 21:15:00 UTC (rev 176333)
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<body>
+<script src=""
+<div id="visibleElement">Visible</div>
+<div id="invisibleElement1" style="display: none">Invisible</div>
+<div id="invisibleElement2" style="display: none">Invisible</div>
+<script>
+description("Tests that a repeating timer changing the style of both visible and display:none elements does not throttled.");
+jsTestIsAsync = true;
+
+var iterationCount = 0;
+var timeoutId;
+var visibleElement = document.getElementById("visibleElement");
+var invisibleElement1 = document.getElementById("visibleElement");
+var invisibleElement2 = document.getElementById("invisibleElement2");
+var wasThrottled = false;
+
+function timerCallback()
+{
+  ++iterationCount;
+  // Interact with the style of the elements.
+  invisibleElement1.style["left"] = "" + iterationCount + "px";
+  visibleElement.style["left"] = "" + iterationCount + "px";
+  invisibleElement2.style["left"] = "" + iterationCount + "px";
+
+  // 5 iterations should suffice to throttle the timer.
+  if (iterationCount == 5) {
+    shouldBeFalse("internals.isTimerThrottled(timeoutId)");
+    clearInterval(timeoutId);
+    finishJSTest();
+  }
+}
+
+timeoutId = setInterval(timerCallback, 0);
+debug("The timer should initially not be throttled.");
+shouldBeFalse("internals.isTimerThrottled(timeoutId)");
+</script>
+<script src=""
+</body>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to