Bug 879717 - Part 4. Clean up test_peerConnection_capturedVideo.html's waiting for loadedmetadata r=jesup
☠☠ backed out by f9662e8dd46c ☠ ☠
authorAndreas Pehrson <pehrsons@gmail.com>
Fri, 19 Dec 2014 21:43:58 +0100
changeset 223493 f3b7db6c21647b9163d0548daf919052b2d7dc79
parent 223492 19432abcb3f147ceb08b4d40ee2638069fb89f60
child 223494 5426d449fa95114a750cc5c6439bcf60eaa7b37e
push id28095
push usercbook@mozilla.com
push dateTue, 13 Jan 2015 13:24:48 +0000
treeherdermozilla-central@a5700bec72e1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs879717
milestone38.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 879717 - Part 4. Clean up test_peerConnection_capturedVideo.html's waiting for loadedmetadata r=jesup
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
@@ -14,32 +14,32 @@
 <pre id="test">
 <script type="application/javascript;version=1.8">
   createHTML({
     bug: "1081409",
     title: "Captured video-only over peer connection",
     visible: true
   });
 
-  var domLoaded = new Promise(r => addEventListener("DOMContentLoaded", e => r()));
-  var test;
-  var stream;
-  var waitUntil = func => new Promise(resolve => {
-    var ival = setInterval(() => func() && resolve(clearInterval(ival)), 200);
+  var metadataLoaded = new Promise(resolve => {
+    if (v1.readyState < v1.HAVE_METADATA) {
+      v1.onloadedmetadata = e => resolve();
+      return;
+    }
+    resolve();
   });
 
   runNetworkTest(function() {
-    test = new PeerConnectionTest();
+    var test = new PeerConnectionTest();
     test.setOfferOptions({ offerToReceiveVideo: false,
                            offerToReceiveAudio: false });
     test.chain.insertAfter("PC_LOCAL_GUM", [["PC_LOCAL_CAPTUREVIDEO", function (test) {
-      domLoaded
-      .then(() => waitUntil(() => v1.videoWidth > 0)) // TODO: Bug 1096723
+      metadataLoaded
       .then(function() {
-        stream = v1.mozCaptureStreamUntilEnded();
+        var stream = v1.mozCaptureStreamUntilEnded();
         is(stream.getTracks().length, 2, "Captured stream has 2 tracks");
         stream.getTracks().forEach(tr => test.pcLocal._pc.addTrack(tr, stream));
         test.pcLocal.constraints = [{ video: true, audio:true }]; // fool tests
         test.next();
       })
       .catch(function(reason) {
         ok(false, "unexpected failure: " + reason);
         SimpleTest.finish();