Title: [176729] trunk/LayoutTests
Revision
176729
Author
[email protected]
Date
2014-12-03 11:16:52 -0800 (Wed, 03 Dec 2014)

Log Message

Add layout test for DOM timer throttling in iframe scrolled out of viewport
https://bugs.webkit.org/show_bug.cgi?id=138884

Reviewed by Andreas Kling.

Add a layout test to test that a repeating DOM timer inside an iframe
get throttled if the iframe is scrolled out of the viewport.

* fast/dom/resources/timer-throttling-iframe.html: Added.
* fast/dom/timer-throttle-on-scrolling-iframe-away.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (176728 => 176729)


--- trunk/LayoutTests/ChangeLog	2014-12-03 19:08:53 UTC (rev 176728)
+++ trunk/LayoutTests/ChangeLog	2014-12-03 19:16:52 UTC (rev 176729)
@@ -1,3 +1,16 @@
+2014-12-03  Chris Dumez  <[email protected]>
+
+        Add layout test for DOM timer throttling in iframe scrolled out of viewport
+        https://bugs.webkit.org/show_bug.cgi?id=138884
+
+        Reviewed by Andreas Kling.
+
+        Add a layout test to test that a repeating DOM timer inside an iframe
+        get throttled if the iframe is scrolled out of the viewport.
+
+        * fast/dom/resources/timer-throttling-iframe.html: Added.
+        * fast/dom/timer-throttle-on-scrolling-iframe-away.html: Added.
+
 2014-12-03  Dan Bernstein  <[email protected]>
 
         REGRESSION(r176687): Caused webkit2 test assertion failure crashes in WebKit::WebPage::willStartDrag()

Added: trunk/LayoutTests/fast/dom/resources/timer-throttling-iframe.html (0 => 176729)


--- trunk/LayoutTests/fast/dom/resources/timer-throttling-iframe.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/resources/timer-throttling-iframe.html	2014-12-03 19:16:52 UTC (rev 176729)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<body>
+<div id="testElement">TEST</div>
+<script>
+var testElement = document.getElementById("testElement");
+var iterationCount = 0;
+var timeoutId;
+
+function timerCallback() {
+  ++iterationCount;
+
+  // Change style of Element.
+  testElement.style["opacity"] = "" + (iterationCount / 10.);
+
+  parent.timerFired(iterationCount, internals.isTimerThrottled(timeoutId));
+
+  if (iterationCount == 7)
+    clearInterval(timeoutId);
+}
+
+timeoutId = setInterval(timerCallback, 0);
+</script>
+</body>

Added: trunk/LayoutTests/fast/dom/timer-throttle-on-scrolling-iframe-away.html (0 => 176729)


--- trunk/LayoutTests/fast/dom/timer-throttle-on-scrolling-iframe-away.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/timer-throttle-on-scrolling-iframe-away.html	2014-12-03 19:16:52 UTC (rev 176729)
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<body>
+<script src=""
+<script>
+description("Tests that a repeating timer in an iframe changing the style of an element gets throttled when scrolling the frame out of view.");
+jsTestIsAsync = true;
+
+function scrollFrameOutOfView()
+{
+  debug("Scrolling frame out of view.");
+  window.scrollBy(0,800);
+}
+
+function timerFired(iterationCount, isThrottled) {
+  // 5 iterations should suffice to throttle the timer.
+  if (iterationCount == 5) {
+    debug("Frame is inside viewport, timer should not be throttled");
+    isTimerThrottledBeforeScroll = isThrottled;
+    shouldBeFalse("isTimerThrottledBeforeScroll");
+    scrollFrameOutOfView();
+  } else if (iterationCount == 7) {
+    debug("Frame is outside viewport, timer should now be throttled");
+    isTimerThrottledAfterScroll = isThrottled;
+    shouldBeTrue("isTimerThrottledAfterScroll");
+    finishJSTest();
+  }
+}
+
+</script>
+<div style="position: relative; width: 1600px; height: 2400px; background-color: green;">
+  <iframe id="testFrame" src="" style="width: 100px; height: 100px;"></iframe>
+</div>
+<script src=""
+</body>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to