forked from WebKit/WebKit-http
/
video-controls-toggling.html
87 lines (71 loc) · 2.86 KB
/
video-controls-toggling.html
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
<html>
<head>
<title>Test rendering of volume slider of video tag</title>
<script src=media-file.js></script>
<script src=media-controls.js></script>
<script src=video-test.js></script>
<script>
var video;
var panel;
var muteButtonCoordinates;
var fadeoutTime = 300;
function init()
{
video = document.getElementsByTagName("video")[0];
video.src = findMediaFile("video", "content/test");
consoleWrite("");
consoleWrite("** Playing the video **");
run("video.play()");
}
function test()
{
panel = mediaControlsElement(internals.shadowRoot(video).firstChild, "-webkit-media-controls-panel");
if (window.eventSender) {
try {
muteButtonCoordinates = mediaControlsButtonCoordinates(video, "mute-button");
} catch (exception) {
testRunner.notifyDone();
return;
}
consoleWrite("");
consoleWrite("** Move mouse somewhere over the panel **");
run("eventSender.mouseMoveTo(muteButtonCoordinates[0], muteButtonCoordinates[1])");
}
consoleWrite("");
consoleWrite("** Test that controls are shown when controls attribute is present **");
testExpected("panel.style['display']", 'none', "!=");
if (window.eventSender) {
consoleWrite("");
consoleWrite("** Move mouse outside the video **");
run("eventSender.mouseMoveTo(video.offsetLeft, video.offsetTop + 2 * video.offsetHeight)");
}
setTimeout(continueTest, fadeoutTime);
}
function continueTest()
{
if (panel.style['display'] != 'none') {
setTimeout(continueTest, fadeoutTime);
return;
}
consoleWrite("");
consoleWrite("** The controls should have the display property set to none");
testExpected("panel.style['display']", 'none', "==");
consoleWrite("");
consoleWrite("** Remove controls attribute**");
run("video.removeAttribute('controls')");
consoleWrite("");
consoleWrite("** Move mouse back over the panel **");
run("eventSender.mouseMoveTo(muteButtonCoordinates[0], muteButtonCoordinates[1])");
consoleWrite("");
consoleWrite("** Video controls should not be shown **");
testExpected("panel.style['display']", 'none', "==");
consoleWrite("");
endTest();
}
</script>
</head>
<body onload="init()">
Tests that showing / hiding video controls uses the sets the display:none property<br>
<video onplay="test()" controls></video>
</body>
</html>