From 56e74239d6b34df8f30ef046f0b0ff4ff0866a71 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Sun, 14 Jun 2015 23:53:32 -0800 Subject: first commit --- .../github.com/braintree/manners/helper_test.go | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Godeps/_workspace/src/github.com/braintree/manners/helper_test.go (limited to 'Godeps/_workspace/src/github.com/braintree/manners/helper_test.go') diff --git a/Godeps/_workspace/src/github.com/braintree/manners/helper_test.go b/Godeps/_workspace/src/github.com/braintree/manners/helper_test.go new file mode 100644 index 000000000..ea721a180 --- /dev/null +++ b/Godeps/_workspace/src/github.com/braintree/manners/helper_test.go @@ -0,0 +1,34 @@ +package manners + +import ( + "net/http" + "time" +) + +// A response handler that blocks until it receives a signal; simulates an +// arbitrarily long web request. The "ready" channel is to prevent a race +// condition in the test where the test moves on before the server is ready +// to handle the request. +func newBlockingHandler(ready, done chan bool) *blockingHandler { + return &blockingHandler{ready, done} +} + +type blockingHandler struct { + ready chan bool + done chan bool +} + +func (h *blockingHandler) ServeHTTP(resp http.ResponseWriter, req *http.Request) { + h.ready <- true + time.Sleep(1e2) + h.done <- true +} + +// A response handler that does nothing. +func newTestHandler() testHandler { + return testHandler{} +} + +type testHandler struct{} + +func (h testHandler) ServeHTTP(resp http.ResponseWriter, req *http.Request) {} -- cgit v1.2.3-1-g7c22