tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 0ec7634e463f5f9654c16dcff8ad34e4ab407b6c
parent ebe9410652ec5bc6a50ec025dbb184cca6967ac0
Author: Chun-Min Chang <chun.m.chang@gmail.com>
Date:   Sat, 20 Dec 2025 18:19:44 +0000

Bug 1674892 - Update mochitests to validate cross-rate AudioContext connections r=karlt

Now that connecting two `AudioContext`s running at different sample rates is
supported, this patch updates the following mochitests accordingly:

- Remove test_getUserMedia_nonDefaultRate.html
- Validate cross-rate connection in test_audioContextParams_sampleRate.html
- Validate cross-rate connection in test_peerConnection_nonDefaultRate.html

Differential Revision: https://phabricator.services.mozilla.com/D272530

Diffstat:
Mdom/media/webaudio/test/test_audioContextParams_sampleRate.html | 8++++----
Mdom/media/webrtc/tests/mochitests/mochitest_getusermedia.toml | 2--
Ddom/media/webrtc/tests/mochitests/test_getUserMedia_nonDefaultRate.html | 35-----------------------------------
Mdom/media/webrtc/tests/mochitests/test_peerConnection_nonDefaultRate.html | 8++------
4 files changed, 6 insertions(+), 47 deletions(-)

diff --git a/dom/media/webaudio/test/test_audioContextParams_sampleRate.html b/dom/media/webaudio/test/test_audioContextParams_sampleRate.html @@ -38,7 +38,7 @@ runTest(async () => { }) osc_ac1.stop(); - // Same test using a new AudioContext of different sample rate. + // Same test using a new AudioContext of different sample rate. const rate2 = 1500; const ac2 = new AudioContext({sampleRate: 48000}); const dest_ac2 = ac2.createMediaStreamDestination(); @@ -60,9 +60,9 @@ runTest(async () => { }) osc_ac2.stop(); - // Two AudioContexts with different sample rate cannot communicate. - mustThrowWith("Connect nodes with different sample rate", "NotSupportedError", - () => ac2.createMediaStreamSource(dest_ac1.stream)); + // Two AudioContexts with different sample rate can communicate. + ac2.createMediaStreamSource(dest_ac1.stream); + ok(true, "Connect nodes with the different sample rate is ok"); // Two AudioContext with the same sample rate can communicate. const ac3 = new AudioContext({sampleRate: 48000}); diff --git a/dom/media/webrtc/tests/mochitests/mochitest_getusermedia.toml b/dom/media/webrtc/tests/mochitests/mochitest_getusermedia.toml @@ -135,8 +135,6 @@ skip-if = [ ["test_getUserMedia_mediaStreamTrackClone.html"] -["test_getUserMedia_nonDefaultRate.html"] - ["test_getUserMedia_peerIdentity.html"] ["test_getUserMedia_permission.html"] diff --git a/dom/media/webrtc/tests/mochitests/test_getUserMedia_nonDefaultRate.html b/dom/media/webrtc/tests/mochitests/test_getUserMedia_nonDefaultRate.html @@ -1,35 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head> - <script type="application/javascript" src="mediaStreamPlayback.js"></script> -</head> -<body> -<pre id="test"> -<script type="application/javascript"> - createHTML({ - title: "getUserMedia feed to a graph with non default rate", - bug: "1387454", - }); - - /** - * Run a test to verify that when we use the streem from a gUM to an AudioContext - * with non default rate the connection fails. (gUM is always on default rate). - */ - runTest(async () => { - const stream = await getUserMedia({audio: true}); - const nonDefaultRate = 32000; - const ac = new AudioContext({sampleRate: nonDefaultRate}); - mustThrowWith( - "Connect stream with graph of different sample rate", - "NotSupportedError", () => { - ac.createMediaStreamSource(stream); - } - ); - for (let t of stream.getTracks()) { - t.stop(); - } - }); -</script> -</pre> -</body> -</html> diff --git a/dom/media/webrtc/tests/mochitests/test_peerConnection_nonDefaultRate.html b/dom/media/webrtc/tests/mochitests/test_peerConnection_nonDefaultRate.html @@ -181,12 +181,8 @@ const source_default_rate = ac.createMediaStreamSource(remoteStream); // Now try to add the remoteStream on a non default context - mustThrowWith( - "Connect stream with graph of different sample rate", - "NotSupportedError", () => { - nonDefault_ctx.createMediaStreamSource(remoteStream); - } - ); + nonDefault_ctx.createMediaStreamSource(remoteStream); + ok(true, "Connect stream with graph of different sample rate is ok"); // Close peer connections to make sure we don't get error: // "logged result after SimpleTest.finish(): pc1 addIceCandidate success"