Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script src="../../../../resources/js-test.js"></script> | |
| 3 <style> | |
| 4 body { | |
| 5 width: 2000px; | |
| 6 height: 2000px; | |
| 7 } | |
| 8 </style> | |
| 9 | |
| 10 <script> | |
| 11 var jsTestIsAsync = true; | |
| 12 | |
| 13 description("This test verifies that the first programmatic smooth scroll " + | |
| 14 "doesn't always run on the main thread (see crbug.com/592799)."); | |
| 15 | |
| 16 // 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.
| |
| 17 var RUNNING_ON_COMPOSITOR = 2; | |
| 18 | |
| 19 function runTest() { | |
| 20 if (document.scrollingElement.scrollTop == 0) { | |
| 21 requestAnimationFrame(runTest); | |
| 22 } else { | |
| 23 // Check that initiated by main thread and running on the compositor. | |
| 24 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.
| |
| 25 "== RUNNING_ON_COMPOSITOR"); | |
| 26 shouldBecomeEqual("document.scrollingElement.scrollTop == 500", | |
| 27 "true", finishJSTest); | |
| 28 } | |
| 29 } | |
| 30 | |
| 31 onload = function() { | |
| 32 if (!window.internals) { | |
| 33 debug("This test requires window.internals."); | |
| 34 finishJSTest(); | |
| 35 return; | |
| 36 } | |
| 37 | |
| 38 document.scrollingElement.scrollTop = 0; | |
| 39 | |
| 40 window.scrollBy({top: 500, behavior: "smooth"}); | |
| 41 | |
| 42 runTest(); | |
| 43 }; | |
| 44 | |
| 45 </script> | |
| OLD | NEW |