Chromium Code Reviews| 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 isLoaded = false; | |
| 12 window.addEventListener("load", test.step_func(function() { isLo aded = true; }), false); | |
| 13 | |
| 14 assert_equals(document.readyState, "loading", "document should n ot be complete yet"); | |
| 15 var video = document.createElement("video"); | |
| 16 var mediaSource = new MediaSource(); | |
| 17 | |
| 18 // |video| should stop delaying the load event long before eithe r a | |
| 19 // "progress", "stalled" or "suspend" event are enqueued. | |
| 20 video.addEventListener("suspend", test.unreached_func("unexpecte d 'suspend' event")); | |
| 21 video.addEventListener("stalled", test.unreached_func("unexpecte d 'stalled' event")); | |
| 22 video.addEventListener("progress", test.unreached_func("unexpect ed 'progress' event")); | |
| 23 | |
| 24 // No error is expected. | |
| 25 video.addEventListener("error", test.unreached_func("unexpected 'error' event")); | |
| 26 | |
| 27 mediaSource.addEventListener("sourceopen", test.step_func(functi on() { | |
| 28 // Let any pending "load" event also fire. Then verify we've received one. | |
|
mlamouri (slow - plz ping)
2016/05/31 15:30:48
Shouldn't you `assert_false(isLoaded)` here? I bel
wolenetz
2016/05/31 17:50:53
Good point, that was my intent and I missed adding
wolenetz
2016/05/31 18:08:36
I looked a little closer and have further question
| |
| 29 setTimeout(test.step_func(function() { | |
| 30 assert_equals(video.networkState, video.NETWORK_LOADING) ; | |
| 31 assert_equals(video.readyState, video.HAVE_NOTHING); | |
| 32 assert_equals(document.readyState, "complete", "document should be complete"); | |
| 33 assert_true(isLoaded, "load event should have fired"); | |
| 34 test.done(); | |
| 35 }), 0); | |
| 36 })); | |
| 37 | |
| 38 var mediaSourceURL = URL.createObjectURL(mediaSource); | |
| 39 document.body.appendChild(video); | |
| 40 video.src = mediaSourceURL; | |
| 41 test.add_cleanup(function() { | |
| 42 document.body.removeChild(video); | |
| 43 URL.revokeObjectURL(mediaSourceURL); | |
| 44 }); | |
| 45 }, "MediaSource attachment should immediately stop delaying the load event"); | |
| 46 </script> | |
| 47 </body> | |
| 48 </html> | |
| OLD | NEW |