blob: dec894ce0772f77c59e11f8c317cc8e9da9ded2a [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>no usable &lt;source&gt; test</title>
<script src=video-test.js></script>
<script>
document.addEventListener("error", errorEvent, true);
function errorEvent(evt)
{
findMediaElement();
consoleWrite("++ ERROR, src = " + relativeURL(event.target.src) + ", type = \"" + event.target.type + "\"");
testExpected("event.target.tagName", "SOURCE", "==");
// Any more source elements pending?
var nextSource = event.target.nextSibling;
while (video.hasChildNodes()) {
if (!nextSource || nextSource.tagName == "SOURCE")
break;
nextSource = nextSource.nextSibling;
}
if (!nextSource) {
testExpected("event.target.parentNode.networkState", HTMLMediaElement.NETWORK_NO_SOURCE, "==");
consoleWrite("");
endTest();
} else {
// Because the error event is fired asynchronously the network state can be either
// NETWORK_LOADING or NETWORK_NO_SOURCE, depending on whether or not
testExpected("event.target.parentNode.networkState", HTMLMediaElement.NETWORK_IDLE, ">");
}
consoleWrite("");
}
</script>
</head>
<body>
<video controls>
<source src="test.mp4" type="audio/x-chicken-face">
<source src="test.ogv" type="video/x-higglety-pigglety">
<source src="doesnotexist.mp4">
</video>
<p>1. Test that no usable &lt;source&gt; element leaves the media element with
networkState == NETWORK_NO_SOURCE</p>
</body>
</html>