Bug 1065827 - Wait for loadeddata event to start test. r=jwwang
☠☠ backed out by 52f3406b7024 ☠ ☠
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 06 Nov 2014 20:54:37 +1100
changeset 214378 9316add97cf2510b5bc01b552189f749538dae4b
parent 214377 44f27b3c35d47fe906b0ecf42c55de5d4cf0d56e
child 214379 4467ecf7bc6bb65e3b76da33ce20757287ac4b35
push id27780
push userkwierso@gmail.com
push dateFri, 07 Nov 2014 02:25:05 +0000
treeherdermozilla-central@e6d47abb6a7b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjwwang
bugs1065827
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1065827 - Wait for loadeddata event to start test. r=jwwang
dom/media/test/test_reset_src.html
--- a/dom/media/test/test_reset_src.html
+++ b/dom/media/test/test_reset_src.html
@@ -21,17 +21,17 @@ href="https://bugzilla.mozilla.org/show_
 
 var manager = new MediaTestManager;
 
 function finish(v) {
   removeNodeAndSource(v);
   manager.finished(v.token);
 }
 
-function onLoadedMetadata_Audio(e) {
+function onLoadedData_Audio(e) {
   var t = e.target;
   is(t.videoHeight, 0, t.name + ": videoHeight should be zero when there is no video.");
   is(t.videoWidth, 0, t.name + ": videoWidth should be zero when there is no video.");
   is(t.mozPaintedFrames, 0, t.name + ": mozPaintedFrames should be zero when there is no video.");
   is(t.mozFrameDelay, 0, t.name + ": mozFrameDelay should be zero when there is no video.");
   var c = document.getElementsByTagName("canvas")[0].getContext("2d");
   try {
     c.drawImage(t, 0, 0, t.videoHeight, t.videoWidth);
@@ -57,40 +57,40 @@ function onTimeUpdate_Video(e) {
     t.src = t.src;
     t._firstTime = false;
   } else {
     var source = getPlayableAudio(gPlayTests);
     if (!source) {
       todo("No audio file available.")
       finish(t);
     } else {
-      t.removeEventListener("loadedmetadata", onLoadedMetadata_Video);
-      t.addEventListener("loadedmetadata", onLoadedMetadata_Audio);
+      t.removeEventListener("loadeddata", onLoadedData_Video);
+      t.addEventListener("loadeddata", onLoadedData_Audio);
       t.src = source.name;
     }
   }
 }
 
-function onLoadedMetadata_Video(e) {
+function onLoadedData_Video(e) {
   var t = e.target;
   isnot(t.videoHeight, 0, t.name + ": We should have a videoHeight.");
   isnot(t.videoWidth, 0, t.name + ": We should have a videoWidth.");
   t.addEventListener("timeupdate", onTimeUpdate_Video);
   t.play();
 }
 
 function startTest(test, token) {
   var v = document.createElement('video');
   document.body.appendChild(v);
-  v.preload = "metadata";
   v._firstTime = true;
-  v.addEventListener("loadedmetadata", onLoadedMetadata_Video);
+  v.addEventListener("loadeddata", onLoadedData_Video);
   v.src = test.name;
   v.token = token;
   v.name = test.name;
+  v.play();
   manager.started(token);
 }
 
 manager.runTests(getPlayableVideos(gSmallTests.concat(gSeekTests)), startTest);
 </script>
 </pre>
 </body>
 </html>