Index: third_party/WebKit/LayoutTests/virtual/threaded/fast/scroll-behavior/smooth-scroll/main-thread-scrolling-reason-added.html |
diff --git a/third_party/WebKit/LayoutTests/virtual/threaded/fast/scroll-behavior/smooth-scroll/main-thread-scrolling-reason-added.html b/third_party/WebKit/LayoutTests/virtual/threaded/fast/scroll-behavior/smooth-scroll/main-thread-scrolling-reason-added.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1b906f77392b609983837be037550f710c1405de |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/virtual/threaded/fast/scroll-behavior/smooth-scroll/main-thread-scrolling-reason-added.html |
@@ -0,0 +1,59 @@ |
+<!DOCTYPE html> |
+<script src="../../../../../resources/js-test.js"></script> |
+<style> |
+body { |
+ width: 2000px; |
+ height: 2000px; |
+} |
+</style> |
+ |
+<script> |
+var jsTestIsAsync = true; |
+ |
+description("This test verifies that smooth scrolls initiated on the main " + |
+ "thread add the appropriate main thread scrolling reason."); |
+ |
+// From ScrollingCoordinator::mainThreadScrollingReasonsAsText. |
+var ANIMATING_TEXT = 'Animating scroll on main thread'; |
+var RUNNING_ON_COMPOSITOR = 2; |
+ |
+function finishTest() { |
+ requestAnimationFrame(function() { |
+ // Check that main thread scrolling reason is removed. |
+ shouldBeTrue("internals.mainThreadScrollingReasons(document) == ''"); |
+ finishJSTest(); |
+ }); |
+} |
+ |
+function runTest() { |
+ if (document.scrollingElement.scrollTop == 0) { |
+ requestAnimationFrame(runTest); |
+ } else { |
+ // Check that initiated by main thread and running on the compositor. |
+ shouldBeTrue("internals.getScrollAnimationState(document) " + |
+ "== RUNNING_ON_COMPOSITOR"); |
+ // Check that main thread scrolling reason is added. |
+ shouldBeTrue("internals.mainThreadScrollingReasons(document) " + |
+ "== ANIMATING_TEXT"); |
+ shouldBecomeEqual("document.scrollingElement.scrollTop == 40", |
+ "true", finishTest); |
+ } |
+} |
+ |
+onload = function() { |
+ if (!window.eventSender || !window.internals) { |
+ debug("This test requires window.eventSender.") |
+ finishJSTest(); |
+ return; |
+ } |
+ internals.settings.setScrollAnimatorEnabled(true); |
+ |
+ document.scrollingElement.scrollTop = 0; |
+ |
+ // Scroll 1 ticks down. |
+ eventSender.mouseMoveTo(20, 20); |
+ eventSender.mouseScrollBy(0, -1); |
+ runTest(); |
+}; |
+ |
+</script> |