Add test to ensure that a push promise on a control stream closes the connection. PiperOrigin-RevId: 254464587 Change-Id: Ie60521fb0e5a040635ed59db907a755703bb14b5
diff --git a/quic/core/http/quic_receive_control_stream_test.cc b/quic/core/http/quic_receive_control_stream_test.cc index e0acf89..94456a9 100644 --- a/quic/core/http/quic_receive_control_stream_test.cc +++ b/quic/core/http/quic_receive_control_stream_test.cc
@@ -13,6 +13,7 @@ namespace { using ::testing::_; +using ::testing::AtLeast; using ::testing::StrictMock; struct TestParams { @@ -154,6 +155,22 @@ receive_control_stream_->OnStreamFrame(frame); } +TEST_P(QuicReceiveControlStreamTest, PushPromiseOnControlStreamShouldClose) { + 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(receive_control_stream_->id(), false, 0, buffer.get(), + length); + // TODO(lassey) Check for HTTP_WRONG_STREAM error code. + EXPECT_CALL(*connection_, CloseConnection(QUIC_HTTP_DECODER_ERROR, _, _)) + .Times(AtLeast(1)); + receive_control_stream_->OnStreamFrame(frame); +} + } // namespace } // namespace test } // namespace quic