[macOS / iOS Debug] Layout Test imported/w3c/web-platform-tests/webrtc/RTCPeerConnect...
[WebKit-https.git] / LayoutTests / scrollbars / scrolling-backward-by-page-on-keyboard-spacebar.html
1 <html>
2     <head>
3         <style>
4             body {
5                 height: 10000px;
6             }
7         </style>
8         <script src="../resources/js-test-pre.js"></script>
9     </head>
10     <body>
11         <script>
12             description("Test scrolling backward with page granularity by using the space bar.");
13
14             jsTestIsAsync = true;
15
16             var failTimeoutId;
17             function test() {
18                 if (window.eventSender) {
19                     // Force the first layout to avoid the suppressed scrollbar cases.
20                     scratch = document.documentElement.offsetWidth;
21                     scrollBy(0, 1000);
22
23                     // Avoid special cases for being "onload".
24                     setTimeout(function() {
25                         eventSender.keyDown(' ', ['shiftKey']);
26                     } , 0);
27
28                     failTimeoutId = setTimeout(function() {
29                         testFailed("The scrollview failed to scroll in response to the event.");
30                         debug("window.scrollY = " + window.scrollY + " excepted value around " + (1000 - (window.innerHeight - 40)));
31                         finishJSTest();
32                     }, 1000);
33                 }
34             }
35
36             window.addEventListener("scroll", function() {
37                 if (window.scrollY == 1000 - (window.innerHeight - 40)) {
38                     testPassed("Scrolled to " + window.scrollY);
39                     clearTimeout(failTimeoutId);
40                     finishJSTest();
41                 }
42             })
43             window.addEventListener("load", test);
44         </script>
45         <script src="../resources/js-test-post.js"></script>
46     </body>
47 </html>