[Modern Media Controls] http/tests/media/modern-media-controls/skip-back-support...
[WebKit-https.git] / LayoutTests / http / tests / media / modern-media-controls / skip-back-support / skip-back-support-button-click.html
1 <script src="../../../../../resources/js-test-pre.js"></script>
2 <script src="/modern-media-controls/controls/scheduler.js" type="text/javascript"></script>
3 <script src="/modern-media-controls/controls/layout-node.js" type="text/javascript"></script>
4 <script src="/modern-media-controls/controls/layout-item.js" type="text/javascript"></script>
5 <script src="/modern-media-controls/controls/button.js" type="text/javascript"></script>
6 <script src="/modern-media-controls/controls/buttons-container.js" type="text/javascript"></script>
7 <script src="/modern-media-controls/controls/icon-service.js" type="text/javascript"></script>
8 <script src="/modern-media-controls/controls/start-button.js" type="text/javascript"></script>
9 <script src="/modern-media-controls/controls/icon-button.js" type="text/javascript"></script>
10 <script src="/modern-media-controls/controls/play-pause-button.js" type="text/javascript"></script>
11 <script src="/modern-media-controls/controls/skip-back-button.js" type="text/javascript"></script>
12 <script src="/modern-media-controls/controls/airplay-button.js" type="text/javascript"></script>
13 <script src="/modern-media-controls/controls/pip-button.js" type="text/javascript"></script>
14 <script src="/modern-media-controls/controls/fullscreen-button.js" type="text/javascript"></script>
15 <script src="/modern-media-controls/controls/mute-button.js" type="text/javascript"></script>
16 <script src="/modern-media-controls/controls/tracks-button.js" type="text/javascript"></script>
17 <script src="/modern-media-controls/controls/slider.js" type="text/javascript"></script>
18 <script src="/modern-media-controls/controls/volume-slider.js" type="text/javascript"></script>
19 <script src="/modern-media-controls/controls/scrubber.js" type="text/javascript"></script>
20 <script src="/modern-media-controls/controls/time-label.js" type="text/javascript"></script>
21 <script src="/modern-media-controls/controls/time-control.js" type="text/javascript"></script>
22 <script src="/modern-media-controls/controls/placard.js" type="text/javascript"></script>
23 <script src="/modern-media-controls/controls/airplay-placard.js" type="text/javascript"></script>
24 <script src="/modern-media-controls/controls/pip-placard.js" type="text/javascript"></script>
25 <script src="/modern-media-controls/controls/media-controls.js" type="text/javascript"></script>
26 <script src="/modern-media-controls/controls/macos-media-controls.js" type="text/javascript"></script>
27 <script src="/modern-media-controls/controls/macos-inline-media-controls.js" type="text/javascript"></script>
28 <script src="/modern-media-controls/media/media-controller-support.js" type="text/javascript"></script>
29 <script src="/modern-media-controls/media/mute-support.js" type="text/javascript"></script>
30 <script src="/modern-media-controls/media/skip-back-support.js" type="text/javascript"></script>
31 <script src="/modern-media-controls/media/start-support.js" type="text/javascript"></script>
32 <script src="/modern-media-controls/media/media-controller.js" type="text/javascript"></script>
33 <script src="/modern-media-controls/main.js" type="text/javascript"></script>
34 <body>
35 <video src="../../resources/hls/generate-vod.php?duration=8000" style="width: 320px; height: 240px;"></video>
36 <div id="shadow"></div>
37 <script type="text/javascript">
38
39 window.jsTestIsAsync = true;
40
41 description("Testing the <code>SkipBackSupport</code> behavior by clicking on the mute button.");
42
43 iconService.directoryPath = "/modern-media-controls/images";
44
45 const shadowRoot = document.querySelector("div#shadow").attachShadow({ mode: "open" });
46 const media = document.querySelector("video");
47 const mediaController = createControls(shadowRoot, media, null);
48
49 let numberOfEvents = 0;
50 function mediaDidSeek()
51 {
52     debug("Media seeked to currentTime = " + media.currentTime);
53
54     numberOfEvents++;
55     if (numberOfEvents == 3) {
56         debug("");
57         shadowRoot.host.remove();
58         media.remove();
59         finishJSTest();
60         return;
61     }
62
63     debug("");
64     debug("Dispatching click event to the skip back button");
65     mediaController.controls.skipBackButton.element.click();
66 }
67
68 function mediaCanPlay()
69 {
70     media.removeEventListener("canplaythrough", mediaCanPlay);
71     media.addEventListener("seeked", mediaDidSeek);
72     media.currentTime = 50;
73 }
74
75 media.addEventListener("canplaythrough", mediaCanPlay);
76
77 </script>
78 <script src="../../../../../resources/js-test-post.js"></script>
79 </body>