progress with a bit of tests

This commit is contained in:
David Zhao
2020-12-21 23:23:57 -08:00
parent 2a79bdb678
commit ed472c8569
3 changed files with 36 additions and 13 deletions
+23
View File
@@ -2,6 +2,9 @@ package rtc
import (
"github.com/golang/mock/gomock"
"github.com/livekit/livekit-server/pkg/utils"
"github.com/livekit/livekit-server/proto/livekit"
)
func newMockPeerConnection(mockCtrl *gomock.Controller) *MockPeerConnection {
@@ -13,3 +16,23 @@ func newMockPeerConnection(mockCtrl *gomock.Controller) *MockPeerConnection {
pc.EXPECT().OnTrack(gomock.Any()).AnyTimes()
return pc
}
func newMockSignalConnection(mockCtrl *gomock.Controller) *MockSignalConnection {
sc := NewMockSignalConnection(mockCtrl)
return sc
}
func newMockParticipant(mockCtrl *gomock.Controller) *MockParticipant {
p := NewMockParticipant(mockCtrl)
p.EXPECT().ID().Return(utils.NewGuid(utils.ParticipantPrefix)).AnyTimes()
p.EXPECT().Name().Return("tester").AnyTimes()
p.EXPECT().State().Return(livekit.ParticipantInfo_JOINED).AnyTimes()
// default callbacks
p.EXPECT().OnICECandidate(gomock.Any()).AnyTimes()
p.EXPECT().OnClose(gomock.Any()).AnyTimes()
p.EXPECT().OnOffer(gomock.Any()).AnyTimes()
p.EXPECT().OnStateChange(gomock.Any()).AnyTimes()
p.EXPECT().OnTrackPublished(gomock.Any()).AnyTimes()
return p
}