MCPcopy Create free account
hub / github.com/pion/ice / TestMultipleConfigOptions

Function TestMultipleConfigOptions

agent_options_test.go:494–525  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

492}
493
494func TestMultipleConfigOptions(t *testing.T) {
495 t.Run("can apply multiple options", func(t *testing.T) {
496 customOffset := uint16(100)
497 handlerCalled := false
498 handler := func(_ *stun.Message, _, _ Candidate, _ *CandidatePair) bool {
499 handlerCalled = true
500
501 return true
502 }
503
504 agent, err := NewAgentWithOptions(
505 WithIncludeLoopback(),
506 WithTCPPriorityOffset(customOffset),
507 WithDisableActiveTCP(),
508 WithBindingRequestHandler(handler),
509 WithEnableUseCandidateCheckPriority(),
510 )
511 assert.NoError(t, err)
512 defer agent.Close() //nolint:errcheck
513
514 assert.True(t, agent.includeLoopback)
515 assert.Equal(t, customOffset, agent.tcpPriorityOffset)
516 assert.True(t, agent.disableActiveTCP)
517 assert.NotNil(t, agent.userBindingRequestHandler)
518 assert.True(t, agent.enableUseCandidateCheckPriority)
519
520 if agent.userBindingRequestHandler != nil {
521 agent.userBindingRequestHandler(nil, nil, nil, nil)
522 assert.True(t, handlerCalled)
523 }
524 })
525}
526
527func TestWithInterfaceFilter(t *testing.T) {
528 t.Run("sets interface filter", func(t *testing.T) {

Callers

nothing calls this directly

Calls 9

NewAgentWithOptionsFunction · 0.85
WithIncludeLoopbackFunction · 0.85
WithTCPPriorityOffsetFunction · 0.85
WithDisableActiveTCPFunction · 0.85
RunMethod · 0.80
CloseMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…