57 lines
1.8 KiB
HTML
57 lines
1.8 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<script src=media-file.js></script>
|
|
<script src=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", "content/test");
|
|
video.src = mediaFile;
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|