[Modern Media Controls] Turn media/modern-media-controls/ios-inline-media-controls...
[WebKit-https.git] / LayoutTests / media / media-controls-play-button-updates.html
1 <!DOCTYPE html>
2 <p>This tests if media controls play button is properly updated accroding to mouse clicks</p>
3 <video controls></video>
4 <script src=media-file.js></script>
5 <script src=media-controls.js></script>
6 <script>
7 function timeLineValue()
8 {
9     var timeline = mediaControlsElement(internals.shadowRoot(video).firstChild.firstChild, '-webkit-media-controls-timeline');
10     if (!timeline)
11         throw "Failed to find -webkit-media-controls-timeline";
12
13     return timeline.value;
14 }
15
16 function click()
17 {
18     if (!window.testRunner)
19         return;
20
21     eventSender.mouseDown();
22     eventSender.mouseUp();
23 }
24
25 function canplaythrough()
26 {
27     if (!window.testRunner)
28         return;
29
30     window.testRunner.waitUntilDone();
31
32     var playButtonCoords;
33     try {
34         playButtonCoords = mediaControlsButtonCoordinates(video, "play-button");
35     } catch (exception) {
36         window.testRunner.notifyDone();
37         return;
38     }
39
40     eventSender.mouseMoveTo(playButtonCoords[0], playButtonCoords[1]);
41     setTimeout(click, 0);
42 }
43
44 function pause()
45 {
46     if (!window.testRunner)
47         return;
48
49     window.testRunner.notifyDone();
50 }
51
52 function playing()
53 {
54     setTimeout(click, 0);
55 }
56
57 var video;
58 var requirePixelDump = true;
59
60 onload = function() {
61     findMediaElement();
62     video.src = findMediaFile("video", "content/test");
63
64     waitForEvent("canplaythrough", canplaythrough);
65     waitForEvent("playing", playing);
66     waitForEvent("pause", pause);
67     waitForEventAndFail("error");
68 }
69 </script>
70 <script src=video-test.js></script>