Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/gesture-pinch-zoom-scroll-bubble.html

Issue 1413493005: Update layout tests to work when smooth scrolling is enabled by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: worked on nit Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 window.jsTestIsAsync = true;
6
7 function testVerticalScroll() {
8 // Do a purely vertical scroll. This will scroll contents only.
9 eventSender.continuousMouseScrollBy(0, -1);
10 shouldBecomeEqual('internals.visualViewportScrollX() == 200 && ' +
11 'internals.visualViewportScrollY() == 301', 'true', testHorizontalScroll);
12 }
13
14 function testHorizontalScroll() {
15 // Do a purely horizontal scroll. This will change pinch virtual viewport
16 // offset only.
17 eventSender.continuousMouseScrollBy(-1, 0);
18 shouldBecomeEqual('internals.visualViewportScrollX() == 201 && ' +
19 'internals.visualViewportScrollY() == 301', 'true', testDiagonalScroll);
20 }
21
22 function testDiagonalScroll() {
23 // Do a diagonal scroll. This will scroll the contents, and then bubble the
24 // result up to the visual viewport, where it will change the pinch
25 // virtual viewport offset.
26 eventSender.continuousMouseScrollBy(2, 2);
27 shouldBecomeEqual('internals.visualViewportScrollX() == 199 && ' +
28 'internals.visualViewportScrollY() == 299', 'true', finishJSTest);
29 }
30
5 // TODO: This test just verifies that scrollX and scrollY end up with the right 31 // 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 32 // 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. 33 // from content scroll or from viewport moving. This should be added.
8 if (window.eventSender && window.internals) { 34 if (window.eventSender && window.internals) {
9 // Do a pinch at the bottom of the page. 35 // Do a pinch at the bottom of the page.
10 eventSender.gesturePinchBegin('touchpad', 400, 600); 36 eventSender.gesturePinchBegin('touchpad', 400, 600);
11 eventSender.gesturePinchUpdate('touchpad', 400, 600, 2.0); 37 eventSender.gesturePinchUpdate('touchpad', 400, 600, 2.0);
12 eventSender.gesturePinchEnd('touchpad', 400, 600); 38 eventSender.gesturePinchEnd('touchpad', 400, 600);
13 shouldBe('internals.visualViewportWidth()', '400'); 39 shouldBe('internals.visualViewportWidth()', '400');
14 shouldBe('internals.visualViewportHeight()', '300'); 40 shouldBe('internals.visualViewportHeight()', '300');
15 shouldBe('internals.visualViewportScrollX()', '200'); 41 shouldBe('internals.visualViewportScrollX()', '200');
16 shouldBe('internals.visualViewportScrollY()', '300'); 42 shouldBe('internals.visualViewportScrollY()', '300');
17 43
18 // Do a purely vertical scroll. This will scroll contents only. 44 testVerticalScroll();
19 eventSender.continuousMouseScrollBy(0, -1); 45 } else {
20 shouldBe('internals.visualViewportScrollX()', '200'); 46 testFailed("This test requires the event sender and internals");
21 shouldBe('internals.visualViewportScrollY()', '301'); 47 finishJSTest();
22
23 // Do a purely horizontal scroll. This will change pinch virtual viewport
24 // offset only.
25 eventSender.continuousMouseScrollBy(-1, 0);
26 shouldBe('internals.visualViewportScrollX()', '201');
27 shouldBe('internals.visualViewportScrollY()', '301');
28
29 // Do a diagonal scroll. This will scroll the contents, and then bubble the
30 // result up to the visual viewport, where it will change the pinch
31 // virtual viewport offset.
32 eventSender.continuousMouseScrollBy(2, 2);
33 shouldBe('internals.visualViewportScrollX()', '199');
34 shouldBe('internals.visualViewportScrollY()', '299');
35 } 48 }
36 </script> 49 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698