forked from WebKit/WebKit-http
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontext-menu-actions.html
90 lines (80 loc) · 3.2 KB
/
context-menu-actions.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
88
89
<!DOCTYPE html>
<html>
<head>
<script src="media-file.js"></script>
<script src="video-test.js"></script>
<script>
async function playing()
{
if (window.testRunner) {
if (!window.eventSender) {
testRunner.dumpAsText();
endTest();
return;
}
} else {
endTest();
return;
}
findMediaElement();
var x, y, items;
x = video.offsetParent.offsetLeft + video.offsetLeft + video.offsetWidth / 2;
y = video.offsetParent.offsetTop + video.offsetTop + video.offsetHeight / 2;
eventSender.mouseMoveTo(x, y);
items = eventSender.contextClick();
for (var i = 0; i < items.length; i++)
{
if (items[i].title.match("Controls")) {
testExpected("video.controls", true, '==');
consoleWrite("Toggling media controls");
items[i].click();
testExpected("video.controls", false, '==');
consoleWrite("");
}
if (items[i].title.match("Pause")) {
testExpected("video.paused", false, '==');
consoleWrite("Toggling play state");
items[i].click();
testExpected("video.paused", true, '==');
consoleWrite("");
}
if (items[i].title.match("Loop")) {
testExpected("video.loop", false, '==');
consoleWrite("Toggling loop state");
items[i].click();
testExpected("video.loop", true, '==');
consoleWrite("");
}
if (items[i].title.match("Mute")) {
testExpected("video.muted", false, '==');
consoleWrite("Toggling mute state");
items[i].click();
testExpected("video.muted", true, '==');
consoleWrite("");
}
if (items[i].title.match("Fullscreen") && video.webkitSupportsFullscreen) {
testExpected("video.webkitDisplayingFullscreen", false, '==');
consoleWrite("Toggling fullscreen state");
items[i].click();
await testExpectedEventually("internals.isChangingPresentationMode(video)", false, '==', 1000);
testExpected("video.webkitDisplayingFullscreen", true, '==');
consoleWrite("");
}
// TODO: test copy link location and open in new window.
}
testRunner.dumpAsText();
endTest();
}
async function start()
{
findMediaElement();
waitForEvent('play', playing);
run("video.src = '" + findMediaFile("video", "content/test") + "'");
}
</script>
</head>
<body onload="start()">
<p>Test the various actions available in the HTML5 media element context-menu.</p>
<video id="video" autoplay controls></video>
</body>
</html>