diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /dom/media/webrtc/tests/mochitests/test_peerConnection_replaceTrack_microphone.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/webrtc/tests/mochitests/test_peerConnection_replaceTrack_microphone.html')
-rw-r--r-- | dom/media/webrtc/tests/mochitests/test_peerConnection_replaceTrack_microphone.html | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/dom/media/webrtc/tests/mochitests/test_peerConnection_replaceTrack_microphone.html b/dom/media/webrtc/tests/mochitests/test_peerConnection_replaceTrack_microphone.html new file mode 100644 index 0000000000..d24fcc4130 --- /dev/null +++ b/dom/media/webrtc/tests/mochitests/test_peerConnection_replaceTrack_microphone.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML> +<html> +<head> + <script type="application/javascript" src="pc.js"></script> + <script type="application/javascript" src="/tests/dom/canvas/test/captureStream_common.js"></script> +</head> +<body> +<pre id="test"> + +<script type="application/javascript"> + createHTML({ + bug: "1709481", + title: "replaceTrack (null -> microphone) test", + visible: true + }); + + runNetworkTest(async () => { + // Make sure we use the fake audio device, and not loopback + await pushPrefs( + ['media.audio_loopback_dev', ''], + ['media.navigator.streams.fake', true]); + const pc1 = new RTCPeerConnection(), pc2 = new RTCPeerConnection(); + pc1.onicecandidate = e => pc2.addIceCandidate(e.candidate); + pc2.onicecandidate = e => pc1.addIceCandidate(e.candidate); + let remoteStream; + pc2.ontrack = ({track}) => remoteStream = new MediaStream([track]); + const tc1 = pc1.addTransceiver("audio"); + const stream = await navigator.mediaDevices.getUserMedia({audio: true}); + const [track] = stream.getAudioTracks(); + await pc1.setLocalDescription(); + await pc2.setRemoteDescription(pc1.localDescription); + await pc2.setLocalDescription(); + await pc1.setRemoteDescription(pc2.localDescription); + await wait(100); + await tc1.sender.replaceTrack(track); + const h = new AudioStreamFlowingHelper(); + await h.checkAudioFlowing(remoteStream); + pc1.close(); + pc2.close(); + await SpecialPowers.popPrefEnv(); + }); + +</script> +</pre> +</body> +</html> |