http2: nit in TestServer_Push_StateTransitions

Oops: forgot to git commit these nits locally before uploading
https://go-review.googlesource.com/34984

Change-Id: I98995ea9f6ecdde731cd298ff54afe5047ae136e
Reviewed-on: https://go-review.googlesource.com/34985
Run-TryBot: Tom Bergan <tombergan@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/http2/server_push_test.go b/http2/server_push_test.go
index eaab30c..f70edd3 100644
--- a/http2/server_push_test.go
+++ b/http2/server_push_test.go
@@ -430,7 +430,6 @@
 func TestServer_Push_StateTransitions(t *testing.T) {
 	const body = "foo"
 
-	startedPromise := make(chan bool)
 	gotPromise := make(chan bool)
 	finishedPush := make(chan bool)
 
@@ -440,7 +439,6 @@
 			if err := w.(http.Pusher).Push("/pushed", nil); err != nil {
 				t.Errorf("Push error: %v", err)
 			}
-			close(startedPromise)
 			// Don't finish this request until the push finishes so we don't
 			// nondeterministically interleave output frames with the push.
 			<-finishedPush
@@ -462,11 +460,15 @@
 		t.Fatalf("streamState(2)=%v, want %v", got, want)
 	}
 	getSlash(st)
-	<-startedPromise
+	// After the PUSH_PROMISE is sent, the stream should be stateHalfClosedRemote.
 	st.wantPushPromise()
 	if got, want := st.streamState(2), stateHalfClosedRemote; got != want {
 		t.Fatalf("streamState(2)=%v, want %v", got, want)
 	}
+	// We stall the HTTP handler for "/pushed" until the above check. If we don't
+	// stall the handler, then the handler might write HEADERS and DATA and finish
+	// the stream before we check st.streamState(2) -- should that happen, we'll
+	// see stateClosed and fail the above check.
 	close(gotPromise)
 	st.wantHeaders()
 	if df := st.wantData(); !df.StreamEnded() {