Bug 1276272 part 4 - modify the mochitest; r?jwwang draft
authorKaku Kuo <tkuo@mozilla.com>
Sun, 05 Jun 2016 22:15:49 +0800
changeset 375494 d5e24986528e376ad17eb0d821ddaf027bb3fd98
parent 375493 d661e7760e9a8e31bb2fc37c607da8b75da15033
child 522874 1f5c914935a4cf9ec544bc1f0d0249cb323f0b99
push id20281
push usertkuo@mozilla.com
push dateSun, 05 Jun 2016 16:03:37 +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
@@ -23,49 +23,55 @@ function startTest(test, token) {
     "ontimeout": function() {
       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(
   {