Chromium Code Reviews| 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..39dddc65396b6db80473d3352678579b4618a368 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/virtual/threaded/fast/scroll-behavior/smooth-scroll/main-thread-scrolling-reason-added.html |
| @@ -0,0 +1,49 @@ |
| +<!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'; |
| + |
| +function finishTest() { |
| + requestAnimationFrame(function() { |
| + // Check that main thread scrolling reason is removed. |
| + shouldBe("internals.mainThreadScrollingReasons(document)" + |
| + ".localeCompare('')", "0"); |
|
skobes
2016/02/05 19:31:43
Curious, why do you need localeCompare instead of
ymalik
2016/02/06 21:49:05
No good reason. Just remembered comparing strings
|
| + finishJSTest(); |
| + }); |
| +} |
| + |
| +onload = function() { |
| + if (!window.eventSender || !window.internals) { |
| + debug("This test requires window.eventSender.") |
| + finishJSTest(); |
| + return; |
| + } |
| + internals.settings.setScrollAnimatorEnabled(true); |
| + |
| + // Scroll 1 ticks down. |
| + eventSender.mouseMoveTo(20, 20); |
| + eventSender.mouseScrollBy(0, -1); |
| + |
| + requestAnimationFrame(function() { |
| + // Check that main thread scrolling reason is added. |
| + shouldBe("internals.mainThreadScrollingReasons(document)" + |
| + ".localeCompare(ANIMATING_TEXT)", "0"); |
| + shouldBecomeEqual("document.scrollingElement.scrollTop == 40", |
| + "true", finishTest); |
| + }); |
| +}; |
| + |
| +</script> |