Update WPT tests for embedded content
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / html / semantics / embedded-content / media-elements / loading-the-media-resource / autoplay-overrides-preload.html
1 <!DOCTYPE HTML>
2 <title>autoplay overrides preload</title>
3 <script src="/resources/testharness.js"></script>
4 <script src="/resources/testharnessreport.js"></script>
5 <script src="/common/media.js"></script>
6 <div id=log></div>
7 <script>
8 ['none', 'metadata'].forEach(function(preload) {
9   ['first', 'last'].forEach(function(order) {
10     async_test(function(t) {
11       var a = document.createElement('audio');
12       a.src = getAudioURI('/media/sound_5');
13       if (order == 'first') {
14         a.autoplay = true;
15         a.preload = preload;
16       } else {
17         a.preload = preload;
18         a.autoplay = true;
19       }
20       a.addEventListener('error', t.unreached_func());
21       a.addEventListener('playing', t.step_func(function() {
22         assert_equals(a.readyState, a.HAVE_ENOUGH_DATA);
23         assert_false(a.paused);
24         t.done();
25       }));
26     }, 'autoplay (set ' + order + ') overrides preload "' + preload + '"');
27   });
28 });
29 </script>