OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="/w3c/resources/testharness.js"></script> |
| 5 <script src="/w3c/resources/testharnessreport.js"></script> |
| 6 </head> |
| 7 <body> |
| 8 <script> |
| 9 async_test(function(test) |
| 10 { |
| 11 var receivedLoadEvent = false; |
| 12 |
| 13 window.addEventListener("load", test.step_func(function() { |
| 14 assert_false(receivedLoadEvent, "window should not receive m
ultiple load events"); |
| 15 receivedLoadEvent = true; |
| 16 })); |
| 17 |
| 18 assert_equals(document.readyState, "loading", "document should n
ot be complete yet"); |
| 19 var video = document.createElement("video"); |
| 20 var mediaSource = new MediaSource(); |
| 21 |
| 22 // |video| should stop delaying the load event long before eithe
r a |
| 23 // "progress", "stalled" or "suspend" event are enqueued. |
| 24 video.addEventListener("suspend", test.unreached_func("unexpecte
d 'suspend' event")); |
| 25 video.addEventListener("stalled", test.unreached_func("unexpecte
d 'stalled' event")); |
| 26 video.addEventListener("progress", test.unreached_func("unexpect
ed 'progress' event")); |
| 27 |
| 28 // No error is expected. |
| 29 video.addEventListener("error", test.unreached_func("unexpected
'error' event")); |
| 30 |
| 31 mediaSource.addEventListener("sourceopen", test.step_func(functi
on() { |
| 32 assert_true(receivedLoadEvent, "load event should have been
received first"); |
| 33 assert_equals(video.networkState, video.NETWORK_LOADING); |
| 34 assert_equals(video.readyState, video.HAVE_NOTHING); |
| 35 assert_equals(document.readyState, "complete", "document sho
uld be complete"); |
| 36 test.done(); |
| 37 })); |
| 38 |
| 39 var mediaSourceURL = URL.createObjectURL(mediaSource); |
| 40 video.src = mediaSourceURL; |
| 41 test.add_cleanup(function() { URL.revokeObjectURL(mediaSourceURL
); }); |
| 42 }, "MediaSource attachment should immediately stop delaying the load
event"); |
| 43 </script> |
| 44 </body> |
| 45 </html> |
OLD | NEW |