Bug 1276272 part 4 - modify the mochitest; r?jwwang draft
authorKaku Kuo <tkuo@mozilla.com>
Sun, 05 Jun 2016 22:15:49 +0800
changeset 375495 f3652a6c828ce3f0e654ede6bbad6946265ec9f1
parent 375493 d661e7760e9a8e31bb2fc37c607da8b75da15033
child 522875 bdc3e68ad0356b1b8e69867527fd30e509ff1b28
push id20282
push usertkuo@mozilla.com
push dateSun, 05 Jun 2016 16:11:13 +0000
reviewersjwwang
bugs1276272
milestone49.0a1
Bug 1276272 part 4 - modify the mochitest; r?jwwang MozReview-Commit-ID: 9DUpKblMbTz
dom/media/test/test_seekToNextFrame.html
--- a/dom/media/test/test_seekToNextFrame.html
+++ b/dom/media/test/test_seekToNextFrame.html
@@ -24,48 +24,54 @@ function startTest(test, token) {
       Log(token, "timed out: ended=" + v.seenEnded);
     }
   };
   manager.started(token, handler);
 
   v.src = test.name;
   v.name = test.name;
 
+  function callSeekToNextFrame() {
+    v.seekToNextFrame().then(
+      () => {
+        ok(v.seenSeeking, "Should have already received seeking event.")
+        v.seenSeeking = false;
+        if (!v.seenEnded)
+          callSeekToNextFrame();
+      },
+      () => {
+        ok(false, "seekToNextFrame() failed.");
+      }
+    );
+  }
+
   var onLoadedmetadata = function(test, v) { return function() {
-    v.seekToNextFrame();
+    callSeekToNextFrame();
   }}(test, v);
 
   var finish = function() {
     v.finished = true;
     v.removeEventListener("loadedmetadata", onLoadedmetadata, false);
     v.removeEventListener("seeking", onSeeking, false);
-    v.removeEventListener("seeked", onSeeked, false);
     removeNodeAndSource(v);
     manager.finished(v.token);
   }
 
   var onEnded = function(test, v) { return function() {
     v.seenEnded = true;
     finish();
   }}(test, v);
 
   var onSeeking = function(test, v) { return function() {
     ok(!v.seenSeeking, "Should yet receive seeking event.")
     v.seenSeeking = true;
   }}(test, v);
 
-  var onSeeked = function(test, v) { return function() {
-    ok(v.seenSeeking, "Should have already received seeking event.")
-    v.seenSeeking = false;
-    v.seekToNextFrame();
-  }}(test, v);
-
   v.addEventListener("loadedmetadata", onLoadedmetadata, false);
   v.addEventListener("seeking", onSeeking, false);
-  v.addEventListener("seeked", onSeeked, false);
   v.addEventListener("ended", onEnded, false);
 
   document.body.appendChild(v);
 }
 
 SimpleTest.waitForExplicitFinish();
 SpecialPowers.pushPrefEnv(
   {