Update WPT tests for embedded content
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / html / semantics / embedded-content / media-elements / networkState_during_loadstart.html
1 <!doctype html>
2 <html>
3  <head>
4   <title>{audio,video}.networkState - NETWORK_LOADING</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/#dom-media-networkstate">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 var ta = async_test("audioElement.networkState should be NETWORK_LOADING during loadstart event");
18 var a = document.getElementById("a");
19 a.addEventListener("loadstart", function() {
20   ta.step(function() {
21    assert_equals(a.networkState,
22    a.NETWORK_LOADING);
23   });
24   ta.done();
25   a.pause();
26 }, false);
27 a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
28
29 var tv = async_test("videoElement.networkState should be NETWORK_LOADING during loadstart event");
30 var v = document.getElementById("v");
31 v.addEventListener("loadstart", function() {
32   tv.step(function() {
33    assert_equals(a.networkState,
34    v.NETWORK_LOADING);
35   });
36   tv.done();
37   v.pause();
38 }, false);
39 v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
40   </script>
41  </body>
42 </html>