diff options
Diffstat (limited to 'src/pkg/net/http/export_test.go')
-rw-r--r-- | src/pkg/net/http/export_test.go | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/src/pkg/net/http/export_test.go b/src/pkg/net/http/export_test.go deleted file mode 100644 index 960563b24..000000000 --- a/src/pkg/net/http/export_test.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Bridge package to expose http internals to tests in the http_test -// package. - -package http - -import ( - "net" - "time" -) - -func NewLoggingConn(baseName string, c net.Conn) net.Conn { - return newLoggingConn(baseName, c) -} - -var ExportAppendTime = appendTime - -func (t *Transport) NumPendingRequestsForTesting() int { - t.reqMu.Lock() - defer t.reqMu.Unlock() - return len(t.reqCanceler) -} - -func (t *Transport) IdleConnKeysForTesting() (keys []string) { - keys = make([]string, 0) - t.idleMu.Lock() - defer t.idleMu.Unlock() - if t.idleConn == nil { - return - } - for key := range t.idleConn { - keys = append(keys, key.String()) - } - return -} - -func (t *Transport) IdleConnCountForTesting(cacheKey string) int { - t.idleMu.Lock() - defer t.idleMu.Unlock() - if t.idleConn == nil { - return 0 - } - for k, conns := range t.idleConn { - if k.String() == cacheKey { - return len(conns) - } - } - return 0 -} - -func (t *Transport) IdleConnChMapSizeForTesting() int { - t.idleMu.Lock() - defer t.idleMu.Unlock() - return len(t.idleConnCh) -} - -func NewTestTimeoutHandler(handler Handler, ch <-chan time.Time) Handler { - f := func() <-chan time.Time { - return ch - } - return &timeoutHandler{handler, f, ""} -} - -func ResetCachedEnvironment() { - httpProxyEnv.reset() - noProxyEnv.reset() -} - -var DefaultUserAgent = defaultUserAgent |