From fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:14:29 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- ...ection-explicit-rollback-iceGatheringState.html | 59 ++++++++++++++++++---- 1 file changed, 50 insertions(+), 9 deletions(-) (limited to 'testing/web-platform/tests/webrtc/RTCPeerConnection-explicit-rollback-iceGatheringState.html') diff --git a/testing/web-platform/tests/webrtc/RTCPeerConnection-explicit-rollback-iceGatheringState.html b/testing/web-platform/tests/webrtc/RTCPeerConnection-explicit-rollback-iceGatheringState.html index e39b985bef..a28275047e 100644 --- a/testing/web-platform/tests/webrtc/RTCPeerConnection-explicit-rollback-iceGatheringState.html +++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-explicit-rollback-iceGatheringState.html @@ -13,8 +13,7 @@ promise_test(async t => { const pc2 = new RTCPeerConnection(); t.add_cleanup(() => pc2.close()); pc1.addTransceiver('audio', { direction: 'recvonly' }); - await initialOfferAnswerWithIceGatheringStateTransitions( - pc1, pc2); + await initialOfferAnswerWithIceGatheringStateTransitions(pc1, pc2); await pc1.setLocalDescription(await pc1.createOffer({iceRestart: true})); await iceGatheringStateTransitions(pc1, 'gathering', 'complete'); expectNoMoreGatheringStateChanges(t, pc1); @@ -22,32 +21,74 @@ promise_test(async t => { await new Promise(r => t.step_timeout(r, 1000)); }, 'rolling back an ICE restart when gathering is complete should not result in iceGatheringState changes'); +promise_test(async t => { + const pc1 = new RTCPeerConnection(); + t.add_cleanup(() => pc1.close()); + const pc2 = new RTCPeerConnection(); + t.add_cleanup(() => pc2.close()); + pc1.createDataChannel('test'); + await initialOfferAnswerWithIceGatheringStateTransitions(pc1, pc2); + await pc1.setLocalDescription(await pc1.createOffer({iceRestart: true})); + await iceGatheringStateTransitions(pc1, 'gathering', 'complete'); + expectNoMoreGatheringStateChanges(t, pc1); + await pc1.setLocalDescription({type: 'rollback'}); + await new Promise(r => t.step_timeout(r, 1000)); +}, 'rolling back an ICE restart when gathering is complete should not result in iceGatheringState changes (DataChannel case)'); + promise_test(async t => { const pc = new RTCPeerConnection(); t.add_cleanup(() => pc.close()); pc.addTransceiver('audio', { direction: 'recvonly' }); - await pc.setLocalDescription( - await pc.createOffer()); + await pc.setLocalDescription(); await iceGatheringStateTransitions(pc, 'gathering', 'complete'); + const backToNew = iceGatheringStateTransitions(pc, 'new'); await pc.setLocalDescription({type: 'rollback'}); - await iceGatheringStateTransitions(pc, 'new'); + await backToNew; }, '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()); + pc.createDataChannel('test'); + await pc.setLocalDescription(); + await iceGatheringStateTransitions(pc, 'gathering', 'complete'); + const backToNew = iceGatheringStateTransitions(pc, 'new'); + await pc.setLocalDescription({type: 'rollback'}); + await backToNew; +}, 'setLocalDescription(rollback) of original offer should cause iceGatheringState to reach "new" when starting in "complete" (DataChannel case)'); + promise_test(async t => { const pc = new RTCPeerConnection(); t.add_cleanup(() => pc.close()); pc.addTransceiver('audio', { direction: 'recvonly' }); - await pc.setLocalDescription( - await pc.createOffer()); + await pc.setLocalDescription(); await iceGatheringStateTransitions(pc, 'gathering'); + const backToNew = Promise.allSettled([ + iceGatheringStateTransitions(pc, 'new'), + iceGatheringStateTransitions(pc, 'complete', 'new')]); await pc.setLocalDescription({type: 'rollback'}); // We might go directly to 'new', or we might go to 'complete' first, // depending on timing. Allow either. - const results = await Promise.allSettled([ + const results = await backToNew; + assert_true(results.some(result => result.status == 'fulfilled'), + 'ICE gathering state should go back to "new", possibly through "complete"'); +}, 'setLocalDescription(rollback) of original offer should cause iceGatheringState to reach "new" when starting in "gathering"'); + +promise_test(async t => { + const pc = new RTCPeerConnection(); + t.add_cleanup(() => pc.close()); + pc.createDataChannel('test'); + await pc.setLocalDescription(); + await iceGatheringStateTransitions(pc, 'gathering'); + const backToNew = Promise.allSettled([ iceGatheringStateTransitions(pc, 'new'), iceGatheringStateTransitions(pc, 'complete', 'new')]); + await pc.setLocalDescription({type: 'rollback'}); + // We might go directly to 'new', or we might go to 'complete' first, + // depending on timing. Allow either. + const results = await backToNew; assert_true(results.some(result => result.status == 'fulfilled'), 'ICE gathering state should go back to "new", possibly through "complete"'); -}, 'setLocalDescription(rollback) of original offer should cause iceGatheringState to reach "new" when starting in "gathering"'); +}, 'setLocalDescription(rollback) of original offer should cause iceGatheringState to reach "new" when starting in "gathering" (DataChannel case)'); -- cgit v1.2.3