Skip to content

Commit

Permalink
Test-cases for transitioning to "new" gathering state.
Browse files Browse the repository at this point in the history
Differential Revision: https://phabricator.services.mozilla.com/D72241

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1629565
gecko-commit: 40c9fc4fa29244c06f045a22f1f002d2ce5e9926
gecko-integration-branch: autoland
gecko-reviewers: jib
  • Loading branch information
docfaraday authored and moz-wptsync-bot committed Apr 28, 2020
1 parent 555bcce commit 409fc4b
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions webrtc/RTCPeerConnection-iceGatheringState.html
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,46 @@
await pc2.setRemoteDescription(offer);
}, 'sRD does not cause ICE gathering state changes')

promise_test(async t => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
await pc.setLocalDescription(
await pc.createOffer({offerToReceiveAudio: true}));
await iceGatheringStateTransitions(pc, 'gathering', 'complete');
await pc.setLocalDescription({type: 'rollback'});
await iceGatheringStateTransitions(pc, 'new');
}, 'setLocalDescription(rollback) of original offer should cause iceGatheringState to reach "new" when starting in "complete"');

promise_test(async t => {
const pc = new RTCPeerConnection();
t.add_cleanup(() => pc.close());
await pc.setLocalDescription(
await pc.createOffer({offerToReceiveAudio: true}));
await iceGatheringStateTransitions(pc, 'gathering');
await pc.setLocalDescription({type: 'rollback'});
// We might go directly to 'new', or we might go to 'complete' first,
// depending on timing. Allow either.
await Promise.any([
iceGatheringStateTransitions(pc, 'new'),
iceGatheringStateTransitions(pc, 'complete', 'new')]);
}, 'setLocalDescription(rollback) of original offer should cause iceGatheringState to reach "new" when starting in "gathering"');

promise_test(async t => {
const pc1 = new RTCPeerConnection();
t.add_cleanup(() => pc1.close());
const pc2 = new RTCPeerConnection();
t.add_cleanup(() => pc2.close());
await initialOfferAnswer(pc1, pc2, {offerToReceiveAudio: true});

pc1.getTransceivers()[0].stop();
await pc1.setLocalDescription(await pc1.createOffer());
await pc2.setRemoteDescription(pc1.localDescription);
await pc2.setLocalDescription(await pc2.createAnswer());
await iceGatheringStateTransitions(pc2, 'new');
await pc1.setRemoteDescription(pc2.localDescription);
await iceGatheringStateTransitions(pc1, 'new');
}, 'renegotiation that closes all transports should result in ICE gathering state "new"');

/*
4.4.2. RTCIceGatheringState Enum
gathering
Expand Down

0 comments on commit 409fc4b

Please sign in to comment.