4 <script src=media-file.js></script>
5 <script src=video-test.js></script>
8 <video controls></video>
9 <p>Test to ensure that a media file blocked by the resource load delegate generates an error
10 and does not block the document's 'load' event.</p>
15 if (window.layoutTestController) {
16 layoutTestController.dumpAsText();
17 layoutTestController.setWillSendRequestReturnsNull(true);
19 consoleWrite("<b><em>This test can only be run in DumpRenderTree!</em></b><br><br>");
23 consoleWrite("EVENT(loadstart)");
24 consoleWrite("EVENT(error)");
25 testExpected("video.error", null, "!=");
26 testExpected("video.error.code", MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED);
27 testExpected("video.networkState", HTMLMediaElement.NETWORK_NO_SOURCE);
32 function handleEvent(evt)
34 // Wait until all three events we listen for have been received before testing.
35 // Media events are dispatched asynchronously so we can't assume they will fire
36 // before window.onload.
37 if (events.indexOf(evt.type) == -1)
38 events.push(evt.type);
39 if (events.length == 3)
45 window.addEventListener('load', handleEvent);
46 video.addEventListener('loadstart', handleEvent);
47 video.addEventListener('error', handleEvent);
49 testExpected("video.networkState", HTMLMediaElement.NETWORK_EMPTY);
51 var mediaFile = findMediaFile("video", "content/test");
52 video.src = mediaFile;