Update WPT tests for embedded content
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / html / semantics / embedded-content / media-elements / readyState_during_loadeddata.html
1 <!doctype html>
2 <html>
3  <head>
4   <title>{audio,video} events - readyState property during loadeddata</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" autoplay controls>
12   </audio>
13   <video id="v" autoplay controls>
14   </video>
15   <div id="log"></div>
16   <script>
17 test(function() {
18   var t = async_test("audio.readyState should be >= HAVE_CURRENT_DATA during loadeddata event");
19   var a = document.getElementById("a");
20   a.addEventListener("error", t.unreached_func());
21   a.addEventListener("loadeddata", t.step_func(function() {
22     assert_greater_than_equal(a.readyState, a.HAVE_CURRENT_DATA);
23     t.done();
24     a.pause();
25   }), false);
26   a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
27 }, "audio events - readyState property during loadeddata");
28
29 test(function() {
30   var t = async_test("video.readyState should be >= HAVE_CURRENT_DATA during loadeddata event");
31   var v = document.getElementById("v");
32   v.addEventListener("error", t.unreached_func());
33   v.addEventListener("loadeddata", t.step_func(function() {
34     assert_greater_than_equal(v.readyState, v.HAVE_CURRENT_DATA);
35     t.done();
36     v.pause();
37   }), false);
38   v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
39 }, "video events - readyState property during loadeddata");
40   </script>
41  </body>
42 </html>