summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/frames/iframe-scroll-page-up-down.html-disabled
blob: c3fd2c6f687cf2d18e7fa17d5520ffee6f487e06 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<html>
<head>
<script>
function test() 
{
    if (!window.testRunner)
        return;

    if (window.testRunner)
        testRunner.dumpAsText();

    // 1st test: iframes scrolled to top, top level document scrolled to bottom
    // pageup in innermost iframe should scroll top level document up
    window[0][0].scrollTo(0,0);
    window[0].scrollTo(0,0);
    window.scrollTo(0, document.body.offsetHeight);
    var oldScrollTop = document.body.scrollTop;
    var focus1 = window[0][0].document.getElementById("focus1");
    focus1.focus();    
    eventSender.keyDown("pageUp");
    var test1Passed = false;
    if (document.body.scrollTop < oldScrollTop)
        test1Passed = true;

    // 2nd test: iframes scrolled to bottom, top level document scrolled to top
    // pagedown in innermost iframe should scroll top level document down
    window[0][0].scrollTo(0,window[0][0].document.body.offsetHeight);
    window[0].scrollTo(0,window[0].document.body.offsetHeight);
    window.scrollTo(0, 0);
    oldScrollTop = document.body.scrollTop
    var focus2 = window[0][0].document.getElementById("focus2");
    focus2.focus();
    eventSender.keyDown("pageDown");
    var test2Passed = false;
    if (document.body.scrollTop > oldScrollTop)
        test2Passed = true;

    printResults(test1Passed, test2Passed);
}

function printResults(test1Passed, test2Passed) 
{
    var console = document.createElement("div");
    if (test1Passed)
        console.innerHTML = "PASSED test 1";
    else
        console.innerHTML = "FAILED test 1";
    console.innerHTML += "<br>";
    if (test2Passed)
        console.innerHTML += "PASSED test 2";
    else
        console.innerHTML += "FAILED test 2";

    document.body.appendChild(console);
        
}
</script>
</head>
<body onload="window.resizeTo(500,587); test();">
<div id="testDiv">
top
<br>
<div style="height:200px"></div>
<iframe id="frame" width="450px" height="235px" src="./resources/iframe-scroll-page-up-down-1.html"></iframe>
<div style="height:200px"></div>
bottom
</div>
</body>
</html>