summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fullscreen/enter-exit-full-screen-hover.html
blob: 1aa60aabd5f07469beb55a5a9fc2c54bd2fee042 (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
<!DOCTYPE html>
<script src="../resources/js-test.js"></script>
<script src="full-screen-test.js"></script>
<script src="../fast/events/touch/resources/touch-hover-active-tests.js"></script>
<link rel="stylesheet" href="../fast/events/touch/resources/touch-hover-active-tests.css">

<button id="enter" class='touch-interactive' onclick="document.body.webkitRequestFullScreen()">Go full screen</button>
<button id="exit" class='touch-interactive' onclick="document.webkitCancelFullScreen()">Exit full screen</button>

<script>
var enterButton;
var exitButton;

function runTest() {
    if (!window.eventSender) {
        debug('This test requires DRT.');
        return;
    }

    enterButton = document.getElementById('enter');
    exitButton = document.getElementById('exit');

    var enterButtonCenter = elementCenter(enterButton);

    waitForEventOnce(document, 'webkitfullscreenchange', function() {
        shouldBeTrue("document.webkitIsFullScreen")
        // After entering fullscreen, the button should lose hover
        shouldBeDefault("getHoverActiveState(enterButton)")

        waitForEventOnce(document, 'webkitfullscreenchange', function() {
            shouldBeFalse("document.webkitIsFullScreen")
            // After leaving fullscreen, the button should lose hover
            shouldBeDefault("getHoverActiveState(exitButton)")
            endTest();
        });

        var exitButtonCenter = elementCenter(exitButton);
        // Hover on and click the "Exit fullscreen" button
        eventSender.mouseMoveTo(exitButtonCenter.x, exitButtonCenter.y);
        eventSender.mouseDown();
        eventSender.mouseUp();
    });


    // Move mouse over to the "Go fullscreen" button and click
    eventSender.mouseMoveTo(enterButtonCenter.x, enterButtonCenter.y);
    eventSender.mouseDown();
    eventSender.mouseUp();
}

runTest();
</script>