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