diff options
| author | Russ Cox <rsc@golang.org> | 2014-10-03 12:22:19 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2014-10-03 12:22:19 -0400 |
| commit | 904ec0098137f742e0dd96da3bc033d6a0b615d1 (patch) | |
| tree | 6a05a91443927524fcb78ac82df0142d8e6ae71f /src/net/http/export_test.go | |
| parent | d42328c9f749140adf947833e0381fc639c32737 (diff) | |
| parent | c65a47f890e33eeed6ee9d8b6d965a5534fb6e0e (diff) | |
| download | go-904ec0098137f742e0dd96da3bc033d6a0b615d1.tar.xz | |
[dev.garbage] merge default into dev.garbage
Diffstat (limited to 'src/net/http/export_test.go')
| -rw-r--r-- | src/net/http/export_test.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/net/http/export_test.go b/src/net/http/export_test.go index 2c87353554..a6980b5389 100644 --- a/src/net/http/export_test.go +++ b/src/net/http/export_test.go @@ -57,6 +57,26 @@ func (t *Transport) IdleConnChMapSizeForTesting() int { return len(t.idleConnCh) } +func (t *Transport) IsIdleForTesting() bool { + t.idleMu.Lock() + defer t.idleMu.Unlock() + return t.wantIdle +} + +func (t *Transport) RequestIdleConnChForTesting() { + t.getIdleConnCh(connectMethod{nil, "http", "example.com"}) +} + +func (t *Transport) PutIdleTestConn() bool { + c, _ := net.Pipe() + return t.putIdleConn(&persistConn{ + t: t, + conn: c, // dummy + closech: make(chan struct{}), // so it can be closed + cacheKey: connectMethodKey{"", "http", "example.com"}, + }) +} + func NewTestTimeoutHandler(handler Handler, ch <-chan time.Time) Handler { f := func() <-chan time.Time { return ch @@ -66,6 +86,7 @@ func NewTestTimeoutHandler(handler Handler, ch <-chan time.Time) Handler { func ResetCachedEnvironment() { httpProxyEnv.reset() + httpsProxyEnv.reset() noProxyEnv.reset() } @@ -76,3 +97,7 @@ var DefaultUserAgent = defaultUserAgent func SetPendingDialHooks(before, after func()) { prePendingDial, postPendingDial = before, after } + +var ExportServerNewConn = (*Server).newConn + +var ExportCloseWriteAndWait = (*conn).closeWriteAndWait |
