diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /dom/media/webrtc/tests/mochitests/test_peerConnection_replaceTrack_microphone.html | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
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..5886caf6a4 --- /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 AudioStreamHelper(); + await h.checkAudioFlowing(remoteStream); + pc1.close(); + pc2.close(); + await SpecialPowers.popPrefEnv(); + }); + +</script> +</pre> +</body> +</html> |