зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1119593 - Update PeerConnection tests, r=drno,jib
--HG-- extra : rebase_source : 40253388a45a89e0d85ba538ba694ebf07454046
This commit is contained in:
Родитель
b0cb911e78
Коммит
bae5192e6e
|
@ -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();
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -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();
|
||||
});
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
|
|
@ -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 });
|
||||
|
|
Загрузка…
Ссылка в новой задаче