forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1793776: Test-case for pref. r=jib
Differential Revision: https://phabricator.services.mozilla.com/D158696
- Loading branch information
1 parent
5d43825
commit 2325fcc
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
dom/media/webrtc/tests/mochitests/test_peerConnection_stereoFmtpPref.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |