Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/js-test.js"></script> | 2 <script src="../../../resources/js-test.js"></script> |
| 3 <style> | 3 <style> |
| 4 body { | 4 body { |
| 5 height: 1800px; | 5 height: 1800px; |
| 6 } | 6 } |
| 7 </style> | 7 </style> |
| 8 <body> | 8 <body> |
| 9 <script> | 9 <script> |
| 10 window.jsTestIsAsync = true; | 10 window.jsTestIsAsync = true; |
| 11 var defaultTimeoutForShouldBecome = 5000; | |
| 11 | 12 |
| 12 description("This test scrolls by clicking in the scrollbar track."); | 13 description("This test scrolls by clicking in the scrollbar track."); |
| 13 | 14 |
| 14 // Compute ScrollableArea::pageStep. | 15 // Compute ScrollableArea::pageStep. |
| 15 var pageStep = innerHeight * 0.875; | 16 var pageStep = innerHeight * 0.875; |
| 16 if (navigator.userAgent.indexOf("Mac OS X") >= 0) | 17 if (navigator.userAgent.indexOf("Mac OS X") >= 0) |
| 17 pageStep = Math.max(pageStep, innerHeight - 40); | 18 pageStep = Math.max(pageStep, innerHeight - 40); |
| 18 | 19 |
| 19 onload = function() { | 20 onload = function() { |
| 20 if (!window.eventSender || !window.internals) { | 21 if (!window.eventSender || !window.internals) { |
| 21 finishJSTest(); | 22 finishJSTest(); |
| 22 return; | 23 return; |
| 23 } | 24 } |
| 24 | 25 |
| 25 // Turn on smooth scrolling. | 26 // Turn on smooth scrolling. |
| 26 internals.settings.setScrollAnimatorEnabled(true); | 27 internals.settings.setScrollAnimatorEnabled(true); |
|
ymalik
2016/11/09 22:11:30
We can probably get rid of this from here and ever
skobes
2016/11/10 01:09:21
I'll do this in a follow-up.
| |
| 27 | 28 |
| 28 // Click in the vertical scrollbar track, below the thumb. | 29 // Click in the vertical scrollbar track, below the thumb. |
| 29 eventSender.mouseMoveTo(790, 280); | 30 eventSender.mouseMoveTo(790, 280); |
| 30 eventSender.mouseDown(); | 31 eventSender.mouseDown(); |
| 31 eventSender.mouseUp(); | 32 eventSender.mouseUp(); |
| 32 | 33 |
| 33 // A second click should have no effect since we will be under the thumb | 34 // A second click should have no effect since we will be under the thumb |
| 34 // by the time the animation completes. | 35 // by the time the animation completes. |
| 35 eventSender.mouseDown(); | 36 eventSender.mouseDown(); |
| 36 eventSender.mouseUp(); | 37 eventSender.mouseUp(); |
| 37 | 38 |
| 38 shouldBecomeEqual("scrollY", "pageStep", function() { | 39 shouldBecomeEqual("scrollY", "pageStep", function() { |
| 39 requestAnimationFrame(function() { | 40 requestAnimationFrame(function() { |
| 40 // Make sure we stopped here. | 41 // Make sure we stopped here. |
| 41 shouldBe("scrollY", "pageStep"); | 42 shouldBe("scrollY", "pageStep"); |
| 42 finishJSTest(); | 43 finishJSTest(); |
| 43 }); | 44 }); |
| 44 }); | 45 }); |
| 45 }; | 46 }; |
| 46 </script> | 47 </script> |
| 47 </body> | 48 </body> |
| OLD | NEW |