2 <script src=
"../../resources/js-test.js"></script>
10 window
.scrollTo(0, 0);
11 internals
.setPageScaleFactor(2);
14 function testArrowKeys()
17 window
.eventSender
.keyDown('downArrow');
18 shouldBeGreaterThan('window.scrollY', '0');
20 numScrolls
= Math
.ceil((pageHeight
- window
.innerHeight
) / window
.scrollY
);
22 for(var i
= 0; i
< numScrolls
- 1; ++i
) {
23 window
.eventSender
.keyDown('downArrow');
26 shouldBe('window.scrollY', 'pageHeight - window.innerHeight');
28 for(var i
= 0; i
< numScrolls
; ++i
) {
29 window
.eventSender
.keyDown('upArrow');
32 shouldBe('window.scrollY', '0');
34 // Now test left and right.
37 window
.eventSender
.keyDown('rightArrow');
38 numScrolls
= Math
.ceil((pageWidth
- window
.innerWidth
) / window
.scrollX
);
40 for(var i
= 0; i
< numScrolls
- 1; ++i
) {
41 window
.eventSender
.keyDown('rightArrow');
44 shouldBe('window.scrollX', 'pageWidth - window.innerWidth');
46 for(var i
= 0; i
< numScrolls
; ++i
) {
47 window
.eventSender
.keyDown('leftArrow');
50 shouldBe('window.scrollX', '0');
53 function testHomeEnd()
55 window
.eventSender
.keyDown('end');
56 shouldBe('window.scrollY', 'pageHeight - window.innerHeight');
57 window
.eventSender
.keyDown('home');
58 shouldBe('window.scrollY', '0');
61 function testPageUpDown()
63 window
.eventSender
.keyDown('pageDown');
64 shouldBeGreaterThan('window.scrollY', '0');
66 numScrolls
= Math
.ceil((pageHeight
- window
.innerHeight
) / window
.scrollY
);
68 for(var i
= 0; i
< numScrolls
- 1; ++i
) {
69 window
.eventSender
.keyDown('pageDown');
72 shouldBe('window.scrollY', 'pageHeight - window.innerHeight');
74 for(var i
= 0; i
< numScrolls
; ++i
) {
75 window
.eventSender
.keyDown('pageUp');
78 shouldBe('window.scrollY', '0');
81 function testSpacebar()
83 window
.eventSender
.keyDown(' ');
84 shouldBeGreaterThan('window.scrollY', '0');
86 numScrolls
= Math
.ceil((pageHeight
- window
.innerHeight
) / window
.scrollY
);
88 for(var i
= 0; i
< numScrolls
- 1; ++i
) {
89 window
.eventSender
.keyDown(' ');
92 shouldBe('window.scrollY', 'pageHeight - window.innerHeight');
94 for(var i
= 0; i
< numScrolls
; ++i
) {
95 window
.eventSender
.keyDown(' ', 'shiftKey');
98 shouldBe('window.scrollY', '0');
104 'Test that keyboard scrolling while the page is scaled scrolls ' +
105 'both viewports. To test manually, pinch zoom into the page and ' +
106 'use the arrow keys, page up/down, home/end to scroll the page. ' +
107 'You should be able to reach the end of the page bounds (i.e. ' +
108 'scroll to see the divs at the bounds.)');
110 if (window
.eventSender
&& window
.internals
) {
112 debug('Testing arrow keys:');
117 debug('Testing home and end keys:');
122 debug('Testing page up and page down keys:');
127 debug('Testing spacebar:');
132 addEventListener('load', runTest
);
135 ::-webkit-scrollbar {
143 background-color: red;
184 <p id=
"description" style=
"width: 800px"></p>
185 <p id=
"console" style=
"width: 800px"></p>
186 <div class=
"top">Top of page
</div>
187 <div class=
"bottom">Bottom of page
</div>
188 <div class=
"left">Left of page
</div>
189 <div class=
"right">Right of page
</div>
190 <div class=
"middle">Middle of page
</div>