Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <script src="../../../resources/js-test.js"></script> | |
| 3 <style> | |
| 4 body { | |
| 5 height: 2000px; | |
| 6 width: 2000px; | |
| 7 } | |
| 8 </style> | |
| 9 | |
| 10 <script> | |
| 11 window.jsTestIsAsync = true; | |
| 12 | |
| 13 description("This test ensures that input driven user scrolls get cancelled\ | |
| 14 by non-input driven scrolls."); | |
| 15 | |
| 16 function runTest() { | |
| 17 if (document.scrollingElement.scrollTop == 0) { | |
| 18 requestAnimationFrame(runTest); | |
| 19 } else { | |
| 20 // Programmatic scroll should cancel smooth scroll. | |
| 21 document.scrollingElement.scrollBy({top: 1, behavior: "smooth"}); | |
| 22 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
| |
| 23 "document.scrollingElement.scrollLeft == 0", "true", finishJSTest); | |
| 24 } | |
| 25 } | |
| 26 | |
| 27 onload = function() { | |
| 28 if (!window.eventSender || !window.internals) { | |
| 29 finishJSTest(); | |
| 30 return; | |
| 31 } | |
| 32 | |
| 33 // Turn on smooth scrolling. | |
| 34 internals.settings.setScrollAnimatorEnabled(true); | |
| 35 | |
| 36 document.scrollingElement.scrollTop = 0; | |
| 37 | |
| 38 // Scroll down 1 tick (40px). | |
| 39 eventSender.mouseMoveTo(20, 20); | |
| 40 eventSender.mouseScrollBy(0, -1); | |
| 41 | |
| 42 requestAnimationFrame(runTest); | |
| 43 } | |
| 44 </script> | |
| OLD | NEW |