MCPcopy
hub / github.com/livekit/livekit / newRoomWithParticipants

Function newRoomWithParticipants

pkg/rtc/room_test.go:816–860  ·  view source on GitHub ↗
(t *testing.T, opts testRoomOpts)

Source from the content-addressed store, hash-verified

814}
815
816func newRoomWithParticipants(t *testing.T, opts testRoomOpts) *Room {
817 kp := &authfakes.FakeKeyProvider{}
818 kp.GetSecretReturns("testkey")
819
820 n, err := webhook.NewDefaultNotifier(webhook.DefaultWebHookConfig, kp)
821 require.NoError(t, err)
822
823 rm := NewRoom(
824 &livekit.Room{Name: "room"},
825 nil,
826 WebRTCConfig{},
827 config.RoomConfig{
828 EmptyTimeout: 5 * 60,
829 DepartureTimeout: 1,
830 },
831 &sfu.AudioConfig{
832 AudioLevelConfig: audio.AudioLevelConfig{
833 UpdateInterval: audioUpdateInterval,
834 SmoothIntervals: opts.audioSmoothIntervals,
835 },
836 },
837 &livekit.ServerInfo{
838 Edition: livekit.ServerInfo_Standard,
839 Version: version.Version,
840 Protocol: types.CurrentProtocol,
841 NodeId: "testnode",
842 Region: "testregion",
843 },
844 telemetry.NewTelemetryService(n, &telemetryfakes.FakeAnalyticsService{}),
845 nil, nil, nil,
846 )
847 for i := 0; i < opts.num+opts.numHidden; i++ {
848 identity := livekit.ParticipantIdentity(fmt.Sprintf("p%d", i))
849 participant := NewMockParticipant(identity, opts.protocol, i >= opts.num, true, rm.LocalParticipantListener())
850 err := rm.Join(participant, nil, &ParticipantOptions{AutoSubscribe: true}, iceServersForRoom)
851 require.NoError(t, err)
852 participant.StateReturns(livekit.ParticipantInfo_ACTIVE)
853 participant.IsReadyReturns(true)
854 // each participant has a track
855 participant.GetPublishedTracksReturns([]types.MediaTrack{
856 &typesfakes.FakeMediaTrack{},
857 })
858 }
859 return rm
860}

Callers 10

TestJoinedStateFunction · 0.85
TestRoomJoinFunction · 0.85
TestParticipantUpdateFunction · 0.85
TestRoomClosureFunction · 0.85
TestNewTrackFunction · 0.85
TestActiveSpeakersFunction · 0.85
TestDataChannelFunction · 0.85
TestHiddenParticipantsFunction · 0.85
TestRoomUpdateFunction · 0.85

Calls 8

JoinMethod · 0.95
NewTelemetryServiceFunction · 0.92
NewRoomFunction · 0.85
NewMockParticipantFunction · 0.85
IsReadyReturnsMethod · 0.80
StateReturnsMethod · 0.45

Tested by

no test coverage detected