diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/media/tests/mochitest/test_peerConnection_addIceCandidate.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/media/tests/mochitest/test_peerConnection_addIceCandidate.html')
-rw-r--r-- | dom/media/tests/mochitest/test_peerConnection_addIceCandidate.html | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/dom/media/tests/mochitest/test_peerConnection_addIceCandidate.html b/dom/media/tests/mochitest/test_peerConnection_addIceCandidate.html new file mode 100644 index 000000000..93cbdd083 --- /dev/null +++ b/dom/media/tests/mochitest/test_peerConnection_addIceCandidate.html @@ -0,0 +1,103 @@ +<!DOCTYPE HTML> +<html> +<head> + <script type="application/javascript" src="pc.js"></script> +</head> +<body> +<pre id="test"> +<script type="application/javascript"> + createHTML({ + bug: "1087551", + title: "addIceCandidate behavior (local and remote) including invalid data" + }); + + var test; + runNetworkTest(function () { + test = new PeerConnectionTest(); + test.setMediaConstraints([{audio: true}], [{audio: true}]); + test.chain.removeAfter("PC_LOCAL_GET_ANSWER"); + + test.chain.insertAfter("PC_LOCAL_SET_LOCAL_DESCRIPTION", [ + function PC_LOCAL_ADD_CANDIDATE_EARLY(test) { + var candidate = new RTCIceCandidate( + {candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host", + sdpMLineIndex: 0}); + return test.pcLocal._pc.addIceCandidate(candidate).then( + generateErrorCallback("addIceCandidate should have failed."), + err => { + is(err.name, "InvalidStateError", "Error is InvalidStateError"); + }); + } + ]); + test.chain.insertAfter("PC_REMOTE_SET_LOCAL_DESCRIPTION", [ + function PC_REMOTE_ADD_CANDIDATE_INVALID_INDEX(test) { + var invalid_index = new RTCIceCandidate( + {candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host", + sdpMLineIndex: 2}); + return test.pcRemote._pc.addIceCandidate(invalid_index) + .then( + generateErrorCallback("addIceCandidate should have failed."), + err => { + is(err.name, "InvalidCandidateError", "Error is InvalidCandidateError"); + } + ); + }, + function PC_REMOTE_ADD_BOGUS_CANDIDATE(test) { + var bogus = new RTCIceCandidate( + {candidate:"Pony Lords, jump!", + sdpMLineIndex: 0}); + return test.pcRemote._pc.addIceCandidate(bogus) + .then( + generateErrorCallback("addIceCandidate should have failed."), + err => { + is(err.name, "InvalidCandidateError", "Error is InvalidCandidateError"); + } + ); + }, + function PC_REMOTE_ADD_CANDIDATE_MISSING_INDEX(test) { + // Note: it is probably not a good idea to automatically fill a missing + // MLineIndex with a default value of zero, see bug 1157034 + var broken = new RTCIceCandidate( + {candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host"}); + return test.pcRemote._pc.addIceCandidate(broken) + .then( + // FIXME this needs to be updated once bug 1157034 is fixed + todo(false, "Missing index in got automatically set to a valid value bz://1157034") + ); + }, + function PC_REMOTE_ADD_VALID_CANDIDATE(test) { + var candidate = new RTCIceCandidate( + {candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host", + sdpMLineIndex: 0}); + return test.pcRemote._pc.addIceCandidate(candidate) + .then(ok(true, "Successfully added valid ICE candidate")); + }, + // bug 1095793 + function PC_REMOTE_ADD_MISMATCHED_MID_AND_LEVEL_CANDIDATE(test) { + var bogus = new mozRTCIceCandidate( + {candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host", + sdpMLineIndex: 0, + sdpMid: "sdparta_1"}); + return test.pcRemote._pc.addIceCandidate(bogus) + .then( + generateErrorCallback("addIceCandidate should have failed."), + err => { + is(err.name, "InvalidCandidateError", "Error is InvalidCandidateError"); + } + ); + }, + function PC_REMOTE_ADD_MATCHING_MID_AND_LEVEL_CANDIDATE(test) { + var candidate = new mozRTCIceCandidate( + {candidate:"candidate:1 1 UDP 2130706431 192.168.2.1 50005 typ host", + sdpMLineIndex: 0, + sdpMid: "sdparta_0"}); + return test.pcRemote._pc.addIceCandidate(candidate) + .then(ok(true, "Successfully added valid ICE candidate with matching mid and level")); + } + ]); + test.run(); + }); +</script> +</pre> +</body> +</html> |