mirror of
https://github.com/pion/webrtc.git
synced 2025-09-27 03:25:58 +08:00

Modify RTCSdpType to protect newRTCSdpType Modify RTCPriorityType to protect methods Modify RTCSctpTransportState to protect methods Modify RTCRtcpMuxPolicy to protect methods Modify RTCPeerConnectionState to protect methods Modify RTCIceTransportPolicy to protect methods Modify RTCIceGatheringState to protect methods Modify RTCIceCredentialType to protect methods Modify RTCIceConnectionState to protect methods Modify RTCDtlsTransportState to protect methods Modify RTCDataChannelState to protect methods Modify RTCBundlePolicy to protect methods Relates to #83
54 lines
1.3 KiB
Go
54 lines
1.3 KiB
Go
package webrtc
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestNewRTCPeerConnectionState(t *testing.T) {
|
|
testCases := []struct {
|
|
stateString string
|
|
expectedState RTCPeerConnectionState
|
|
}{
|
|
{"unknown", RTCPeerConnectionState(Unknown)},
|
|
{"new", RTCPeerConnectionStateNew},
|
|
{"connecting", RTCPeerConnectionStateConnecting},
|
|
{"connected", RTCPeerConnectionStateConnected},
|
|
{"disconnected", RTCPeerConnectionStateDisconnected},
|
|
{"failed", RTCPeerConnectionStateFailed},
|
|
{"closed", RTCPeerConnectionStateClosed},
|
|
}
|
|
|
|
for i, testCase := range testCases {
|
|
assert.Equal(t,
|
|
testCase.expectedState,
|
|
newRTCPeerConnectionState(testCase.stateString),
|
|
"testCase: %d %v", i, testCase,
|
|
)
|
|
}
|
|
}
|
|
|
|
func TestRTCPeerConnectionState_String(t *testing.T) {
|
|
testCases := []struct {
|
|
state RTCPeerConnectionState
|
|
expectedString string
|
|
}{
|
|
{RTCPeerConnectionState(Unknown), "unknown"},
|
|
{RTCPeerConnectionStateNew, "new"},
|
|
{RTCPeerConnectionStateConnecting, "connecting"},
|
|
{RTCPeerConnectionStateConnected, "connected"},
|
|
{RTCPeerConnectionStateDisconnected, "disconnected"},
|
|
{RTCPeerConnectionStateFailed, "failed"},
|
|
{RTCPeerConnectionStateClosed, "closed"},
|
|
}
|
|
|
|
for i, testCase := range testCases {
|
|
assert.Equal(t,
|
|
testCase.expectedString,
|
|
testCase.state.String(),
|
|
"testCase: %d %v", i, testCase,
|
|
)
|
|
}
|
|
}
|