Index: third_party/WebKit/LayoutTests/fast/scroll-behavior/smooth-scroll/mousewheel-scroll-interrupted.html |
diff --git a/third_party/WebKit/LayoutTests/fast/scroll-behavior/smooth-scroll/mousewheel-scroll-interrupted.html b/third_party/WebKit/LayoutTests/fast/scroll-behavior/smooth-scroll/mousewheel-scroll-interrupted.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..99395051c70ae74920a013f3f9dce5dae311110e |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/scroll-behavior/smooth-scroll/mousewheel-scroll-interrupted.html |
@@ -0,0 +1,44 @@ |
+<!DOCTYPE html> |
+<script src="../../../resources/js-test.js"></script> |
+<style> |
+ body { |
+ height: 2000px; |
+ width: 2000px; |
+ } |
+</style> |
+ |
+<script> |
+window.jsTestIsAsync = true; |
+ |
+description("This test ensures that input driven user scrolls get cancelled\ |
+ by non-input driven scrolls."); |
+ |
+function runTest() { |
+ if (document.scrollingElement.scrollTop == 0) { |
+ requestAnimationFrame(runTest); |
+ } else { |
+ // Programmatic scroll should cancel smooth scroll. |
+ document.scrollingElement.scrollBy({top: 1, behavior: "smooth"}); |
+ shouldBecomeEqual("document.scrollingElement.scrollTop < 40 && " + |
ajuma
2016/02/08 15:05:34
Won't this condition be true the first time it's c
ymalik
2016/02/08 18:41:23
Yes. I added some expectations to check that we're
|
+ "document.scrollingElement.scrollLeft == 0", "true", finishJSTest); |
+ } |
+} |
+ |
+onload = function() { |
+ if (!window.eventSender || !window.internals) { |
+ finishJSTest(); |
+ return; |
+ } |
+ |
+ // Turn on smooth scrolling. |
+ internals.settings.setScrollAnimatorEnabled(true); |
+ |
+ document.scrollingElement.scrollTop = 0; |
+ |
+ // Scroll down 1 tick (40px). |
+ eventSender.mouseMoveTo(20, 20); |
+ eventSender.mouseScrollBy(0, -1); |
+ |
+ requestAnimationFrame(runTest); |
+} |
+</script> |