2009-03-23 Eric Carlson <eric.carlson@apple.com>
[WebKit-https.git] / LayoutTests / media / video-src-remove.html
1 <html>
2 <body>
3     <script src=video-test.js></script>
4
5     <video src=content/silence.mpg controls>
6         <source src=content/test.mp4>
7     </video>
8
9     <p>Test that removing valid 'src' attribute DOES NOT trigger load of &lt;source&gt; elements</p>
10
11     <script>
12         findMediaElement();
13
14         var loadCount = 0;
15         
16         function testSrc()
17         {
18             testExpected("relativeURL(video.currentSrc)", "content/silence.mpg");
19             testExpected("isNaN(video.duration)", false);
20             consoleWrite("");
21         }
22
23         function loadedmetadata()
24         {
25             ++loadCount;
26             if (loadCount == 1)
27             {
28                 testSrc();
29                 run("video.removeAttribute('src')");
30             }
31             else
32             {
33                 consoleWrite("<span style='color:red'>FAIL</span> : 'loadCount' fired " + loadCount + "times" );
34                 endTest();
35             }
36             consoleWrite("");
37         }
38         
39         function someTimeLater()
40         {
41             testSrc();
42             endTest();
43             consoleWrite("");
44         }
45
46         consoleWrite("");
47         waitForEvent('loadedmetadata', loadedmetadata);
48         setTimeout(someTimeLater, 400) ;
49     </script>
50
51 </body>
52 </html>