summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/scroll-behavior/overflow-scroll-root-frame-animates.html
blob: 95f71855e99772958eef73c5299214fd66778880 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<style>
#content {
  width: 750px;
  height: 10000px;
  background-color: blue;
}
</style>
<script src="../../resources/js-test.js"></script>
<div id="content"></div>
<div id="console"></div>
<script>

jsTestIsAsync = true;

var prevScrollY;
var scrollStart;

function runTest() {
    internals.settings.setScrollAnimatorEnabled(true);

    window.addEventListener("scroll", onWindowScroll);

    testRunner.layoutAndPaintAsyncThen(function() {
        window.eventSender.keyDown('end');
    });
}

function onWindowScroll() {
    if (typeof prevScrollY === 'undefined') {
        shouldNotBe("window.scrollY",
                    "document.body.scrollHeight - window.innerHeight");
        shouldBeGreaterThan("window.scrollY", "0");
        prevScrollY = window.scrollY;

        if (window.scrollY === document.body.scrollHeight - window.innerHeight) {
            // We wont get another scroll event. The failure was reported above
            // but return early to prevent a timeout.
            finishJSTest();
        }
    } else {
        shouldBeGreaterThan("window.scrollY", "prevScrollY");
        finishJSTest();
    }
}

description("Tests that overflow scrolls on the root frame are animated.");

if (window.eventSender)
    runTest();
else
    debug("FAIL: This test requires window.eventSender.");

</script>