Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / media / video-src-invalid-remove.html
blob88fe9ffa8e1578904616cca6348553def612a2da
1 <html>
2 <head>
3 <script src=media-file.js></script>
4 <script src=video-test.js></script>
7 <script>
8 function loadedmetadata()
10 failTest(relativeURL(video.currentSrc) + "loaded but should not" );
11 consoleWrite("");
14 function errorEvent()
16 testExpected("video.error.code", MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED);
18 // "setTimeout()" is generally bad form in a layout test, but we need to verify
19 // that changing the 'src' attribute does not do something that happens
20 // asynchronously so we don't have a lot of options.
21 setTimeout(function () { endTest(); }, 200) ;
22 run("video.removeAttribute('src')");
23 consoleWrite("");
26 function setup()
28 findMediaElement();
30 video.src = "bogus.mov";
32 var source = document.createElement("source");
33 source.setAttribute("src", findMediaFile("video", "content/test"));
34 video.appendChild(source);
36 waitForEvent('loadedmetadata', loadedmetadata);
37 waitForEvent('error', errorEvent);
38 consoleWrite("");
41 </script>
42 </head>
43 <body onload="setup()">
45 <video controls></video>
47 <p>Test that removing 'src' attribute does NOT trigger load of &lt;source&gt; elements</p>
49 <script>
51 </script>
53 </body>
54 </html>