room-lane test: sharerBox takes tuneShare, and holds the camera being given back
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+12
−4
test/browser/room-lane.test.mjs+12 −4
diff --git a/test/browser/room-lane.test.mjs b/test/browser/room-lane.test.mjs| index 345b452..d1c4d4f 100644 |
| --- a/test/browser/room-lane.test.mjs |
| +++ b/test/browser/room-lane.test.mjs |
| @@ -898,7 +898,7 @@ test('a connection replaced under the negotiation is not offered to', async () = |
| // --------------------------------------------------------------- |
| const sharerBox = new Function( |
| - 'share', 'pcs', 'renderTiles', 'renderShare', 'broadcast', 'stopStream', |
| + 'share', 'pcs', 'renderTiles', 'renderShare', 'broadcast', 'stopStream', 'tuneShare', |
| [lift(src, 'addShareTo'), lift(src, 'removeShareFrom'), lift(src, 'dropShare')].join('\n') + |
| '\nreturn { addShareTo, removeShareFrom, dropShare };', |
| ); |
| @@ -930,9 +930,14 @@ function shareOver(signalingState) { |
| const entry = connection(signalingState); |
| const pcs = new Map([['peer1', entry]]); |
| const rendered = []; |
| + // Sender tuning (the screen's parameters, the camera capped and given |
| + // back) runs after each add and each removal; it is recorded with the |
| + // transceiver the entry holds at that moment. |
| + const tuned = []; |
| const box = sharerBox({ stream, track: display }, pcs, |
| - () => rendered.push('tiles'), () => rendered.push('share'), () => {}, () => {}); |
| - return Object.assign(box, { entry, display, stream, rendered }); |
| + () => rendered.push('tiles'), () => rendered.push('share'), () => {}, () => {}, |
| + (e) => tuned.push(e.shareTx)); |
| + return Object.assign(box, { entry, display, stream, rendered, tuned }); |
| } |
| test('a screen is added to a stable connection', () => { |
| @@ -942,6 +947,7 @@ test('a screen is added to a stable connection', () => { |
| assert.equal(s.entry.pc.added[0].track, s.display); |
| assert.deepEqual(s.entry.pc.added[0].init, { direction: 'sendonly', streams: [s.stream] }); |
| assert.equal(s.entry.shareTx, s.entry.pc.added[0]); |
| + assert.deepEqual(s.tuned, [s.entry.shareTx], 'the new screen is tuned once it exists'); |
| }); |
| test('a screen is not added to a connection that is mid-negotiation', () => { |
| @@ -983,7 +989,9 @@ test('stopping a screen stops its own transceiver and nothing else', () => { |
| // fake camera sender throws from replaceTrack, so reaching it at all |
| // fails loudly rather than quietly. |
| assert.deepEqual(s.entry.pc.removed, [], 'a sender was removed from the connection'); |
| - assert.equal(s.entry.pc.camera.track.id, 'camera'); |
| + assert.equal(s.entry.pc.camera.track.id, 'camera'); // Retuned with no screen on it, which is what gives the camera its |
| + // own defaults back (cameraCap(false) in room-share.test.mjs). |
| + assert.deepEqual(s.tuned, [tx, null], 'the camera was not given back its defaults'); |
| }); |
| test('the fallback is only for a transceiver that cannot be stopped', () => { |