Update WPT tests for embedded content
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / html / semantics / embedded-content / media-elements / event_canplaythrough_noautoplay.html
1 <!doctype html>
2 <html>
3  <head>
4   <title>{audio,video} events - canplaythrough</title>
5   <script src="/resources/testharness.js"></script>
6   <script src="/resources/testharnessreport.js"></script>
7   <script src="/common/media.js"></script>
8  </head>
9  <body>
10   <p><a href="https://html.spec.whatwg.org/multipage/#mediaevents">spec reference</a></p>
11   <audio id="a" controls>
12   </audio>
13   <video id="v" controls>
14   </video>
15   <div id="log"></div>
16   <script>
17 test(function() {
18   var t = async_test("setting src attribute on non-autoplay audio should trigger canplaythrough event");
19   var a = document.getElementById("a");
20   a.addEventListener("error", t.unreached_func());
21   a.addEventListener("canplaythrough", t.step_func_done(), false);
22   a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
23 }, "audio events - canplaythrough");
24
25 test(function() {
26   var t = async_test("setting src attribute on non-autoplay video should trigger canplaythrough event");
27   var v = document.getElementById("v");
28   v.addEventListener("error", t.unreached_func());
29   v.addEventListener("canplaythrough", t.step_func_done(), false);
30   v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
31 }, "video events - canplaythrough");
32   </script>
33  </body>
34 </html>