OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <!-- original: https://github.com/w3c/web-platform-tests/blob/master/html/semant
ics/embedded-content/media-elements/seeking/seek-to-currentTime.html --> |
| 3 <title>seek to currentTime</title> |
| 4 <script src="../resources/testharness.js"></script> |
| 5 <script src="../resources/testharnessreport.js"></script> |
| 6 <script src="media-file.js"></script> |
| 7 <div id=log></div> |
| 8 <script> |
| 9 // TODO(srirama.m): Remove this test by importing the above web-platform-tests t
est |
| 10 async_test(function(t) { |
| 11 var v = document.createElement('video'); |
| 12 v.src = findMediaFile('video', 'content/test'); |
| 13 v.onloadedmetadata = t.step_func(function() { |
| 14 assert_greater_than(v.readyState, v.HAVE_NOTHING, 'readyState'); |
| 15 assert_greater_than(v.seekable.length, 0, 'seekable ranges'); |
| 16 assert_false(v.seeking, 'seeking before setting currentTime'); |
| 17 v.currentTime = v.currentTime; |
| 18 assert_true(v.seeking, 'seeking after setting currentTime'); |
| 19 var events = []; |
| 20 v.onseeking = v.ontimeupdate = v.onseeked = t.step_func(function(e) { |
| 21 events.push(e.type); |
| 22 // v.seeking can be true or false in the seeking event, see |
| 23 // https://www.w3.org/Bugs/Public/show_bug.cgi?id=24774 |
| 24 if (e.type != 'seeking') { |
| 25 assert_equals(v.seeking, false, 'seeking in ' + e.type + ' event
'); |
| 26 } |
| 27 if (e.type == 'seeked') { |
| 28 assert_array_equals(events, ['seeking', 'timeupdate', 'seeked'], |
| 29 'fired events'); |
| 30 t.done(); |
| 31 } |
| 32 }); |
| 33 }); |
| 34 }); |
| 35 </script> |
OLD | NEW |