зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1636875 [wpt PR 23499] - Add tests that candidates always generate after SLD completes., a=testonly
Automatic update from web-platform-tests Add tests that candidates always generate after SLD completes. Bug: none Change-Id: I46ec0a0b9435e9d88a938cc2f105a80340fd252c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2192932 Commit-Queue: Harald Alvestrand <hta@chromium.org> Reviewed-by: Henrik Boström <hbos@chromium.org> Cr-Commit-Position: refs/heads/master@{#767297} -- wpt-commits: 63eab8293f7058d87f67274ee96f1609e92f77ec wpt-pr: 23499
This commit is contained in:
Родитель
b1661228a0
Коммит
579c2355ca
|
@ -92,4 +92,58 @@ promise_test(async t => {
|
|||
}, 'addIceCandidate and setLocalDescription are resolved in the correct ' +
|
||||
'order, as defined by the operations chain specification');
|
||||
|
||||
promise_test(async t => {
|
||||
const caller = new RTCPeerConnection();
|
||||
t.add_cleanup(() => caller.close());
|
||||
const callee = new RTCPeerConnection();
|
||||
t.add_cleanup(() => callee.close());
|
||||
caller.addTransceiver('audio');
|
||||
let events = [];
|
||||
let pendingPromises = [];
|
||||
|
||||
const onCandidatePromise = new Promise(resolve => {
|
||||
caller.onicecandidate = () => {
|
||||
events.push('candidate generated');
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
pendingPromises.push(onCandidatePromise);
|
||||
pendingPromises.push(caller.setLocalDescription().then(() => {
|
||||
events.push('setLocalDescription');
|
||||
}));
|
||||
await Promise.all(pendingPromises);
|
||||
assert_array_equals(events, ['setLocalDescription', 'candidate generated']);
|
||||
}, 'onicecandidate fires after resolving setLocalDescription in offerer');
|
||||
|
||||
promise_test(async t => {
|
||||
const caller = new RTCPeerConnection();
|
||||
t.add_cleanup(() => caller.close());
|
||||
const callee = new RTCPeerConnection();
|
||||
t.add_cleanup(() => callee.close());
|
||||
caller.addTransceiver('audio');
|
||||
let events = [];
|
||||
let pendingPromises = [];
|
||||
|
||||
caller.onicecandidate = (ev) => {
|
||||
if (ev.candidate) {
|
||||
callee.addIceCandidate(ev.candidate);
|
||||
}
|
||||
}
|
||||
const offer = await caller.createOffer();
|
||||
const onCandidatePromise = new Promise(resolve => {
|
||||
callee.onicecandidate = () => {
|
||||
events.push('candidate generated');
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
await callee.setRemoteDescription(offer);
|
||||
const answer = await callee.createAnswer();
|
||||
pendingPromises.push(onCandidatePromise);
|
||||
pendingPromises.push(callee.setLocalDescription(answer).then(() => {
|
||||
events.push('setLocalDescription');
|
||||
}));
|
||||
await Promise.all(pendingPromises);
|
||||
assert_array_equals(events, ['setLocalDescription', 'candidate generated']);
|
||||
}, 'onicecandidate fires after resolving setLocalDescription in answerer');
|
||||
|
||||
</script>
|
||||
|
|
Загрузка…
Ссылка в новой задаче