@@ -619,31 +619,22 @@ func TestOnICEGatheringStateChange(t *testing.T) {
619
619
seenComplete := & atomicBool {}
620
620
621
621
seenGatheringAndComplete := make (chan interface {})
622
- seenClosed := make (chan interface {})
623
622
624
623
peerConn , err := NewPeerConnection (Configuration {})
625
624
assert .NoError (t , err )
626
625
627
- var onStateChange func (s ICEGathererState )
628
- onStateChange = func (s ICEGathererState ) {
626
+ var onStateChange func (s ICEGatheringState )
627
+ onStateChange = func (s ICEGatheringState ) {
629
628
// Access to ICEGatherer in the callback must not cause dead lock.
630
629
peerConn .OnICEGatheringStateChange (onStateChange )
631
- if state := peerConn .iceGatherer .State (); state != s {
632
- t .Errorf ("State change callback argument (%s) and State() (%s) result differs" ,
633
- s , state ,
634
- )
635
- }
636
630
637
631
switch s { // nolint:exhaustive
638
- case ICEGathererStateClosed :
639
- close (seenClosed )
640
- return
641
- case ICEGathererStateGathering :
632
+ case ICEGatheringStateGathering :
642
633
if seenComplete .get () {
643
634
t .Error ("Completed before gathering" )
644
635
}
645
636
seenGathering .set (true )
646
- case ICEGathererStateComplete :
637
+ case ICEGatheringStateComplete :
647
638
seenComplete .set (true )
648
639
}
649
640
@@ -660,18 +651,10 @@ func TestOnICEGatheringStateChange(t *testing.T) {
660
651
select {
661
652
case <- time .After (time .Second * 10 ):
662
653
t .Fatal ("Gathering and Complete were never seen" )
663
- case <- seenClosed :
664
- t .Fatal ("Closed before PeerConnection Close" )
665
654
case <- seenGatheringAndComplete :
666
655
}
667
656
668
657
assert .NoError (t , peerConn .Close ())
669
-
670
- select {
671
- case <- time .After (time .Second * 10 ):
672
- t .Fatal ("Closed was never seen" )
673
- case <- seenClosed :
674
- }
675
658
}
676
659
677
660
// Assert Trickle ICE behaviors
0 commit comments