summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/media/video-controls-visible-audio-only.html
blob: a267a3837abcc74028a6c759c16c64130fdebc63 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html>
<html>
    <head>
        <style>
            #no-video-media { background-color: yellow; width: 320px; height: 100px;} 
            #mouse-parking:hover { padding:8; background-color: blue; }
        </style>
        <script src=media-file.js></script>
        <script src=media-controls.js></script>
        <script>
            if (window.testRunner) {
                testRunner.dumpAsText();
                testRunner.waitUntilDone();
            }

            var video;

            function consoleWrite(text)
            {
                var console = document.getElementById("console");
                console.innerHTML += text + "<br>";
            }
            
            function testcondition(testFuncString, endit)
            {
                if (eval(testFuncString))
                    consoleWrite("TEST(" + testFuncString + ") <span style='color:green'>OK</span>");
                else
                    consoleWrite("TEST(" + testFuncString + ") <span style='color:red'>FAIL</span>");    
            }
            
            function start()
            {
                video = document.getElementById("no-video-media");

                testcondition("video.paused");
                if (!window.testRunner)
                    return;

                // start playback
                var playCoords
                try {
                    playCoords = mediaControlsButtonCoordinates(video, "play-button");
                } catch (exception) {
                    consoleWrite(exception.description);
                    testRunner.notifyDone();
                    return;
                }
                var clickX = playCoords[0];
                var clickY = playCoords[1];
                eventSender.mouseMoveTo(clickX, clickY);
                eventSender.mouseDown();
                eventSender.mouseUp();
                testcondition("!video.paused");

                // move the mouse off of the element
                target = document.getElementById("mouse-parking");
                eventSender.mouseMoveTo(target.offsetLeft + 4, target.offsetTop + 4);

                // controller should still be visible after a second
                setTimeout(function() { testRunner.notifyDone(); } , 1000);
            }

            if (window.testRunner) {
                setTimeout(function() { 
                    document.body.appendChild(document.createTextNode('FAIL')); 
                    if (window.testRunner)
                        testRunner.notifyDone();
                } , 8000);
            }

        </script>
    </head>
    <body >

        <p>Test video element control visibility when mouse is not over element.</p>
        <p>This test only runs in DRT!</p>

        <p><span id="mouse-parking">mouse parks here, am I blue?</span></p>

        <video id="no-video-media" controls loop oncanplaythrough="start()"></video>
        <br><br><div id="console"></div>
        <script>
            setSrcById("no-video-media", findMediaFile("audio", "content/test"));
        </script>
    </body>
</html>