Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / media / video-src-remove.html
blob7efa76a4d809feaff315d7b828e53c9aaf19a40e
1 <html>
2 <body>
3 <script src=media-file.js></script>
4 <script src=video-test.js></script>
5 <div id=panel></div>
6 <script>
7 var panel = document.getElementById("panel");
8 var mediaFile = findMediaFile("video", "content/test");
9 panel.innerHTML = "<video src=" + mediaFile + " controls onloadedmetadata='loadedmetadata()'><source src=content/counting.mp4></video>";
10 </script>
12 <p>Test that removing valid 'src' attribute DOES NOT trigger load of &lt;source&gt; elements</p>
14 <script>
15 findMediaElement();
17 var loadCount = 0;
19 function testSrc()
21 testExpected("stripExtension(relativeURL(video.currentSrc))", stripExtension(mediaFile));
22 testExpected("isNaN(video.duration)", false);
23 consoleWrite("");
26 function loadedmetadata()
28 consoleWrite("EVENT(loadedmetadata)");
30 ++loadCount;
31 if (loadCount == 1)
33 testSrc();
34 run("video.removeAttribute('src')");
36 else
38 consoleWrite("<span style='color:red'>FAIL</span> : 'loadCount' fired " + loadCount + "times" );
39 endTest();
41 consoleWrite("");
42 setTimeout(someTimeLater, 100) ;
45 function someTimeLater()
47 testSrc();
48 endTest();
49 consoleWrite("");
52 consoleWrite("");
53 </script>
55 </body>
56 </html>