Bug 1421920 - Remove unnecessary script in test_eme_unsetMediaKeys_then_capture.html for further debugging. draft
authorKilik Kuo <kikuo@mozilla.com>
Fri, 01 Dec 2017 10:59:57 +0800
changeset 706052 6ff371a42715acde74622e1065d239de93089055
parent 703941 f5f03ee9e6abf77964f8dc1b9d69c6ccd3f655fd
child 742547 7a3a066e87696f9794fef65b559f12cf242de238
push id91676
push userkikuo@mozilla.com
push dateFri, 01 Dec 2017 03:00:19 +0000
bugs1421920, 1414464
milestone59.0a1
Bug 1421920 - Remove unnecessary script in test_eme_unsetMediaKeys_then_capture.html for further debugging. There're several causes for Bug 1414464. Removing unnecessary script in this test to eliminate the uncertainty for further debugging. MozReview-Commit-ID: IWvvlzJ24gw
dom/media/test/test_eme_unsetMediaKeys_then_capture.html
--- a/dom/media/test/test_eme_unsetMediaKeys_then_capture.html
+++ b/dom/media/test/test_eme_unsetMediaKeys_then_capture.html
@@ -32,24 +32,19 @@ function startTest(test, token)
 
   let v = document.createElement("video");
   document.body.appendChild(v);
 
   let finish = new EMEPromise;
 
   function onVideoEnded(ev) {
     ok(true, TimeStamp(token) + " (ENCRYPTED) content playback ended.");
-    v.removeEventListener("ended", onVideoEnded);
 
     function playClearVideo() {
-      var p1 = once(v, 'ended', (e) => {
-        ok(true, TimeStamp(token) + " (CLEAR) content playback ended.");
-        console.log(" bipbop.mp4 playback ended !!");
-      });
-      var p2 = once(v, 'loadeddata', (e) => {
+      var p1 = once(v, 'loadeddata', (e) => {
         ok(true, TimeStamp(token) + " Receiving event 'loadeddata' for (CLEAR) content.");
         canvasElem = document.createElement('canvas');
         document.body.appendChild(canvasElem);
         ctx2d = canvasElem.getContext('2d');
 
         var gotTypeError = false;
         try {
           ctx2d.drawImage(v, 0, 0);
@@ -57,37 +52,37 @@ function startTest(test, token)
           if (e instanceof TypeError) {
             gotTypeError = true;
           }
         }
         ok(!gotTypeError, TimeStamp(token) + " Canvas2D context drawImage succeed.")
       });
       v.src = 'bipbop_225w_175kbps.mp4';
       v.play();
-      Promise.all([p1, p2, closeSessions()]).then(() => {
+      Promise.all([p1]).then(() => {
         manager.finished(token);
       }, () => {
         ok(false, TimeStamp(token) + " Something wrong.");
         manager.finished(token);
       });
     }
 
-    Promise.all(sessions.map(s => s.close()))
+    closeSessions()
     .then(() => {
       v.setMediaKeys(null)
       .then(() => {
         ok(true, TimeStamp(token) + " Setting MediaKeys to null.");
         playClearVideo();
       }, () => {
         ok(false, TimeStamp(token) + " Setting MediaKeys to null.");
       });;
     });
   }
 
-  v.addEventListener("ended", onVideoEnded);
+  once(v, "ended", onVideoEnded);
 
   // Create a MediaKeys object and set to HTMLMediaElement then start the playback.
   Promise.all([
     LoadInitData(v, test, token),
     CreateAndSetMediaKeys(v, test, token),
     LoadTest(test, v, token)])
   .then(values => {
     let initData = values[0];