Skip to content

Commit

Permalink
Reland "webrtc: update addIceCandidate() call to match spec"
Browse files Browse the repository at this point in the history
This is a reland of ffc43d7a95f6b7843b3e476ab92bad05c8da669a
that also removes the (RTCIceCandidateInit or RTCIceCandidate) union
and the generated files from the build.

Original change's description:
> webrtc: update addIceCandidate() call to match spec
>
> see https://w3c.github.io/webrtc-pc/#interface-definition
> This allows addIceCandidate() as end-of-candidates indication. This is
> not yet implemented at the native layer.
>
> BUG=chromium:978582
>
> Change-Id: Id0f2acd2dcfdf4f5d311437df22c178c9d69630d
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2680823
> Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
> Reviewed-by: Guido Urdaneta <guidou@chromium.org>
> Reviewed-by: Harald Alvestrand <hta@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#852128}

Bug: chromium:978582
Change-Id: I889523b80b5a945efddf012d53c3a75d62b98f62
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2684254
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Harald Alvestrand <hta@chromium.org>
Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
Cr-Commit-Position: refs/heads/master@{#853142}
  • Loading branch information
fippo authored and chromium-wpt-export-bot committed Feb 11, 2021
1 parent f6ace0d commit 42e11fb
Showing 1 changed file with 30 additions and 12 deletions.
42 changes: 30 additions & 12 deletions webrtc/RTCPeerConnection-addIceCandidate.html
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,28 @@
null,
// Members in the dictionary take their default values
{}
].forEach(init => promise_test(async t => {
const pc = new RTCPeerConnection();
].forEach(init => {
promise_test(async t => {
const pc = new RTCPeerConnection();

t.add_cleanup(() => pc.close());
t.add_cleanup(() => pc.close());

await pc.setRemoteDescription(sessionDesc);
await pc.addIceCandidate(init);
assert_candidate_line_between(pc.remoteDescription.sdp,
mediaLine1, endOfCandidateLine, mediaLine2);
assert_candidate_line_after(pc.remoteDescription.sdp,
mediaLine2, endOfCandidateLine);
}, `addIceCandidate(${JSON.stringify(init)}) should work, and add a=end-of-candidates to both m-sections`));
await pc.setRemoteDescription(sessionDesc);
await pc.addIceCandidate(init);
}, `addIceCandidate(${JSON.stringify(init)}) works`);
promise_test(async t => {
const pc = new RTCPeerConnection();

t.add_cleanup(() => pc.close());

await pc.setRemoteDescription(sessionDesc);
await pc.addIceCandidate(init);
assert_candidate_line_between(pc.remoteDescription.sdp,
mediaLine1, endOfCandidateLine, mediaLine2);
assert_candidate_line_after(pc.remoteDescription.sdp,
mediaLine2, endOfCandidateLine);
}, `addIceCandidate(${JSON.stringify(init)}) adds a=end-of-candidates to both m-sections`);
});

promise_test(async t => {
const pc = new RTCPeerConnection();
Expand Down Expand Up @@ -418,7 +428,7 @@
assert_candidate_line_between(pc.remoteDescription.sdp,
mediaLine1, endOfCandidateLine, mediaLine2);
});
}, 'Add with empty candidate string (end of candidate) should succeed');
}, 'Add with empty candidate string (end of candidates) should succeed');

/*
4.4.2. addIceCandidate
Expand All @@ -440,6 +450,15 @@
})));
}, 'Add candidate with both sdpMid and sdpMLineIndex manually set to null should reject with TypeError');

promise_test(async t => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());

await pc.setRemoteDescription(sessionDesc);
promise_rejects_js(t, TypeError,
pc.addIceCandidate({candidate: candidateStr1}));
}, 'addIceCandidate with a candidate and neither sdpMid nor sdpMLineIndex should reject with TypeError');

promise_test(t => {
const pc = new RTCPeerConnection();

Expand Down Expand Up @@ -609,5 +628,4 @@
usernameFragment: usernameFragment1
})));
}, 'Add candidate with sdpMid belonging to different usernameFragment should reject with OperationError');

</script>

0 comments on commit 42e11fb

Please sign in to comment.