mirror of
https://github.com/pion/webrtc.git
synced 2025-10-05 07:06:51 +08:00
Updates per code reviews
Use ICECandidateType instead of string Combine two methods to one SetNAT1To1IPs Resolves #835
This commit is contained in:
@@ -61,3 +61,23 @@ func TestDetachDataChannels(t *testing.T) {
|
||||
t.Fatalf("Failed to enable detached data channels.")
|
||||
}
|
||||
}
|
||||
|
||||
func TestSetNAT1To1IPs(t *testing.T) {
|
||||
s := SettingEngine{}
|
||||
if s.candidates.NAT1To1IPs != nil {
|
||||
t.Errorf("Invalid default value")
|
||||
}
|
||||
if s.candidates.NAT1To1IPCandidateType != 0 {
|
||||
t.Errorf("Invalid default value")
|
||||
}
|
||||
|
||||
ips := []string{"1.2.3.4"}
|
||||
typ := ICECandidateTypeHost
|
||||
s.SetNAT1To1IPs(ips, typ)
|
||||
if len(s.candidates.NAT1To1IPs) != 1 || s.candidates.NAT1To1IPs[0] != "1.2.3.4" {
|
||||
t.Fatalf("Failed to set NAT1To1IPs")
|
||||
}
|
||||
if s.candidates.NAT1To1IPCandidateType != typ {
|
||||
t.Fatalf("Failed to set NAT1To1IPCandidateType")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user