| <title>Ensuring ICE UDP candidates have a valid port</title> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| function gatherCandidates(pc) |
| return new Promise((resolve, reject) => { |
| pc.onicecandidate = (event) => { |
| if (event.candidate === null) { |
| candidates.push(event.candidate.candidate); |
| pc.createOffer().then((offer) => { |
| pc.setLocalDescription(offer); |
| var pc = new RTCPeerConnection(); |
| pc.createDataChannel(""); |
| var hasCandidate = false; |
| return gatherCandidates(pc).then((candidates) => { |
| for(candidate of candidates) { |
| if (candidate.toLowerCase().indexOf(" udp ") === -1) |
| items = candidate.split(" "); |
| var port = parseInt(items[5]); |
| assert_true(port > 1024, "port is expected to be above 1024 but was " + port); |
| assert_true(hasCandidate, "Candidates should be gathered"); |
| }, "Checking UDP ICE candidate ports"); |