2009-08-26 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 onloadedmetadata="loadedmetadata()" >
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             consoleWrite("EVENT(loadedmetadata)");
26
27             ++loadCount;
28             if (loadCount == 1)
29             {
30                 testSrc();
31                 run("video.removeAttribute('src')");
32             }
33             else
34             {
35                 consoleWrite("<span style='color:red'>FAIL</span> : 'loadCount' fired " + loadCount + "times" );
36                 endTest();
37             }
38             consoleWrite("");
39             setTimeout(someTimeLater, 100) ;
40         }
41         
42         function someTimeLater()
43         {
44             testSrc();
45             endTest();
46             consoleWrite("");
47         }
48
49         consoleWrite("");
50     </script>
51
52 </body>
53 </html>