summaryrefslogtreecommitdiff
path: root/src/net/http/export_test.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-10-03 12:22:19 -0400
committerRuss Cox <rsc@golang.org>2014-10-03 12:22:19 -0400
commitc5aca6fedbdd83d9153f6a00dc656aaabb0774c5 (patch)
tree26952b971b307783cde4b126c0a133f62ac3c893 /src/net/http/export_test.go
parent4eb6792aa572c7e6d3448d4cf22223b61b65724f (diff)
parent338c7ea5df93e25ac4dc143970603a1e88b26124 (diff)
downloadgo-c5aca6fedbdd83d9153f6a00dc656aaabb0774c5.tar.gz
[dev.garbage] merge default into dev.garbage
Diffstat (limited to 'src/net/http/export_test.go')
-rw-r--r--src/net/http/export_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/net/http/export_test.go b/src/net/http/export_test.go
index 2c8735355..a6980b538 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