OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Verify that moving a video element to a new document, still loads it norm
ally</title> |
| 3 <script src="../resources/testharness.js"></script> |
| 4 <script src="../resources/testharnessreport.js"></script> |
| 5 <script src="media-file.js"></script> |
| 6 <video></video> |
| 7 <iframe></iframe> |
| 8 <script> |
| 9 async_test(function(t) { |
| 10 var video = document.querySelector('video'); |
| 11 video.src = findMediaFile("video", "content/test"); |
| 12 video.onloadeddata = this.step_func(function() { |
| 13 video.onloadeddata = null; |
| 14 assert_true(video.networkState == video.NETWORK_IDLE || video.networ
kState == video.NETWORK_LOADING); |
| 15 assert_greater_than(video.readyState, video.HAVE_METADATA); |
| 16 // Move the video element to iframe document from |
| 17 // main document and verify that it loads properly |
| 18 document.querySelector('iframe').contentDocument.body.appendChild(vi
deo); |
| 19 assert_equals(video.networkState, video.NETWORK_NO_SOURCE); |
| 20 assert_equals(video.readyState, video.HAVE_NOTHING); |
| 21 var actual_events = []; |
| 22 var expected_events = ['emptied', 'loadstart', 'loadeddata']; |
| 23 expected_events.forEach(function(type) { |
| 24 video.addEventListener(type, t.step_func(function() { |
| 25 actual_events.push(type); |
| 26 if (type == 'loadeddata') { |
| 27 assert_array_equals(actual_events, expected_events); |
| 28 t.done(); |
| 29 } |
| 30 })); |
| 31 }); |
| 32 }); |
| 33 }); |
| 34 </script> |
OLD | NEW |