Add test to ensure that a push promise on a data stream closes the connection.

PiperOrigin-RevId: 254464588
Change-Id: I34740473fe71bf19ef443f97ebc8afe52200d758
diff --git a/quic/core/http/quic_spdy_stream_test.cc b/quic/core/http/quic_spdy_stream_test.cc
index 348e5d3..2cb4bce 100644
--- a/quic/core/http/quic_spdy_stream_test.cc
+++ b/quic/core/http/quic_spdy_stream_test.cc
@@ -1920,6 +1920,27 @@
               ElementsAre(Pair("custom-key", "custom-value")));
 }
 
+TEST_P(QuicSpdyStreamTest, PushPromiseOnDataStreamShouldClose) {
+  Initialize(kShouldProcessData);
+  if (!HasFrameHeader()) {
+    return;
+  }
+  PushPromiseFrame push_promise;
+  push_promise.push_id = 0x01;
+  push_promise.headers = "Headers";
+  std::unique_ptr<char[]> buffer;
+  HttpEncoder encoder;
+  uint64_t length =
+      encoder.SerializePushPromiseFrameWithOnlyPushId(push_promise, &buffer);
+  QuicStreamFrame frame(stream_->id(), false, 0, buffer.get(), length);
+  // TODO(lassey): Check for HTTP_WRONG_STREAM error code.
+  EXPECT_CALL(*connection_, CloseConnection(QUIC_HTTP_DECODER_ERROR, _, _));
+  stream_->OnStreamHeadersPriority(kV3HighestPriority);
+  ProcessHeaders(false, headers_);
+  stream_->ConsumeHeaderList();
+  stream_->OnStreamFrame(frame);
+}
+
 }  // namespace
 }  // namespace test
 }  // namespace quic