Index: LayoutTests/fast/scroll-behavior/overflow-scroll-animates.html |
diff --git a/LayoutTests/fast/scroll-behavior/overflow-scroll-animates.html b/LayoutTests/fast/scroll-behavior/overflow-scroll-animates.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a88a2b79f3f4605999b213d809ac23d3fd2862fc |
--- /dev/null |
+++ b/LayoutTests/fast/scroll-behavior/overflow-scroll-animates.html |
@@ -0,0 +1,85 @@ |
+<!DOCTYPE html> |
+<style> |
+ |
+#container { |
+ width: 200px; |
+ height: 200px; |
+ overflow: scroll; |
+} |
+ |
+#content { |
+ width: 7500px; |
+ height: 7500px; |
+ background-color: blue; |
+} |
+ |
+</style> |
+<script src="../../resources/js-test.js"></script> |
+<div id="container"> |
+ <div id="content"></div> |
+</div> |
+<div id="console"></div> |
+<script> |
+ |
+jsTestIsAsync = true; |
+element = document.getElementById("container"); |
+ |
+var testConfigs = [ |
+ {preciseDeltas: false, expectSmooth: true}, |
+ {preciseDeltas: true, expectSmooth: false}, |
+]; |
+var config; |
+var waitingForScroll = false; |
+var scrollStart, scrollDuration; |
+ |
+function nextConfig() { |
+ config = testConfigs.shift(); |
+ if (!config) |
+ finishJSTest(); |
+ |
+ element.addEventListener("scroll", onElementScroll); |
+ |
+ eventSender.mouseMoveTo(100, 100); |
+ eventSender.mouseScrollBy(0, -2, /* paged */ false, |
+ config.preciseDeltas); |
+ scrollStart = performance.now(); |
+} |
+ |
+function reset() { |
+ element.removeEventListener("scroll", onElementScroll); |
+ element.scrollTop = 0; |
+ waitingForScroll = false; |
+} |
+ |
+function onElementScroll() { |
+ if (waitingForScroll) { |
+ if (element.scrollTop == 80) { |
+ scrollDuration = performance.now() - scrollStart; |
+ shouldBeTrue("scrollDuration < 500"); |
+ reset(); |
+ nextConfig(); |
+ } |
+ } else if (config.expectSmooth) { |
+ shouldNotBe("element.scrollTop", "80"); |
+ waitingForScroll = true; |
+ } else { |
+ shouldBe("element.scrollTop", "80"); |
+ reset(); |
+ nextConfig(); |
+ } |
+} |
+ |
+function runTest() { |
+ internals.settings.setScrollAnimatorEnabled(true); |
+ nextConfig(); |
+} |
+ |
+description("Tests that overflow scrolls are animated, unless the wheel " + |
+ "event has precise scrolling deltas."); |
+ |
+if (window.eventSender) |
+ runTest(); |
+else |
+ debug("FAIL: This test requires window.eventSender."); |
+ |
+</script> |