diff --git a/dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html b/dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html index 95579a16ce6..ef9d04b4bea 100644 --- a/dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html +++ b/dom/media/tests/mochitest/test_peerConnection_addCandidateInHaveLocalOffer.html @@ -23,20 +23,18 @@ test.setMediaConstraints([{audio: true}], [{audio: true}]); test.chain.removeAfter("PC_LOCAL_SET_LOCAL_DESCRIPTION"); - test.chain.append([[ - "PC_LOCAL_ADD_CANDIDATE", - function (test) { - test.pcLocal.addIceCandidateAndFail( - new mozRTCIceCandidate( - {candidate:"1 1 UDP 2130706431 192.168.2.1 50005 typ host", - sdpMLineIndex: 1}), - function(err) { + test.chain.append([ + function PC_LOCAL_ADD_CANDIDATE(test) { + var candidate = new mozRTCIceCandidate( + {candidate:"1 1 UDP 2130706431 192.168.2.1 50005 typ host", + sdpMLineIndex: 1}); + return test.pcLocal._pc.addIceCandidate(candidate).then( + generateErrorCallback("addIceCandidate should have failed."), + err => { is(err.name, "InvalidStateError", "Error is InvalidStateError"); - test.next(); - } ); - } - ]]); - + }); + } + ]); test.run(); }); diff --git a/dom/media/tests/mochitest/test_peerConnection_addSecondAudioStream.html b/dom/media/tests/mochitest/test_peerConnection_addSecondAudioStream.html index dea87914f05..9b8a7295b5f 100644 --- a/dom/media/tests/mochitest/test_peerConnection_addSecondAudioStream.html +++ b/dom/media/tests/mochitest/test_peerConnection_addSecondAudioStream.html @@ -21,77 +21,40 @@ runNetworkTest(function (options) { test = new PeerConnectionTest(options); test.chain.append([ - [ - 'PC_LOCAL_SETUP_NEGOTIATION_CALLBACK', - function (test) { + function PC_LOCAL_SETUP_NEGOTIATION_CALLBACK(test) { test.pcLocal.onNegotiationneededFired = false; - test.pcLocal._pc.onnegotiationneeded = function (anEvent) { + test.pcLocal._pc.onnegotiationneeded = anEvent => { info("pcLocal.onnegotiationneeded fired"); test.pcLocal.onNegotiationneededFired = true; }; - test.next(); - } - ], - [ - 'PC_LOCAL_ADD_SECOND_STREAM', - function (test) { - test.pcLocal.getAllUserMedia([{audio: true}], function () { - test.next(); - }); - } - ], - [ - 'PC_LOCAL_CREATE_NEW_OFFER', - function (test) { + }, + function PC_LOCAL_ADD_SECOND_STREAM(test) { + return test.pcLocal.getAllUserMedia([{audio: true}]); + }, + function PC_LOCAL_CREATE_NEW_OFFER(test) { ok(test.pcLocal.onNegotiationneededFired, "onnegotiationneeded"); - test.createOffer(test.pcLocal, function (offer) { + return test.createOffer(test.pcLocal).then(offer => { test._new_offer = offer; - test.next(); }); - } - ], - [ - 'PC_LOCAL_SET_NEW_LOCAL_DESCRIPTION', - function (test) { - test.setLocalDescription(test.pcLocal, test._new_offer, HAVE_LOCAL_OFFER, function () { - test.next(); - }); - } - ], - [ - 'PC_REMOTE_SET_NEW_REMOTE_DESCRIPTION', - function (test) { - test.setRemoteDescription(test.pcRemote, test._new_offer, HAVE_REMOTE_OFFER, function () { - test.next(); - }); - } - ], - [ - 'PC_REMOTE_CREATE_NEW_ANSWER', - function (test) { - test.createAnswer(test.pcRemote, function (answer) { + }, + function PC_LOCAL_SET_NEW_LOCAL_DESCRIPTION(test) { + return test.setLocalDescription(test.pcLocal, test._new_offer, HAVE_LOCAL_OFFER); + }, + function PC_REMOTE_SET_NEW_REMOTE_DESCRIPTION(test) { + return test.setRemoteDescription(test.pcRemote, test._new_offer, HAVE_REMOTE_OFFER); + }, + function PC_REMOTE_CREATE_NEW_ANSWER(test) { + return test.createAnswer(test.pcRemote).then(answer => { test._new_answer = answer; - test.next(); }); + }, + function PC_REMOTE_SET_NEW_LOCAL_DESCRIPTION(test) { + return test.setLocalDescription(test.pcRemote, test._new_answer, STABLE); + }, + function PC_LOCAL_SET_NEW_REMOTE_DESCRIPTION(test) { + return test.setRemoteDescription(test.pcLocal, test._new_answer, STABLE); } - ], - [ - 'PC_REMOTE_SET_NEW_LOCAL_DESCRIPTION', - function (test) { - test.setLocalDescription(test.pcRemote, test._new_answer, STABLE, function () { - test.next(); - }); - } - ], - [ - 'PC_LOCAL_SET_NEW_REMOTE_DESCRIPTION', - function (test) { - test.setRemoteDescription(test.pcLocal, test._new_answer, STABLE, function () { - test.next(); - }); - } - ] - // TODO(bug 1093835): figure out how to verify if media flows through the new stream + // TODO(bug 1093835): figure out how to verify if media flows through the new stream ]); test.setMediaConstraints([{audio: true}], [{audio: true}]); test.run(); diff --git a/dom/media/tests/mochitest/test_peerConnection_basicAudioVideoNoBundle.html b/dom/media/tests/mochitest/test_peerConnection_basicAudioVideoNoBundle.html index 328e9f46b07..fe5f031f3be 100644 --- a/dom/media/tests/mochitest/test_peerConnection_basicAudioVideoNoBundle.html +++ b/dom/media/tests/mochitest/test_peerConnection_basicAudioVideoNoBundle.html @@ -22,17 +22,17 @@ var test; runNetworkTest(function (options) { test = new PeerConnectionTest(options); - test.chain.insertAfter('PC_LOCAL_CREATE_OFFER', - [['PC_LOCAL_REMOVE_BUNDLE_FROM_OFFER', - function (test) { - test.originalOffer.sdp = test.originalOffer.sdp.replace( - /a=group:BUNDLE .*\r\n/g, - "" - ); - info("Updated no bundle offer: " + JSON.stringify(test.originalOffer)); - test.next(); - } - ]]); + test.chain.insertAfter( + 'PC_LOCAL_CREATE_OFFER', + [ + function PC_LOCAL_REMOVE_BUNDLE_FROM_OFFER(test) { + test.originalOffer.sdp = test.originalOffer.sdp.replace( + /a=group:BUNDLE .*\r\n/g, + "" + ); + info("Updated no bundle offer: " + JSON.stringify(test.originalOffer)); + } + ]); test.setMediaConstraints([{audio: true}, {video: true}], [{audio: true}, {video: true}]); test.run(); diff --git a/dom/media/tests/mochitest/test_peerConnection_bug1042791.html b/dom/media/tests/mochitest/test_peerConnection_bug1042791.html index d82421e9112..5086647e222 100644 --- a/dom/media/tests/mochitest/test_peerConnection_bug1042791.html +++ b/dom/media/tests/mochitest/test_peerConnection_bug1042791.html @@ -25,16 +25,14 @@ test.setMediaConstraints([{video: true}], [{video: true}]); test.chain.removeAfter("PC_LOCAL_CREATE_OFFER"); - test.chain.append([[ - "PC_LOCAL_VERIFY_H264_OFFER", - function (test) { + test.chain.append([ + function PC_LOCAL_VERIFY_H264_OFFER(test) { ok(!test.pcLocal._latest_offer.sdp.toLowerCase().contains("profile-level-id=0x42e0"), - "H264 offer does not contain profile-level-id=0x42e0"); + "H264 offer does not contain profile-level-id=0x42e0"); ok(test.pcLocal._latest_offer.sdp.toLowerCase().contains("profile-level-id=42e0"), - "H264 offer contains profile-level-id=42e0"); - test.next(); + "H264 offer contains profile-level-id=42e0"); } - ]]); + ]); test.run(); }); diff --git a/dom/media/tests/mochitest/test_peerConnection_bug827843.html b/dom/media/tests/mochitest/test_peerConnection_bug827843.html index 5928d6002d1..8bcd757a1f9 100644 --- a/dom/media/tests/mochitest/test_peerConnection_bug827843.html +++ b/dom/media/tests/mochitest/test_peerConnection_bug827843.html @@ -16,56 +16,59 @@ title: "Ensure that localDescription and remoteDescription are null after close" }); - var steps = [ - [ - "CHECK_SDP_ON_CLOSED_PC", - function (test) { - var description; - var exception = null; +var steps = [ + function CHECK_SDP_ON_CLOSED_PC(test) { + var description; + var exception = null; - // handle the event which the close() triggers - test.pcLocal.onsignalingstatechange = function (e) { - is(e.target.signalingState, "closed", - "Received expected onsignalingstatechange event on 'closed'"); - } - - test.pcLocal.close(); - - try { description = test.pcLocal.localDescription; } catch (e) { exception = e; } - ok(exception, "Attempt to access localDescription of pcLocal after close throws exception"); - exception = null; - - try { description = test.pcLocal.remoteDescription; } catch (e) { exception = e; } - ok(exception, "Attempt to access remoteDescription of pcLocal after close throws exception"); - exception = null; - - // handle the event which the close() triggers - test.pcRemote.onsignalingstatechange = function (e) { - is(e.target.signalingState, "closed", - "Received expected onsignalingstatechange event on 'closed'"); - } - - test.pcRemote.close(); - - try { description = test.pcRemote.localDescription; } catch (e) { exception = e; } - ok(exception, "Attempt to access localDescription of pcRemote after close throws exception"); - exception = null; - - try { description = test.pcRemote.remoteDescription; } catch (e) { exception = e; } - ok(exception, "Attempt to access remoteDescription of pcRemote after close throws exception"); - - test.next(); + // handle the event which the close() triggers + var localClosed = new Promise(resolve => { + test.pcLocal.onsignalingstatechange = e => { + is(e.target.signalingState, "closed", + "Received expected onsignalingstatechange event on 'closed'"); + resolve(); } - ] - ]; + }); - var test; - runNetworkTest(function () { - test = new PeerConnectionTest(); - test.setMediaConstraints([{audio: true}], [{audio: true}]); - test.chain.append(steps); - test.run(); - }); + test.pcLocal.close(); + + try { description = test.pcLocal.localDescription; } catch (e) { exception = e; } + ok(exception, "Attempt to access localDescription of pcLocal after close throws exception"); + exception = null; + + try { description = test.pcLocal.remoteDescription; } catch (e) { exception = e; } + ok(exception, "Attempt to access remoteDescription of pcLocal after close throws exception"); + exception = null; + + // handle the event which the close() triggers + var remoteClosed = new Promise(resolve => { + test.pcRemote.onsignalingstatechange = e => { + is(e.target.signalingState, "closed", + "Received expected onsignalingstatechange event on 'closed'"); + resolve(); + } + }); + + test.pcRemote.close(); + + try { description = test.pcRemote.localDescription; } catch (e) { exception = e; } + ok(exception, "Attempt to access localDescription of pcRemote after close throws exception"); + exception = null; + + try { description = test.pcRemote.remoteDescription; } catch (e) { exception = e; } + ok(exception, "Attempt to access remoteDescription of pcRemote after close throws exception"); + + return Promise.all([localClosed, remoteClosed]); + } +]; + +var test; +runNetworkTest(() => { + test = new PeerConnectionTest(); + test.setMediaConstraints([{audio: true}], [{audio: true}]); + test.chain.append(steps); + test.run(); +}); diff --git a/dom/media/tests/mochitest/test_peerConnection_capturedVideo.html b/dom/media/tests/mochitest/test_peerConnection_capturedVideo.html index 423cdb2cfc5..b1ca370a142 100644 --- a/dom/media/tests/mochitest/test_peerConnection_capturedVideo.html +++ b/dom/media/tests/mochitest/test_peerConnection_capturedVideo.html @@ -19,36 +19,32 @@ visible: true }); - var metadataLoaded = new Promise(resolve => { - if (v1.readyState < v1.HAVE_METADATA) { - v1.onloadedmetadata = e => resolve(); - return; - } +var metadataLoaded = new Promise(resolve => { + if (v1.readyState < v1.HAVE_METADATA) { + v1.onloadedmetadata = resolve; + } else { resolve(); - }); + } +}); - runNetworkTest(function() { - var test = new PeerConnectionTest(); - test.setOfferOptions({ offerToReceiveVideo: false, - offerToReceiveAudio: false }); - test.chain.insertAfter("PC_LOCAL_GUM", [["PC_LOCAL_CAPTUREVIDEO", function (test) { - metadataLoaded - .then(function() { - 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(); - }); +runNetworkTest(function() { + var test = new PeerConnectionTest(); + test.setOfferOptions({ offerToReceiveVideo: false, + offerToReceiveAudio: false }); + test.chain.insertAfter("PC_LOCAL_GUM", [ + function PC_LOCAL_CAPTUREVIDEO(test) { + return metadataLoaded + .then(() => { + 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.chain.removeAfter("PC_REMOTE_CHECK_MEDIA_FLOW_PRESENT"); - test.run(); - }); + ]); + test.chain.removeAfter("PC_REMOTE_CHECK_MEDIA_FLOW_PRESENT"); + test.run(); +}); diff --git a/dom/media/tests/mochitest/test_peerConnection_replaceTrack.html b/dom/media/tests/mochitest/test_peerConnection_replaceTrack.html index 5cd88c1d664..4f7f7f2e980 100644 --- a/dom/media/tests/mochitest/test_peerConnection_replaceTrack.html +++ b/dom/media/tests/mochitest/test_peerConnection_replaceTrack.html @@ -31,27 +31,23 @@ test.chain.removeAfter("PC_REMOTE_CHECK_MEDIA_FLOW_PRESENT"); var flowtest = test.chain.remove("PC_REMOTE_CHECK_MEDIA_FLOW_PRESENT"); test.chain.append(flowtest); - test.chain.append([["PC_LOCAL_REPLACE_VIDEOTRACK", - function (test) { + test.chain.append([ + function PC_LOCAL_REPLACE_VIDEOTRACK(test) { var stream = test.pcLocal._pc.getLocalStreams()[0]; var track = stream.getVideoTracks()[0]; var sender = test.pcLocal._pc.getSenders().find(isSenderOfTrack, track); ok(sender, "track has a sender"); var newtrack; - navigator.mediaDevices.getUserMedia({video:true, fake: true}) - .then(function(newStream) { - newtrack = newStream.getVideoTracks()[0]; - return sender.replaceTrack(newtrack); - }) - .then(function() { - is(sender.track, newtrack, "sender.track has been replaced"); - }) - .catch(function(reason) { - ok(false, "unexpected error = " + reason.message); - }) - .then(test.next.bind(test)); + return navigator.mediaDevices.getUserMedia({video:true, fake: true}) + .then(newStream => { + newtrack = newStream.getVideoTracks()[0]; + return sender.replaceTrack(newtrack); + }) + .then(() => { + is(sender.track, newtrack, "sender.track has been replaced"); + }); } - ]]); + ]); test.chain.append(flowtest); test.run(); diff --git a/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInHaveLocalOffer.html b/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInHaveLocalOffer.html index 5caa0293903..f3c2af34edc 100644 --- a/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInHaveLocalOffer.html +++ b/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInHaveLocalOffer.html @@ -17,26 +17,24 @@ title: "setLocalDescription (answer) in 'have-local-offer'" }); - var test; - runNetworkTest(function () { - test = new PeerConnectionTest(); - test.setMediaConstraints([{audio: true}], [{audio: true}]); - test.chain.removeAfter("PC_LOCAL_SET_LOCAL_DESCRIPTION"); +var test; +runNetworkTest(function () { + test = new PeerConnectionTest(); + test.setMediaConstraints([{audio: true}], [{audio: true}]); + test.chain.removeAfter("PC_LOCAL_SET_LOCAL_DESCRIPTION"); - test.chain.append([[ - "PC_LOCAL_SET_LOCAL_ANSWER", - function (test) { - test.pcLocal._latest_offer.type="answer"; - test.pcLocal.setLocalDescriptionAndFail(test.pcLocal._latest_offer, - function(err) { - is(err.name, "InvalidStateError", "Error is InvalidStateError"); - test.next(); - } ); - } - ]]); + test.chain.append([ + function PC_LOCAL_SET_LOCAL_ANSWER(test) { + test.pcLocal._latest_offer.type = "answer"; + return test.pcLocal.setLocalDescriptionAndFail(test.pcLocal._latest_offer) + .then(err => { + is(err.name, "InvalidStateError", "Error is InvalidStateError"); + }); + } + ]); - test.run(); - }); + test.run(); +}); diff --git a/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInStable.html b/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInStable.html index f31f2a7087e..f0bb4a2b197 100644 --- a/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInStable.html +++ b/dom/media/tests/mochitest/test_peerConnection_setLocalAnswerInStable.html @@ -17,26 +17,24 @@ title: "setLocalDescription (answer) in 'stable'" }); - var test; - runNetworkTest(function () { - test = new PeerConnectionTest(); - test.setMediaConstraints([{audio: true}], [{audio: true}]); - test.chain.removeAfter("PC_LOCAL_CREATE_OFFER"); +var test; +runNetworkTest(function () { + test = new PeerConnectionTest(); + test.setMediaConstraints([{audio: true}], [{audio: true}]); + test.chain.removeAfter("PC_LOCAL_CREATE_OFFER"); - test.chain.append([[ - "PC_LOCAL_SET_LOCAL_ANSWER", - function (test) { - test.pcLocal._latest_offer.type="answer"; - test.pcLocal.setLocalDescriptionAndFail(test.pcLocal._latest_offer, - function(err) { - is(err.name, "InvalidStateError", "Error is InvalidStateError"); - test.next(); - } ); - } - ]]); + test.chain.append([ + function PC_LOCAL_SET_LOCAL_ANSWER(test) { + test.pcLocal._latest_offer.type = "answer"; + return test.pcLocal.setLocalDescriptionAndFail(test.pcLocal._latest_offer) + .then(err => { + is(err.name, "InvalidStateError", "Error is InvalidStateError"); + }); + } + ]); - test.run(); - }); + test.run(); +}); diff --git a/dom/media/tests/mochitest/test_peerConnection_setLocalOfferInHaveRemoteOffer.html b/dom/media/tests/mochitest/test_peerConnection_setLocalOfferInHaveRemoteOffer.html index 24234280350..00e245f1133 100644 --- a/dom/media/tests/mochitest/test_peerConnection_setLocalOfferInHaveRemoteOffer.html +++ b/dom/media/tests/mochitest/test_peerConnection_setLocalOfferInHaveRemoteOffer.html @@ -17,25 +17,23 @@ title: "setLocalDescription (offer) in 'have-remote-offer'" }); - var test; - runNetworkTest(function () { - test = new PeerConnectionTest(); - test.setMediaConstraints([{audio: true}], [{audio: true}]); - test.chain.removeAfter("PC_REMOTE_SET_REMOTE_DESCRIPTION"); +var test; +runNetworkTest(function () { + test = new PeerConnectionTest(); + test.setMediaConstraints([{audio: true}], [{audio: true}]); + test.chain.removeAfter("PC_REMOTE_SET_REMOTE_DESCRIPTION"); - test.chain.append([[ - "PC_REMOTE_SET_LOCAL_OFFER", - function (test) { - test.pcRemote.setLocalDescriptionAndFail(test.pcLocal._latest_offer, - function(err) { - is(err.name, "InvalidStateError", "Error is InvalidStateError"); - test.next(); - } ); - } - ]]); + test.chain.append([ + function PC_REMOTE_SET_LOCAL_OFFER(test) { + test.pcRemote.setLocalDescriptionAndFail(test.pcLocal._latest_offer) + .then(err => { + is(err.name, "InvalidStateError", "Error is InvalidStateError"); + }); + } + ]); - test.run(); - }); + test.run(); +}); diff --git a/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html b/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html index 75b2ffea49a..02135596b4a 100644 --- a/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html +++ b/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInHaveRemoteOffer.html @@ -17,26 +17,24 @@ title: "setRemoteDescription (answer) in 'have-remote-offer'" }); - var test; - runNetworkTest(function () { - test = new PeerConnectionTest(); - test.setMediaConstraints([{audio: true}], [{audio: true}]); - test.chain.removeAfter("PC_REMOTE_SET_REMOTE_DESCRIPTION"); +var test; +runNetworkTest(function () { + test = new PeerConnectionTest(); + test.setMediaConstraints([{audio: true}], [{audio: true}]); + test.chain.removeAfter("PC_REMOTE_SET_REMOTE_DESCRIPTION"); - test.chain.append([[ - "PC_REMOTE_SET_REMOTE_ANSWER", - function (test) { - test.pcLocal._latest_offer.type="answer"; - test.pcRemote.setRemoteDescriptionAndFail(test.pcLocal._latest_offer, - function(err) { - is(err.name, "InvalidStateError", "Error is InvalidStateError"); - test.next(); - } ); - } - ]]); + test.chain.append([ + function PC_REMOTE_SET_REMOTE_ANSWER(test) { + test.pcLocal._latest_offer.type = "answer"; + test.pcRemote._pc.setRemoteDescription(test.pcLocal._latest_offer) + .then(generateErrorCallback('setRemoteDescription should fail'), + err => + is(err.name, "InvalidStateError", "Error is InvalidStateError")); + } + ]); - test.run(); - }); + test.run(); +}); diff --git a/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInStable.html b/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInStable.html index d6face27a21..a5937967bae 100644 --- a/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInStable.html +++ b/dom/media/tests/mochitest/test_peerConnection_setRemoteAnswerInStable.html @@ -17,26 +17,24 @@ title: "setRemoteDescription (answer) in 'stable'" }); - var test; - runNetworkTest(function () { - test = new PeerConnectionTest(); - test.setMediaConstraints([{audio: true}], [{audio: true}]); - test.chain.removeAfter("PC_LOCAL_CREATE_OFFER"); +var test; +runNetworkTest(function () { + test = new PeerConnectionTest(); + test.setMediaConstraints([{audio: true}], [{audio: true}]); + test.chain.removeAfter("PC_LOCAL_CREATE_OFFER"); - test.chain.append([[ - "PC_LOCAL_SET_REMOTE_ANSWER", - function (test) { - test.pcLocal._latest_offer.type="answer"; - test.pcLocal.setRemoteDescriptionAndFail(test.pcLocal._latest_offer, - function(err) { - is(err.name, "InvalidStateError", "Error is InvalidStateError"); - test.next(); - } ); - } - ]]); + test.chain.append([ + function PC_LOCAL_SET_REMOTE_ANSWER(test) { + test.pcLocal._latest_offer.type = "answer"; + test.pcLocal._pc.setRemoteDescription(test.pcLocal._latest_offer) + .then(generateErrorCallback('setRemoteDescription should fail'), + err => + is(err.name, "InvalidStateError", "Error is InvalidStateError")); + } + ]); - test.run(); - }); + test.run(); +}); diff --git a/dom/media/tests/mochitest/test_peerConnection_setRemoteOfferInHaveLocalOffer.html b/dom/media/tests/mochitest/test_peerConnection_setRemoteOfferInHaveLocalOffer.html index e62427c2e12..e9ada0f9f47 100644 --- a/dom/media/tests/mochitest/test_peerConnection_setRemoteOfferInHaveLocalOffer.html +++ b/dom/media/tests/mochitest/test_peerConnection_setRemoteOfferInHaveLocalOffer.html @@ -17,25 +17,23 @@ title: "setRemoteDescription (offer) in 'have-local-offer'" }); - var test; - runNetworkTest(function () { - test = new PeerConnectionTest(); - test.setMediaConstraints([{audio: true}], [{audio: true}]); - test.chain.removeAfter("PC_LOCAL_SET_LOCAL_DESCRIPTION"); +var test; +runNetworkTest(function () { + test = new PeerConnectionTest(); + test.setMediaConstraints([{audio: true}], [{audio: true}]); + test.chain.removeAfter("PC_LOCAL_SET_LOCAL_DESCRIPTION"); - test.chain.append([[ - "PC_LOCAL_SET_REMOTE_OFFER", - function (test) { - test.pcLocal.setRemoteDescriptionAndFail(test.pcLocal._latest_offer, - function(err) { - is(err.name, "InvalidStateError", "Error is InvalidStateError"); - test.next(); - } ); - } - ]]); + test.chain.append([ + function PC_LOCAL_SET_REMOTE_OFFER(test) { + test.pcLocal._pc.setRemoteDescription(test.pcLocal._latest_offer) + .then(generateErrorCallback('setRemoteDescription should fail'), + err => + is(err.name, "InvalidStateError", "Error is InvalidStateError")); + } + ]); - test.run(); - }); + test.run(); +}); diff --git a/dom/media/tests/mochitest/test_peerConnection_syncSetDescription.html b/dom/media/tests/mochitest/test_peerConnection_syncSetDescription.html index 69274227b5d..d91be41a1ea 100644 --- a/dom/media/tests/mochitest/test_peerConnection_syncSetDescription.html +++ b/dom/media/tests/mochitest/test_peerConnection_syncSetDescription.html @@ -18,62 +18,40 @@ visible: true }); - // Test setDescription without callbacks, which many webrtc examples still do +// Test setDescription without callbacks, which many webrtc examples still do - var pc1_local = - [[ - 'PC_LOCAL_SET_LOCAL_DESCRIPTION_SYNC', - function (test) { - test.pcLocal.onsignalingstatechange = function() {}; - test.pcLocal.setLocalDescription(test.originalOffer); - test.next(); - } - ]]; +function PC_LOCAL_SET_LOCAL_DESCRIPTION_SYNC(test) { + test.pcLocal.onsignalingstatechange = function() {}; + test.pcLocal._pc.setLocalDescription(test.originalOffer); +} - var pc2_remote = - [[ - 'PC_REMOTE_SET_REMOTE_DESCRIPTION_SYNC', - function (test) { - test.pcRemote.onsignalingstatechange = function() {}; - test.pcRemote.setRemoteDescription(test._local_offer); - test.next(); - } - ]]; +function PC_REMOTE_SET_REMOTE_DESCRIPTION_SYNC(test) { + test.pcRemote.onsignalingstatechange = function() {}; + test.pcRemote._pc.setRemoteDescription(test._local_offer); +} +function PC_REMOTE_SET_LOCAL_DESCRIPTION_SYNC(test) { + test.pcRemote.onsignalingstatechange = function() {}; + test.pcRemote._pc.setLocalDescription(test.originalAnswer); +} +function PC_LOCAL_SET_REMOTE_DESCRIPTION_SYNC(test) { + test.pcLocal.onsignalingstatechange = function() {}; + test.pcLocal._pc.setRemoteDescription(test._remote_answer); +} - var pc2_local = - [[ - 'PC_REMOTE_SET_LOCAL_DESCRIPTION_SYNC', - function (test) { - test.pcRemote.onsignalingstatechange = function() {}; - test.pcRemote.setLocalDescription(test.originalAnswer); - test.next(); - } - ]]; +runNetworkTest(() => { + var replace = (test, name, command) => { + test.chain.insertAfter(name, command); + test.chain.remove(name); + } - var pc1_remote = - [[ - 'PC_LOCAL_SET_REMOTE_DESCRIPTION_SYNC', - function (test) { - test.pcLocal.onsignalingstatechange = function() {}; - test.pcLocal.setRemoteDescription(test._remote_answer); - test.next(); - } - ]]; - - runNetworkTest(function () { - function replace(test, name, command) { - test.chain.insertAfter(name, command); - test.chain.remove(name); - } - - var test = new PeerConnectionTest(); - test.setMediaConstraints([{video: true}], [{video: true}]); - replace(test, "PC_LOCAL_SET_LOCAL_DESCRIPTION", pc1_local); - replace(test, "PC_REMOTE_SET_REMOTE_DESCRIPTION", pc2_remote); - replace(test, "PC_REMOTE_SET_LOCAL_DESCRIPTION", pc2_local); - replace(test, "PC_LOCAL_SET_REMOTE_DESCRIPTION", pc1_remote); - test.run(); - }); + var test = new PeerConnectionTest(); + test.setMediaConstraints([{video: true}], [{video: true}]); + test.chain.replace(test, "PC_LOCAL_SET_LOCAL_DESCRIPTION", PC_LOCAL_SET_LOCAL_DESCRIPTION_SYNC); + test.chain.replace(test, "PC_REMOTE_SET_REMOTE_DESCRIPTION", PC_REMOTE_SET_REMOTE_DESCRIPTION_SYNC); + test.chain.replace(test, "PC_REMOTE_SET_LOCAL_DESCRIPTION", PC_REMOTE_SET_LOCAL_DESCRIPTION_SYNC); + test.chain.replace(test, "PC_LOCAL_SET_REMOTE_DESCRIPTION", PC_LOCAL_SET_REMOTE_DESCRIPTION_SYNC); + test.run(); +}); diff --git a/dom/media/tests/mochitest/test_peerConnection_toJSON.html b/dom/media/tests/mochitest/test_peerConnection_toJSON.html index ae654ab6b9d..ce53d09d166 100644 --- a/dom/media/tests/mochitest/test_peerConnection_toJSON.html +++ b/dom/media/tests/mochitest/test_peerConnection_toJSON.html @@ -29,9 +29,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=872377 if (typeof(rtcSession[key]) == "function") continue; is(rtcSession[key], jsonCopy[key], "key " + key + " should match."); } - + /** Test for Bug 928304 **/ - + var rtcIceCandidate = new mozRTCIceCandidate({ candidate: "dummy", sdpMid: "test", sdpMLineIndex: 3 });