| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <style> | 2 <style> |
| 3 #content { | 3 #content { |
| 4 width: 750px; | 4 width: 750px; |
| 5 height: 10000px; | 5 height: 10000px; |
| 6 background-color: blue; | 6 background-color: blue; |
| 7 } | 7 } |
| 8 </style> | 8 </style> |
| 9 <script src="../../resources/js-test.js"></script> | 9 <script src="../../resources/js-test.js"></script> |
| 10 <div id="content"></div> | 10 <div id="content"></div> |
| 11 <div id="console"></div> | 11 <div id="console"></div> |
| 12 <script> | 12 <script> |
| 13 | 13 |
| 14 jsTestIsAsync = true; | 14 jsTestIsAsync = true; |
| 15 | 15 |
| 16 var prevScrollY; | 16 var prevScrollY; |
| 17 var scrollStart; | 17 var scrollStart; |
| 18 | 18 |
| 19 function runTest() { | 19 function runTest() { |
| 20 internals.settings.setScrollAnimatorEnabled(true); | 20 internals.settings.setScrollAnimatorEnabled(true); |
| 21 | 21 |
| 22 window.addEventListener("scroll", onWindowScroll); | 22 window.addEventListener("scroll", onWindowScroll); |
| 23 | 23 |
| 24 testRunner.layoutAndPaintAsyncThen(function() { | 24 testRunner.layoutAndPaintAsyncThen(function() { |
| 25 window.eventSender.keyDown('end'); | 25 window.eventSender.keyDown('End'); |
| 26 }); | 26 }); |
| 27 } | 27 } |
| 28 | 28 |
| 29 function onWindowScroll() { | 29 function onWindowScroll() { |
| 30 if (typeof prevScrollY === 'undefined') { | 30 if (typeof prevScrollY === 'undefined') { |
| 31 shouldNotBe("window.scrollY", | 31 shouldNotBe("window.scrollY", |
| 32 "document.body.scrollHeight - window.innerHeight"); | 32 "document.body.scrollHeight - window.innerHeight"); |
| 33 shouldBeGreaterThan("window.scrollY", "0"); | 33 shouldBeGreaterThan("window.scrollY", "0"); |
| 34 prevScrollY = window.scrollY; | 34 prevScrollY = window.scrollY; |
| 35 | 35 |
| 36 if (window.scrollY === document.body.scrollHeight - window.innerHeight)
{ | 36 if (window.scrollY === document.body.scrollHeight - window.innerHeight)
{ |
| 37 // We wont get another scroll event. The failure was reported above | 37 // We wont get another scroll event. The failure was reported above |
| 38 // but return early to prevent a timeout. | 38 // but return early to prevent a timeout. |
| 39 finishJSTest(); | 39 finishJSTest(); |
| 40 } | 40 } |
| 41 } else { | 41 } else { |
| 42 shouldBeGreaterThan("window.scrollY", "prevScrollY"); | 42 shouldBeGreaterThan("window.scrollY", "prevScrollY"); |
| 43 finishJSTest(); | 43 finishJSTest(); |
| 44 } | 44 } |
| 45 } | 45 } |
| 46 | 46 |
| 47 description("Tests that overflow scrolls on the root frame are animated."); | 47 description("Tests that overflow scrolls on the root frame are animated."); |
| 48 | 48 |
| 49 if (window.eventSender) | 49 if (window.eventSender) |
| 50 runTest(); | 50 runTest(); |
| 51 else | 51 else |
| 52 debug("FAIL: This test requires window.eventSender."); | 52 debug("FAIL: This test requires window.eventSender."); |
| 53 | 53 |
| 54 </script> | 54 </script> |
| OLD | NEW |