1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-07-31 15:24:23 +03:00
Pushed to wrong branch
This commit is contained in:
David Baker
2022-08-23 22:03:25 +01:00
parent 4a294c9dd3
commit c527f85fb1
2 changed files with 2 additions and 91 deletions

View File

@ -30,8 +30,6 @@ import {
MockMediaStream,
MockMediaStreamTrack,
installWebRTCMocks,
MockRTCPeerConnection,
SCREENSHARE_STREAM_ID,
} from "../../test-utils/webrtc";
import { CallFeed } from "../../../src/webrtc/callFeed";
import { EventType, MatrixEvent } from "../../../src";
@ -943,84 +941,4 @@ describe('Call', function() {
expect(call.state).toEqual(CallState.Ended);
});
describe("Screen sharing", () => {
beforeEach(async () => {
await startVoiceCall(client, call);
await call.onAnswerReceived({
getContent: () => {
return {
"version": 1,
"call_id": call.callId,
"party_id": 'party_id',
"answer": {
sdp: DUMMY_SDP,
},
"org.matrix.msc3077.sdp_stream_metadata": {
"foo": {
"purpose": "m.usermedia",
"audio_muted": false,
"video_muted": false,
},
},
};
},
getSender: () => "@test:foo",
});
});
afterEach(() => {
// Hangup to stop timers
call.hangup(CallErrorCode.UserHangup, true);
});
it("enables screensharing", async () => {
await call.setScreensharingEnabled(true);
expect(call.feeds.filter(f => f.purpose == SDPStreamMetadataPurpose.Screenshare).length).toEqual(1);
client.client.sendEvent.mockReset();
const sendNegotiatePromise = new Promise<void>(resolve => {
client.client.sendEvent.mockImplementation(() => {
resolve();
});
});
MockRTCPeerConnection.triggerAllNegotiations();
await sendNegotiatePromise;
expect(client.client.sendEvent).toHaveBeenCalledWith(
FAKE_ROOM_ID,
EventType.CallNegotiate,
expect.objectContaining({
"version": "1",
"call_id": call.callId,
"org.matrix.msc3077.sdp_stream_metadata": expect.objectContaining({
[SCREENSHARE_STREAM_ID]: expect.objectContaining({
purpose: SDPStreamMetadataPurpose.Screenshare,
}),
}),
}),
);
});
it("disables screensharing", async () => {
await call.setScreensharingEnabled(true);
client.client.sendEvent.mockReset();
const sendNegotiatePromise = new Promise<void>(resolve => {
client.client.sendEvent.mockImplementation(() => {
resolve();
});
});
MockRTCPeerConnection.triggerAllNegotiations();
await sendNegotiatePromise;
await call.setScreensharingEnabled(false);
expect(call.feeds.filter(f => f.purpose == SDPStreamMetadataPurpose.Screenshare).length).toEqual(0);
});
});
});