Rubber-stamped by Brady Eidson.
[webbrowser.git] / LayoutTests / media / video-src-change.html
blob49a2b0e8a867e76fa2fac081e40ffab095b97247
1 <html>
2 <body>
4 <video src=bogus controls></video>
6 <p>
7 1. Test that an invalid src attribute fires an error when the file fails to load.<br>
8 2. Test that changing src attribute triggers load after a load fails.<br>
9 3. Test that changing src does not trigger load once a file is known to be valid.
10 </p
11 <script src=media-file.js></script>
12 <script src=video-test.js></script>
13 <script>
14 var mediaFile = findMediaFile("video", "content/test");
16 function errorEvent()
18 testExpected("relativeURL(video.currentSrc)", "bogus");
19 testExpected("video.networkState", HTMLMediaElement.NETWORK_NO_SOURCE);
20 testExpected("video.error.code", MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED);
21 consoleWrite("");
22 run("video.setAttribute('src', '" + mediaFile + "')");
23 consoleWrite("");
26 function loadedmetadata()
28 testExpected("relativeURL(video.currentSrc)", mediaFile);
29 testExpected("isNaN(video.duration)", false);
30 consoleWrite("");
31 run("video.setAttribute('src', 'content/silence.mpg')");
32 setTimeout(endTest, 500) ;
33 consoleWrite("");
36 consoleWrite("");
37 waitForEvent('loadedmetadata', loadedmetadata);
38 waitForEvent('error', errorEvent);
39 </script>
41 </body>
42 </html>