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 <div style="margin: 0px 0; width: 100px; height: 1000px; background-color: blue;
"></div> | 3 <div style="margin: 0px 0; width: 100px; height: 1000px; background-color: blue;
"></div> |
4 <script> | 4 <script> |
5 // TODO: This test just verifies that scrollX and scrollY end up with the right | 5 // TODO: This test just verifies that scrollX and scrollY end up with the right |
6 // values after a scroll. It does not verify whether these values are coming | 6 // values after a scroll. It does not verify whether these values are coming |
7 // from content scroll or from viewport moving. This should be added. | 7 // from content scroll or from viewport moving. This should be added. |
8 if (window.eventSender) { | 8 if (window.eventSender && window.internals) { |
9 // Do a pinch at the bottom of the page. | 9 // Do a pinch at the bottom of the page. |
10 eventSender.gesturePinchBegin('touchpad', 400, 600); | 10 eventSender.gesturePinchBegin('touchpad', 400, 600); |
11 eventSender.gesturePinchUpdate('touchpad', 400, 600, 2.0); | 11 eventSender.gesturePinchUpdate('touchpad', 400, 600, 2.0); |
12 eventSender.gesturePinchEnd('touchpad', 400, 600); | 12 eventSender.gesturePinchEnd('touchpad', 400, 600); |
13 shouldBe('window.innerWidth', '400'); | 13 shouldBe('internals.visualViewportWidth()', '400'); |
14 shouldBe('window.innerHeight', '300'); | 14 shouldBe('internals.visualViewportHeight()', '300'); |
15 shouldBe('window.scrollX', '200'); | 15 shouldBe('internals.visualViewportScrollX()', '200'); |
16 shouldBe('window.scrollY', '300'); | 16 shouldBe('internals.visualViewportScrollY()', '300'); |
17 | 17 |
18 // Do a purely vertical scroll. This will scroll contents only. | 18 // Do a purely vertical scroll. This will scroll contents only. |
19 eventSender.continuousMouseScrollBy(0, -1); | 19 eventSender.continuousMouseScrollBy(0, -1); |
20 shouldBe('window.scrollX', '200'); | 20 shouldBe('internals.visualViewportScrollX()', '200'); |
21 shouldBe('window.scrollY', '301'); | 21 shouldBe('internals.visualViewportScrollY()', '301'); |
22 | 22 |
23 // Do a purely horizontal scroll. This will change pinch virtual viewport | 23 // Do a purely horizontal scroll. This will change pinch virtual viewport |
24 // offset only. | 24 // offset only. |
25 eventSender.continuousMouseScrollBy(-1, 0); | 25 eventSender.continuousMouseScrollBy(-1, 0); |
26 shouldBe('window.scrollX', '201'); | 26 shouldBe('internals.visualViewportScrollX()', '201'); |
27 shouldBe('window.scrollY', '301'); | 27 shouldBe('internals.visualViewportScrollY()', '301'); |
28 | 28 |
29 // Do a diagonal scroll. This will scroll the contents, and then bubble the | 29 // Do a diagonal scroll. This will scroll the contents, and then bubble the |
30 // result up to the pinch virtual viewport, where it will change the pinch | 30 // result up to the visual viewport, where it will change the pinch |
31 // virtual viewport offset. | 31 // virtual viewport offset. |
32 eventSender.continuousMouseScrollBy(2, 2); | 32 eventSender.continuousMouseScrollBy(2, 2); |
33 shouldBe('window.scrollX', '199'); | 33 shouldBe('internals.visualViewportScrollX()', '199'); |
34 shouldBe('window.scrollY', '299'); | 34 shouldBe('internals.visualViewportScrollY()', '299'); |
35 } | 35 } |
36 </script> | 36 </script> |
OLD | NEW |