commit f024f6b832dc587b60809b2cebf29068a13a3759
Author: Serene Han <keroserene+...@gmail.com>
Date:   Sat Mar 26 18:34:04 2016 -0700

    create and removing from webrtcRemotes test
---
 client/client_test.go | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/client/client_test.go b/client/client_test.go
index 5e683ba..1f6f0a6 100644
--- a/client/client_test.go
+++ b/client/client_test.go
@@ -49,6 +49,7 @@ func (m *MockTransport) RoundTrip(req *http.Request) 
(*http.Response, error) {
 
 func TestConnect(t *testing.T) {
        Convey("Snowflake", t, func() {
+               webrtcRemotes = make(map[int]*webRTCConn)
 
                Convey("WebRTC Connection", func() {
                        c := new(webRTCConn)
@@ -58,6 +59,19 @@ func TestConnect(t *testing.T) {
                        }
                        So(c.buffer.Bytes(), ShouldEqual, nil)
 
+                       Convey("Create and remove from WebRTCConn set", func() {
+                               So(len(webrtcRemotes), ShouldEqual, 0)
+                               So(remoteIndex, ShouldEqual, 0)
+                               s := NewWebRTCConnection(nil, nil)
+                               So(s, ShouldNotBeNil)
+                               So(s.index, ShouldEqual, 0)
+                               So(len(webrtcRemotes), ShouldEqual, 1)
+                               So(remoteIndex, ShouldEqual, 1)
+                               s.Close()
+                               So(len(webrtcRemotes), ShouldEqual, 0)
+                               So(remoteIndex, ShouldEqual, 1)
+                       })
+
                        Convey("Write buffers when datachannel is nil", func() {
                                c.Write([]byte("test"))
                                c.snowflake = nil

_______________________________________________
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits

Reply via email to