| <!doctype html> |
| <html> |
| <head> |
| <script src=../../media-resources/media-file.js></script> |
| <script src=../../media-resources/video-test.js></script> |
| </head> |
| <body> |
| <video controls></video> |
| <p>Test to ensure that a media file blocked by the resource load delegate generates an error |
| and does not block the document's 'load' event.</p> |
| |
| <script> |
| var events = []; |
| |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| testRunner.setWillSendRequestReturnsNull(true); |
| } else |
| consoleWrite("<b><em>This test can only be run in DumpRenderTree!</em></b><br><br>"); |
| |
| function finish() |
| { |
| consoleWrite("EVENT(loadstart)"); |
| consoleWrite("EVENT(error)"); |
| testExpected("video.error", null, "!="); |
| testExpected("video.error.code", MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED); |
| testExpected("video.networkState", HTMLMediaElement.NETWORK_NO_SOURCE); |
| consoleWrite(""); |
| endTest(); |
| }; |
| |
| function handleEvent(evt) |
| { |
| // Wait until all three events we listen for have been received before testing. |
| // Media events are dispatched asynchronously so we can't assume they will fire |
| // before window.onload. |
| if (events.indexOf(evt.type) == -1) |
| events.push(evt.type); |
| if (events.length == 3) |
| finish(); |
| } |
| |
| findMediaElement(); |
| |
| window.addEventListener('load', handleEvent); |
| video.addEventListener('loadstart', handleEvent); |
| video.addEventListener('error', handleEvent); |
| |
| testExpected("video.networkState", HTMLMediaElement.NETWORK_EMPTY); |
| consoleWrite(""); |
| var mediaFile = findMediaFile("video", "resources/test"); |
| video.src = mediaFile; |
| </script> |
| |
| </body> |
| </html> |