mirror of
https://github.com/pion/webrtc.git
synced 2025-09-27 11:32:19 +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
56 lines
1.4 KiB
Go
56 lines
1.4 KiB
Go
package webrtc
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestNewRTCIceConnectionState(t *testing.T) {
|
|
testCases := []struct {
|
|
stateString string
|
|
expectedState RTCIceConnectionState
|
|
}{
|
|
{"unknown", RTCIceConnectionState(Unknown)},
|
|
{"new", RTCIceConnectionStateNew},
|
|
{"checking", RTCIceConnectionStateChecking},
|
|
{"connected", RTCIceConnectionStateConnected},
|
|
{"completed", RTCIceConnectionStateCompleted},
|
|
{"disconnected", RTCIceConnectionStateDisconnected},
|
|
{"failed", RTCIceConnectionStateFailed},
|
|
{"closed", RTCIceConnectionStateClosed},
|
|
}
|
|
|
|
for i, testCase := range testCases {
|
|
assert.Equal(t,
|
|
testCase.expectedState,
|
|
newRTCIceConnectionState(testCase.stateString),
|
|
"testCase: %d %v", i, testCase,
|
|
)
|
|
}
|
|
}
|
|
|
|
func TestRTCIceConnectionState_String(t *testing.T) {
|
|
testCases := []struct {
|
|
state RTCIceConnectionState
|
|
expectedString string
|
|
}{
|
|
{RTCIceConnectionState(Unknown), "unknown"},
|
|
{RTCIceConnectionStateNew, "new"},
|
|
{RTCIceConnectionStateChecking, "checking"},
|
|
{RTCIceConnectionStateConnected, "connected"},
|
|
{RTCIceConnectionStateCompleted, "completed"},
|
|
{RTCIceConnectionStateDisconnected, "disconnected"},
|
|
{RTCIceConnectionStateFailed, "failed"},
|
|
{RTCIceConnectionStateClosed, "closed"},
|
|
}
|
|
|
|
for i, testCase := range testCases {
|
|
assert.Equal(t,
|
|
testCase.expectedString,
|
|
testCase.state.String(),
|
|
"testCase: %d %v", i, testCase,
|
|
)
|
|
}
|
|
}
|