Bug 879717 - Part 4. Clean up

From 16c169589b8a0e47ef3c0816e30547ee6e07fa36 Mon Sep 17 00:00:00 2001
 test_peerConnection_capturedVideo.html's waiting for loadedmetadata. r=jesup
---
 .../mochitest/test_peerConnection_capturedVideo.html   | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
This commit is contained in:
Andreas Pehrson 2014-12-19 21:43:58 +01:00
parent be4f14cc59
commit 39b048dc86

View File

@ -19,22 +19,22 @@
visible: true visible: true
}); });
var domLoaded = new Promise(r => addEventListener("DOMContentLoaded", e => r())); var metadataLoaded = new Promise(resolve => {
var test; if (v1.readyState < v1.HAVE_METADATA) {
var stream; v1.onloadedmetadata = e => resolve();
var waitUntil = func => new Promise(resolve => { return;
var ival = setInterval(() => func() && resolve(clearInterval(ival)), 200); }
resolve();
}); });
runNetworkTest(function() { runNetworkTest(function() {
test = new PeerConnectionTest(); var test = new PeerConnectionTest();
test.setOfferOptions({ offerToReceiveVideo: false, test.setOfferOptions({ offerToReceiveVideo: false,
offerToReceiveAudio: false }); offerToReceiveAudio: false });
test.chain.insertAfter("PC_LOCAL_GUM", [["PC_LOCAL_CAPTUREVIDEO", function (test) { test.chain.insertAfter("PC_LOCAL_GUM", [["PC_LOCAL_CAPTUREVIDEO", function (test) {
domLoaded metadataLoaded
.then(() => waitUntil(() => v1.videoWidth > 0)) // TODO: Bug 1096723
.then(function() { .then(function() {
stream = v1.mozCaptureStreamUntilEnded(); var stream = v1.mozCaptureStreamUntilEnded();
is(stream.getTracks().length, 2, "Captured stream has 2 tracks"); is(stream.getTracks().length, 2, "Captured stream has 2 tracks");
stream.getTracks().forEach(tr => test.pcLocal._pc.addTrack(tr, stream)); stream.getTracks().forEach(tr => test.pcLocal._pc.addTrack(tr, stream));
test.pcLocal.constraints = [{ video: true, audio:true }]; // fool tests test.pcLocal.constraints = [{ video: true, audio:true }]; // fool tests