blob: 7c93d324022987cf068203640421edca0b1b703e [file] [log] [blame]
<!doctype html>
<html>
<head>
<title>networkState after inserting &lt;source&gt; test</title>
<!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956
(Please avoid writing new tests using video-test.js) -->
<script src=video-test.js></script>
</head>
<body>
<video controls><source></video>
<p>Test that a &lt;source&gt; inserted when networkState is NETWORK_NO_SOURCE triggers
resource selection, immediately changing networkState to NETWORK_NO_SOURCE.</p>
<script>
consoleWrite("&lt;source&gt; inserted by the parser.");
video = document.querySelector('video');
testExpected("video.networkState", HTMLMediaElement.prototype.NETWORK_NO_SOURCE, "==");
consoleWrite("<br>&lt;video&gt; created with script.");
video = document.createElement('video');
testExpected("video.networkState", HTMLMediaElement.prototype.NETWORK_EMPTY, "==");
consoleWrite("&lt;source&gt; inserted by script.");
video.appendChild(document.createElement('source'));
testExpected("video.networkState", HTMLMediaElement.prototype.NETWORK_NO_SOURCE, "==");
if (window.testRunner)
testRunner.notifyDone();
</script>
</body>
</html>