Bug 1296531 - Make sure test_pc_capturedVideo.html doesn't run out of source before connecting. r?jesup draft
authorAndreas Pehrson <pehrsons@gmail.com>
Mon, 15 May 2017 14:11:46 +0200
changeset 670321 9892de62719ee044ba78a800382f59bf5dc8a4b7
parent 670320 8ac143c27f43c7c49a8a5b479af7ccea7ad289cc
child 670322 e6f49f5fc579e0e28f6b820eba51511e234049b3
push id81598
push userbmo:apehrson@mozilla.com
push dateTue, 26 Sep 2017 09:13:19 +0000
reviewersjesup
bugs1296531
milestone58.0a1
Bug 1296531 - Make sure test_pc_capturedVideo.html doesn't run out of source before connecting. r?jesup MozReview-Commit-ID: EioemlMzYB7
dom/media/tests/mochitest/test_peerConnection_capturedVideo.html
--- a/dom/media/tests/mochitest/test_peerConnection_capturedVideo.html
+++ b/dom/media/tests/mochitest/test_peerConnection_capturedVideo.html
@@ -25,22 +25,23 @@ createHTML({
     resolve();
   };
 }))
 .catch(e => ok(false, "Unexpected " + e + ":\n" + e.stack));
 
 function startTest(media, token) {
   let manager = window.mediaTestManager;
   manager.started(token);
+  info("Starting test for " + media.name);
   var video = document.createElement('video');
   video.id = "id_" + media.name;
   video.width = 160;
   video.height = 120;
   video.muted = true;
-  video.loop = true;
+  video.controls = true;
   video.preload = "metadata";
   video.src = "../../test/" + media.name;
 
   document.getElementById("content").appendChild(video);
 
   var test;
   new Promise((resolve, reject) => {
     video.onloadedmetadata = resolve;
@@ -57,18 +58,22 @@ function startTest(media, token) {
       test.setOfferOptions({ offerToReceiveVideo: false,
                              offerToReceiveAudio: false });
       var hasVideo = stream.getVideoTracks().length > 0;
       var hasAudio = stream.getAudioTracks().length > 0;
       test.setMediaConstraints([{ video: hasVideo, audio: hasAudio }], []);
       test.chain.replace("PC_LOCAL_GUM", [
         function PC_LOCAL_CAPTUREVIDEO(test) {
           test.pcLocal.attachLocalStream(stream);
+        },
+      ]);
+      test.chain.insertBefore("PC_LOCAL_WAIT_FOR_MEDIA_FLOW", [
+        function PC_LOCAL_START_MEDIA(test) {
           video.play();
-        }
+        },
       ]);
       return test.chain.execute();
     });
   })
   // Handle both MediaErrors (with the `code` attribute) and other errors.
   .catch(e => ok(false, "Error (" + e + ")" +
                         (e.code ? " (code=" + e.code + ")" : "") +
                         " in test for " + media.name +