Update WPT tests for embedded content
[WebKit-https.git] / LayoutTests / imported / w3c / web-platform-tests / html / semantics / embedded-content / media-elements / seeking / seek-to-currentTime.html
1 <!doctype html>
2 <title>seek to currentTime</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 async_test(function(t) {
9   var v = document.createElement('video');
10   v.src = getVideoURI('/media/movie_5');
11   v.onloadedmetadata = t.step_func(function() {
12     assert_greater_than(v.readyState, v.HAVE_NOTHING, 'readyState');
13     assert_greater_than(v.seekable.length, 0, 'seekable ranges');
14     assert_false(v.seeking, 'seeking before setting currentTime');
15     v.currentTime = v.currentTime;
16     assert_true(v.seeking, 'seeking after setting currentTime');
17     var events = [];
18     v.onseeking = v.ontimeupdate = v.onseeked = t.step_func(function(e) {
19       events.push(e.type);
20       // v.seeking can be true or false in the seeking event, see
21       // https://www.w3.org/Bugs/Public/show_bug.cgi?id=24774
22       if (e.type != 'seeking') {
23         assert_equals(v.seeking, false, 'seeking in ' + e.type + ' event');
24       }
25       if (e.type == 'seeked') {
26         assert_array_equals(events, ['seeking', 'timeupdate', 'seeked'],
27                             'fired events');
28         t.done();
29       }
30     });
31   });
32 });
33 </script>