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
|
<!doctype html>
<html>
<head>
<title>Test that the overlay play button respects the controls attribute</title>
<script src="media-controls.js"></script>
<script src="media-file.js"></script>
<!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956
(Please avoid writing new tests using video-test.js) -->
<script src="video-test.js"></script>
<script>
function start()
{
window.internals.settings.setMediaControlsOverlayPlayButtonEnabled(true);
// Add element dynamically, since otherwise the controls are created, but
// hidden, before the setting is set, causing the setting to be ignored.
addVideoElement();
findMediaElement();
video.controls = true;
button = mediaControlsButton(video, 'overlay-play-button')
testExpected('getComputedStyle(button).display', 'flex');
waitForEventOnce('loadeddata', loadeddata);
video.src = findMediaFile('video', 'content/test');
}
function addVideoElement() {
element = document.createElement('video');
document.body.appendChild(element);
}
function loadeddata()
{
waitForEventOnce('play', play1);
run('video.play()');
}
function play1()
{
testExpected('getComputedStyle(button).display', 'none');
waitForEventOnce('pause', pause1);
run('video.pause()');
}
function pause1()
{
testExpected('getComputedStyle(button).display', 'flex');
video.controls = false;
testExpected('getComputedStyle(button).display', 'none');
waitForEventOnce('play', play2);
run('video.play()');
}
function play2()
{
testExpected('getComputedStyle(button).display', 'none');
waitForEventOnce('pause', pause2);
run('video.pause()');
}
function pause2()
{
testExpected('getComputedStyle(button).display', 'none');
video.controls = true;
testExpected('getComputedStyle(button).display', 'flex');
endTest();
}
</script>
</head>
<body onload="start()">
<p>Test that the overlay play button respects the controls attribute</p>
</body>
</html>
|