summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webrtc/RTCPeerConnection-iceConnectionState-disconnected.https.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /testing/web-platform/tests/webrtc/RTCPeerConnection-iceConnectionState-disconnected.https.html
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-upstream/125.0.1.tar.xz
firefox-upstream/125.0.1.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/webrtc/RTCPeerConnection-iceConnectionState-disconnected.https.html')
-rw-r--r--testing/web-platform/tests/webrtc/RTCPeerConnection-iceConnectionState-disconnected.https.html42
1 files changed, 42 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webrtc/RTCPeerConnection-iceConnectionState-disconnected.https.html b/testing/web-platform/tests/webrtc/RTCPeerConnection-iceConnectionState-disconnected.https.html
index af55a0c003..04c2b9c333 100644
--- a/testing/web-platform/tests/webrtc/RTCPeerConnection-iceConnectionState-disconnected.https.html
+++ b/testing/web-platform/tests/webrtc/RTCPeerConnection-iceConnectionState-disconnected.https.html
@@ -27,4 +27,46 @@
// TODO: this should eventually transition to failed but that takes
// somewhat long (15-30s) so is not testable.
}, 'ICE goes to disconnected if the other side goes away');
+
+ 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', {direction: 'sendrecv'});
+ exchangeIceCandidates(caller, callee);
+ await exchangeOfferAnswer(caller, callee);
+ await listenToIceConnected(caller);
+
+ // Now, we pull a fast one, and convince callee to abandon the transport
+ // without telling caller.
+ await caller.setLocalDescription();
+ await callee.setRemoteDescription(caller.localDescription);
+ const staleAnswer = await callee.createAnswer();
+ await callee.setRemoteDescription({type: 'rollback', sdp: ''});
+
+ const mlineRegex = /m=audio [0-9]+ /;
+ const mungedOfferSdp = caller.localDescription.sdp
+ .replace(mlineRegex, 'm=audio 0 ')
+ .replace('BUNDLE', 'BUNGLE'); // Avoid "But that mid is rejected!" errors
+
+ // callee gets the munged reoffer with a rejected m-section, caller gets a
+ // stale answer that was made before callee saw the rejected m-section.
+ await callee.setRemoteDescription({type: 'offer', sdp: mungedOfferSdp});
+ await callee.setLocalDescription();
+ await caller.setRemoteDescription(staleAnswer);
+ assert_equals(await nextIceConnectionState(caller), 'disconnected');
+
+ // Now, let's fix this with an ICE restart! callee has already negotiated
+ // a rejection of the first m-section, so it will tolerate it being
+ // revived.
+ caller.restartIce();
+ await caller.setLocalDescription();
+ await callee.setRemoteDescription(caller.localDescription);
+ await callee.setLocalDescription();
+ await caller.setRemoteDescription(callee.localDescription);
+ assert_equals(await nextIceConnectionState(caller), 'checking');
+ assert_equals(await nextIceConnectionState(caller), 'connected');
+ }, 'ICE restart when ICE is disconnected results in checking, then connected');
+
</script>