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 /dom/media/webrtc/tests/mochitests/test_peerConnection_stereoFmtpPref.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.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_stereoFmtpPref.html')
-rw-r--r-- | dom/media/webrtc/tests/mochitests/test_peerConnection_stereoFmtpPref.html | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/dom/media/webrtc/tests/mochitests/test_peerConnection_stereoFmtpPref.html b/dom/media/webrtc/tests/mochitests/test_peerConnection_stereoFmtpPref.html new file mode 100644 index 0000000000..ab7811fe82 --- /dev/null +++ b/dom/media/webrtc/tests/mochitests/test_peerConnection_stereoFmtpPref.html @@ -0,0 +1,61 @@ +<!DOCTYPE HTML> +<html> +<head> + <script type="application/javascript" src="pc.js"></script> +<body> +<pre id="test"> +<script type="application/javascript"> + createHTML({ + bug: "1793776", + title: "Test that media.peerconnection.sdp.disable_stereo_fmtp works" + }); + + const tests = [ + async function testStereo() { + const offerer = new RTCPeerConnection(); + offerer.addTransceiver('audio'); + const answerer = new RTCPeerConnection(); + await offerer.setLocalDescription(); + ok(offerer.localDescription.sdp.includes('stereo=1'), + 'Offer uses stereo=1 when media.peerconnection.sdp.disable_stereo_fmtp is not set'); + await answerer.setRemoteDescription(offerer.localDescription); + const {sdp} = await answerer.createAnswer(); + ok(sdp.includes('stereo=1'), 'Answer uses stereo=1 when media.peerconnection.sdp.disable_stereo_fmtp is not set'); + }, + + async function testNoStereo() { + await pushPrefs( + ['media.peerconnection.sdp.disable_stereo_fmtp', true]); + + const offerer = new RTCPeerConnection(); + offerer.addTransceiver('audio'); + const answerer = new RTCPeerConnection(); + await offerer.setLocalDescription(); + ok(offerer.localDescription.sdp.includes('stereo=0'), + 'Offer uses stereo=0 when media.peerconnection.sdp.disable_stereo_fmtp is set'); + await answerer.setRemoteDescription(offerer.localDescription); + const {sdp} = await answerer.createAnswer(); + ok(sdp.includes('stereo=0'), 'Answer uses stereo=0 when media.peerconnection.sdp.disable_stereo_fmtp is set'); + }, + ]; + + runNetworkTest(async () => { + for (const test of tests) { + info(`Running test: ${test.name}`); + try { + await test(); + } catch (e) { + ok(false, `Caught ${e.name}: ${e.message} ${e.stack}`); + } + info(`Done running test: ${test.name}`); + // Make sure we don't build up a pile of GC work, and also get PCImpl to + // print their timecards. + await new Promise(r => SpecialPowers.exactGC(r)); + } + + await SpecialPowers.popPrefEnv(); + }); +</script> +</pre> +</body> +</html> |