diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/web-platform/tests/webrtc/receiver-track-live.https.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/webrtc/receiver-track-live.https.html')
-rw-r--r-- | testing/web-platform/tests/webrtc/receiver-track-live.https.html | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webrtc/receiver-track-live.https.html b/testing/web-platform/tests/webrtc/receiver-track-live.https.html new file mode 100644 index 0000000000..34569297a6 --- /dev/null +++ b/testing/web-platform/tests/webrtc/receiver-track-live.https.html @@ -0,0 +1,72 @@ +<!DOCTYPE html> +<html> +<head> + <meta charset="utf-8"> + <title>Remote tracks should not get ended except for stop/close</title> +<script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src=/resources/testdriver.js></script> +<script src=/resources/testdriver-vendor.js></script> +<script src='../mediacapture-streams/permission-helper.js'></script> + <script src="RTCPeerConnection-helper.js"></script> +</head> +<body> + <video id="video" controls autoplay playsinline></video> + <script> + let pc1, pc2; + let localTrack, remoteTrack; + promise_test(async (test) => { + await setMediaPermission("granted", ["microphone"]); + const localStream = await navigator.mediaDevices.getUserMedia({audio: true}); + localTrack = localStream.getAudioTracks()[0]; + + pc1 = new RTCPeerConnection(); + pc1.addTrack(localTrack, localStream); + pc2 = new RTCPeerConnection(); + + let trackPromise = new Promise(resolve => { + pc2.ontrack = e => resolve(e.track); + }); + + exchangeIceCandidates(pc1, pc2); + await exchangeOfferAnswer(pc1, pc2); + + remoteTrack = await trackPromise; + video.srcObject = new MediaStream([remoteTrack]); + await video.play(); + }, "Setup audio call"); + + promise_test(async (test) => { + pc1.getTransceivers()[0].direction = "inactive"; + + let offer = await pc1.createOffer(); + await pc1.setLocalDescription(offer); + + // Let's remove ssrc lines + let sdpLines = offer.sdp.split("\r\n"); + offer.sdp = sdpLines.filter(line => line && !line.startsWith("a=ssrc")).join("\r\n") + "\r\n"; + + await pc2.setRemoteDescription(offer); + let answer = await pc2.createAnswer(); + await pc2.setLocalDescription(answer); + await pc1.setRemoteDescription(answer); + + assert_equals(remoteTrack.readyState, "live"); + }, "Inactivate the audio transceiver"); + + promise_test(async (test) => { + pc1.getTransceivers()[0].direction = "sendonly"; + + await exchangeOfferAnswer(pc1, pc2); + + assert_equals(remoteTrack.readyState, "live"); + }, "Reactivate the audio transceiver"); + + promise_test(async (test) => { + pc1.close(); + pc2.close(); + localTrack.stop(); + }, "Clean-up"); + </script> +</body> +</html> |