Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/virtual/threaded/fast/scroll-behavior/first-scroll-runs-on-compositor.html |
| diff --git a/third_party/WebKit/LayoutTests/virtual/threaded/fast/scroll-behavior/first-scroll-runs-on-compositor.html b/third_party/WebKit/LayoutTests/virtual/threaded/fast/scroll-behavior/first-scroll-runs-on-compositor.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..757237cefe343249e48352c63834f587f0ef5f31 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/virtual/threaded/fast/scroll-behavior/first-scroll-runs-on-compositor.html |
| @@ -0,0 +1,45 @@ |
| +<!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 the first programmatic smooth scroll " + |
| + "doesn't always run on the main thread (see crbug.com/592799)."); |
| + |
| +// From ScrollingCoordinator::mainThreadScrollingReasonsAsText. |
|
skobes
2016/03/14 17:37:48
nit: actually from ScrollAnimatorCompositorCoordin
ymalik
2016/03/14 21:45:39
Thanks, copy paste error.
|
| +var RUNNING_ON_COMPOSITOR = 2; |
| + |
| +function runTest() { |
| + if (document.scrollingElement.scrollTop == 0) { |
| + requestAnimationFrame(runTest); |
| + } else { |
| + // Check that initiated by main thread and running on the compositor. |
| + shouldBeTrue("internals.getProgrammaticScrollAnimationState(document) " + |
|
jbroman
2016/03/14 17:35:32
nit: equality comparison is why shouldBe exists:
ymalik
2016/03/14 21:45:39
Done.
|
| + "== RUNNING_ON_COMPOSITOR"); |
| + shouldBecomeEqual("document.scrollingElement.scrollTop == 500", |
| + "true", finishJSTest); |
| + } |
| +} |
| + |
| +onload = function() { |
| + if (!window.internals) { |
| + debug("This test requires window.internals."); |
| + finishJSTest(); |
| + return; |
| + } |
| + |
| + document.scrollingElement.scrollTop = 0; |
| + |
| + window.scrollBy({top: 500, behavior: "smooth"}); |
| + |
| + runTest(); |
| +}; |
| + |
| +</script> |