summaryrefslogtreecommitdiffstats
path: root/dom/media/webrtc/tests/mochitests/test_peerConnection_relayOnly.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/media/webrtc/tests/mochitests/test_peerConnection_relayOnly.html
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/webrtc/tests/mochitests/test_peerConnection_relayOnly.html')
-rw-r--r--dom/media/webrtc/tests/mochitests/test_peerConnection_relayOnly.html60
1 files changed, 60 insertions, 0 deletions
diff --git a/dom/media/webrtc/tests/mochitests/test_peerConnection_relayOnly.html b/dom/media/webrtc/tests/mochitests/test_peerConnection_relayOnly.html
new file mode 100644
index 0000000000..3b07783c04
--- /dev/null
+++ b/dom/media/webrtc/tests/mochitests/test_peerConnection_relayOnly.html
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <script type="application/javascript" src="pc.js"></script>
+</head>
+<body>
+<pre id="test">
+<script type="application/javascript">
+createHTML({
+ bug: "1187775",
+ title: "peer connection ICE fails on relay-only without TURN"
+});
+
+function PC_LOCAL_NO_CANDIDATES(test) {
+ var isnt = can => is(can, null, "No candidates: " + JSON.stringify(can));
+ test.pcLocal._pc.addEventListener("icecandidate", e => isnt(e.candidate));
+}
+
+function PC_BOTH_WAIT_FOR_ICE_FAILED(test) {
+ var isFail = (f, reason, msg) =>
+ f().then(() => { throw new Error(msg + " must fail"); },
+ e => is(e.message, reason, msg + " must fail with: " + e.message));
+
+ return Promise.all([
+ isFail(() => test.pcLocal.waitForIceConnected(), "ICE failed", "Local ICE"),
+ isFail(() => test.pcRemote.waitForIceConnected(), "ICE failed", "Remote ICE")
+ ])
+ .then(() => ok(true, "ICE on both sides must fail."));
+}
+
+runNetworkTest(async options => {
+ await pushPrefs(
+ ['media.peerconnection.ice.stun_client_maximum_transmits', 3],
+ ['media.peerconnection.ice.trickle_grace_period', 5000]
+ );
+ options = options || {};
+ options.config_local = options.config_local || {};
+ const servers = options.config_local.iceServers || [];
+ // remove any turn servers
+ options.config_local.iceServers = servers.filter(server =>
+ server.urls.every(u => !u.toLowerCase().startsWith('turn')));
+
+ // Here's the setting we're testing. Comment out and this test should fail:
+ options.config_local.iceTransportPolicy = "relay";
+
+ const test = new PeerConnectionTest(options);
+ test.setMediaConstraints([{audio: true}, {video: true}],
+ [{audio: true}, {video: true}]);
+ test.chain.remove("PC_LOCAL_SETUP_ICE_LOGGER"); // Needed to suppress failing
+ test.chain.remove("PC_REMOTE_SETUP_ICE_LOGGER"); // on ICE-failure.
+ test.chain.insertAfter("PC_LOCAL_SETUP_ICE_HANDLER", PC_LOCAL_NO_CANDIDATES);
+ test.chain.replace("PC_LOCAL_WAIT_FOR_ICE_CONNECTED", PC_BOTH_WAIT_FOR_ICE_FAILED);
+ test.chain.removeAfter("PC_BOTH_WAIT_FOR_ICE_FAILED");
+ await test.run();
+});
+
+</script>
+</pre>
+</body>
+</html>