Calls: the native gate checks the app sends the level a browser asks for (spec 15.30)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+45
−0
test/browser/native.mjs+45 −0
diff --git a/test/browser/native.mjs b/test/browser/native.mjs| index a10abfd..0e9a5ca 100644 |
| --- a/test/browser/native.mjs |
| +++ b/test/browser/native.mjs |
| @@ -249,6 +249,51 @@ try { |
| assert.equal(sample.stats.peerConnections, 1, 'recovering the camera keeps the same peer connection'); |
| console.log('PASS a stalled camera was restarted and the far side kept its picture'); |
| } |
| + // Spec §15.30, the app as the sender: the browser's own Video quality |
| + // asks the app for minimal, and the app's camera to the browser drops to |
| + // 180 lines or fewer — measured where it arrives — then Audio only stops |
| + // it, and Auto brings it back, all without a new connection. |
| + if (mode === 'member') { |
| + const arriving = () => page.evaluate(async () => { |
| + let height = 0, bytes = 0; |
| + for (const pc of window.__nativeInteropPCs) { |
| + if (pc.connectionState === 'closed') continue; |
| + for (const r of (await pc.getStats()).values()) { |
| + if (r.type === 'inbound-rtp' && r.kind === 'video') { |
| + height = Math.max(height, r.frameHeight || 0); |
| + bytes += r.bytesReceived || 0; |
| + } |
| + } |
| + } |
| + return { height, bytes }; |
| + }); |
| + const pick = async (value) => { |
| + await page.evaluate((v) => { |
| + const panel = document.getElementById('room-devices'); |
| + if (panel && panel.hidden) document.getElementById('devices-toggle').click(); |
| + const el = document.getElementById('pick-video-quality'); |
| + el.value = v; |
| + el.dispatchEvent(new Event('change', { bubbles: true })); |
| + }, value); |
| + }; |
| + const full = (await arriving()).height; |
| + assert.ok(full > 180, `the app's camera arrives above 180 lines before anything is asked (${full})`); |
| + await pick('low'); |
| + await wait(async () => (await arriving()).height > 0 && (await arriving()).height <= 180, |
| + 'the app sends its camera at 180 lines or fewer when the browser asks for minimal', 20); |
| + console.log(`PASS the app applies a requested level: its camera arrives at ${(await arriving()).height} lines, from ${full}`); |
| + await pick('audio'); |
| + await new Promise(r => setTimeout(r, 3000)); |
| + const paused = (await arriving()).bytes; |
| + await new Promise(r => setTimeout(r, 3000)); |
| + assert.ok((await arriving()).bytes - paused < 3000, 'the app sends no camera to a browser that asks for audio only'); |
| + await wait(() => sample?.stats.audioBytesReceived > 0, 'audio still arrives at the app'); |
| + console.log('PASS the app pauses its camera for a browser on Audio only, and audio carries on'); |
| + await pick('auto'); |
| + await wait(async () => (await arriving()).height > 180, 'the app sends full video again once the browser is back on Auto', 20); |
| + assert.equal(sample.stats.peerConnections, 1, 'changing levels keeps the same peer connection'); |
| + console.log('PASS the app goes back to full video for Auto, on the same connection'); |
| + } |
| // Chat is not replayed to a recipient whose stream is renewing (§6), and |
| // in this mode the stream renews every ten seconds, so a line that lands |
| // in a renewal's gap is lost by design. Since the camera steps above went |