You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-07 23:02:56 +03:00
1:1 screenshare tests (#2617)
* 1:1 screenshare tests Fixes https://github.com/vector-im/element-call/issues/548 * Always hang up calls after tests to prevent hanging tests Also fix a null dereference as we may not have an invitee or opponent member when sending voip events if not using to-device messages. * use mockImplementationOnce Co-authored-by: Robin <robin@robin.town> * use mockImplementationOnce Co-authored-by: Robin <robin@robin.town> * Add type on mock * Add corresponding call.off * Merge enable & disable screenshare tests Co-authored-by: Robin <robin@robin.town>
This commit is contained in:
@@ -56,6 +56,9 @@ export const DUMMY_SDP = (
|
||||
"a=ssrc:3619738545 cname:2RWtmqhXLdoF4sOi\r\n"
|
||||
);
|
||||
|
||||
export const USERMEDIA_STREAM_ID = "mock_stream_from_media_handler";
|
||||
export const SCREENSHARE_STREAM_ID = "mock_screen_stream_from_media_handler";
|
||||
|
||||
class MockMediaStreamAudioSourceNode {
|
||||
connect() {}
|
||||
}
|
||||
@@ -128,6 +131,10 @@ export class MockRTCPeerConnection {
|
||||
return new MockRTCRtpSender(track);
|
||||
}
|
||||
|
||||
removeTrack() {
|
||||
this.needsNegotiation = true;
|
||||
}
|
||||
|
||||
doNegotiation() {
|
||||
if (this.needsNegotiation && this.negotiationNeededListener) {
|
||||
this.needsNegotiation = false;
|
||||
@@ -222,7 +229,7 @@ export class MockMediaHandler {
|
||||
if (audio) tracks.push(new MockMediaStreamTrack("audio_track", "audio"));
|
||||
if (video) tracks.push(new MockMediaStreamTrack("video_track", "video"));
|
||||
|
||||
const stream = new MockMediaStream("mock_stream_from_media_handler", tracks);
|
||||
const stream = new MockMediaStream(USERMEDIA_STREAM_ID, tracks);
|
||||
this.userMediaStreams.push(stream);
|
||||
return stream;
|
||||
}
|
||||
@@ -233,7 +240,7 @@ export class MockMediaHandler {
|
||||
const tracks = [new MockMediaStreamTrack("video_track", "video")];
|
||||
if (opts?.audio) tracks.push(new MockMediaStreamTrack("audio_track", "audio"));
|
||||
|
||||
const stream = new MockMediaStream("mock_screen_stream_from_media_handler", tracks);
|
||||
const stream = new MockMediaStream(SCREENSHARE_STREAM_ID, tracks);
|
||||
this.screensharingStreams.push(stream);
|
||||
return stream;
|
||||
}
|
||||
|
Reference in New Issue
Block a user