OLD | NEW |
1 <body> | 1 <body> |
2 <div style="height: 1000px"></div> | 2 <div style="height: 1000px"></div> |
3 <a id="a" href="#bottom">Link to bottom</a> | 3 <a id="a" href="#bottom">Link to bottom</a> |
4 <div style="height: 1000px"></div> | 4 <div style="height: 1000px"></div> |
5 <a name="bottom"></a> | 5 <a name="bottom"></a> |
| 6 <script src="/js-test-resources/js-test.js"></script> |
6 <script> | 7 <script> |
7 if (window.testRunner) { | 8 if (window.testRunner) { |
| 9 window.jsTestIsAsync = true; |
8 testRunner.dumpAsText(); | 10 testRunner.dumpAsText(); |
9 testRunner.waitUntilDone(); | 11 testRunner.waitUntilDone(); |
10 } | 12 } |
11 | 13 |
12 window.onload = function() { | 14 window.onload = function() { |
13 if (window.eventSender) { | 15 if (window.eventSender) { |
14 eventSender.mouseScrollBy(0, -20); | 16 function clickLink() { |
15 var a = document.getElementById("a"); | 17 var a = document.getElementById("a"); |
16 eventSender.mouseMoveTo(a.offsetLeft + 2, a.offsetTop - 798); | 18 eventSender.mouseMoveTo(a.offsetLeft + 2, a.offsetTop - 798); |
17 eventSender.mouseDown(); | 19 eventSender.mouseDown(); |
18 eventSender.mouseUp(); | 20 eventSender.mouseUp(); |
| 21 } |
| 22 eventSender.continuousMouseScrollBy(0, -800); |
| 23 shouldBecomeEqual("window.scrollY == 800", "true", clickLink); |
19 } | 24 } |
20 }; | 25 }; |
21 | 26 |
22 var haveSeenHashChange = false; | 27 var haveSeenHashChange = false; |
23 | 28 |
24 window.onhashchange = function() { | 29 window.onhashchange = function() { |
25 if (!haveSeenHashChange) { | 30 if (!haveSeenHashChange) { |
26 haveSeenHashChange = true; | 31 haveSeenHashChange = true; |
27 history.back(); | 32 history.back(); |
28 } else { | 33 } else { |
29 document.body.appendChild(document.createTextNode("scrollY should be 800
: " + (window.scrollY == 800 ? "PASS" : "FAIL"))); | 34 document.body.appendChild(document.createTextNode("scrollY should be 800
: " + (window.scrollY == 800 ? "PASS" : "FAIL"))); |
30 if (window.testRunner) | 35 finishJSTest(); |
31 testRunner.notifyDone(); | |
32 } | 36 } |
33 } | 37 } |
34 </script> | 38 </script> |
35 </body> | 39 </body> |
OLD | NEW |