Bug 1535442 - Part 2: Fix some test-cases for addIceCandidate. r=jib

Differential Revision: https://phabricator.services.mozilla.com/D24276

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Byron Campen [:bwc] 2019-03-26 17:40:49 +00:00
Родитель 282d145fb1
Коммит 4770090a2f
1 изменённых файлов: 16 добавлений и 13 удалений

Просмотреть файл

@ -176,12 +176,15 @@ a=rtcp-rsize
t.add_cleanup(() => pc.close());
await pc.setRemoteDescription(sessionDesc);
await pc.addIceCandidate({usernameFragment: usernameFragment1});
await pc.addIceCandidate({
usernameFragment: usernameFragment1,
sdpMid: sdpMid1
});
assert_candidate_line_between(pc.remoteDescription.sdp,
mediaLine1, endOfCandidateLine, mediaLine2);
assert_false(is_candidate_line_after(pc.remoteDescription.sdp,
mediaLine2, endOfCandidateLine));
}, 'addIceCandidate({usernameFragment: usernameFragment1}) should work, and add a=end-of-candidates to the first m-section');
}, 'addIceCandidate({usernameFragment: usernameFragment1, sdpMid: sdpMid1}) should work, and add a=end-of-candidates to the first m-section');
promise_test(async t => {
const pc = new RTCPeerConnection();
@ -189,12 +192,15 @@ a=rtcp-rsize
t.add_cleanup(() => pc.close());
await pc.setRemoteDescription(sessionDesc);
await pc.addIceCandidate({usernameFragment: usernameFragment2});
await pc.addIceCandidate({
usernameFragment: usernameFragment2,
sdpMLineIndex: 1
});
assert_false(is_candidate_line_between(pc.remoteDescription.sdp,
mediaLine1, endOfCandidateLine, mediaLine2));
assert_true(is_candidate_line_after(pc.remoteDescription.sdp,
mediaLine2, endOfCandidateLine));
}, 'addIceCandidate({usernameFragment: usernameFragment2}) should work, and add a=end-of-candidates to the first m-section');
}, 'addIceCandidate({usernameFragment: usernameFragment2, sdpMLineIndex: 1}) should work, and add a=end-of-candidates to the first m-section');
promise_test(async t => {
const pc = new RTCPeerConnection();
@ -202,12 +208,9 @@ a=rtcp-rsize
t.add_cleanup(() => pc.close());
await pc.setRemoteDescription(sessionDesc);
await pc.addIceCandidate({usernameFragment: "no such ufrag"});
assert_false(is_candidate_line_between(pc.remoteDescription.sdp,
mediaLine1, endOfCandidateLine, mediaLine2));
assert_false(is_candidate_line_after(pc.remoteDescription.sdp,
mediaLine2, endOfCandidateLine));
}, 'addIceCandidate({usernameFragment: "no such ufrag"}) should work, but not add a=end-of-candidates');
await promise_rejects(t, 'OperationError',
pc.addIceCandidate({usernameFragment: "no such ufrag"}));
}, 'addIceCandidate({usernameFragment: "no such ufrag"}) should not work');
promise_test(t => {
const pc = new RTCPeerConnection();
@ -316,7 +319,7 @@ a=rtcp-rsize
candidate: candidateStr1,
sdpMid: sdpMid1,
sdpMLineIndex: sdpMLineIndex1,
ufrag: null
usernameFragment: null
}))
.then(() => {
assert_candidate_line_between(pc.remoteDescription.sdp,
@ -539,7 +542,7 @@ a=rtcp-rsize
candidate: candidateStr1,
sdpMid: sdpMid1,
sdpMLineIndex: sdpMLineIndex1,
ufrag: 'invalid'
usernameFragment: 'invalid'
})));
}, 'Add candidate with invalid usernameFragment should reject with OperationError');
@ -578,7 +581,7 @@ a=rtcp-rsize
candidate: candidateStr2,
sdpMid: sdpMid2,
sdpMLineIndex: sdpMLineIndex2,
usernameFragement: usernameFragment1
usernameFragment: usernameFragment1
})));
}, 'Add candidate with sdpMid belonging to different usernameFragment should reject with OperationError');