2009-09-18 Alpha Lam <hclam@chromium.org>
[WebKit-https.git] / LayoutTests / media / video-src-remove.html
index 9fce5b8..341020d 100644 (file)
@@ -1,10 +1,13 @@
 <html>
 <body>
+    <script src=media-file.js></script>
     <script src=video-test.js></script>
-
-    <video src=content/silence.mpg controls>
-        <source src=content/test.mp4>
-    </video>
+    <div id=panel></div>
+    <script>
+        var panel = document.getElementById("panel");
+        var mediaFile = findMediaFile("video", "content/test");
+        panel.innerHTML = "<video src=" + mediaFile + " controls onloadedmetadata='loadedmetadata()'><source src=content/counting.mp4></video>";
+    </script>
 
     <p>Test that removing valid 'src' attribute DOES NOT trigger load of &lt;source&gt; elements</p>
 
         
         function testSrc()
         {
-            testExpected("relativeURL(video.currentSrc)", "content/silence.mpg");
+            testExpected("relativeURL(video.currentSrc)", mediaFile);
             testExpected("isNaN(video.duration)", false);
             consoleWrite("");
         }
 
         function loadedmetadata()
         {
+            consoleWrite("EVENT(loadedmetadata)");
+
             ++loadCount;
             if (loadCount == 1)
             {
@@ -34,6 +39,7 @@
                 endTest();
             }
             consoleWrite("");
+            setTimeout(someTimeLater, 100) ;
         }
         
         function someTimeLater()
@@ -44,8 +50,6 @@
         }
 
         consoleWrite("");
-        waitForEvent('loadedmetadata', loadedmetadata);
-        setTimeout(someTimeLater, 400) ;
     </script>
 
 </body>