Redirect WindowUpdate frame to pending streams if they are present, and closes connection when a WindowUpdate frame is received on a READ_UNIDIRECTIONAL stream.

We determined that at least in the foreseeable future, pending streams will only be READ_UNIDIRECTIONAL, so they will close connection when receives WindowUpdate frame.

gfe-relnote: protected by gfe2_reloadable_flag_quic_no_window_update_on_read_only_stream.
PiperOrigin-RevId: 256041719
Change-Id: Ie7caf100a890f770bb1863d6479d66a5e0820e2a
diff --git a/quic/core/quic_stream_test.cc b/quic/core/quic_stream_test.cc
index 45fae55..ee9676f 100644
--- a/quic/core/quic_stream_test.cc
+++ b/quic/core/quic_stream_test.cc
@@ -1693,6 +1693,23 @@
   EXPECT_TRUE(stream_->write_side_closed());
 }
 
+TEST_P(QuicStreamTest, WindowUpdateForReadOnlyStream) {
+  SetQuicReloadableFlag(quic_no_window_update_on_read_only_stream, true);
+  Initialize();
+
+  QuicStreamId stream_id = QuicUtils::GetFirstUnidirectionalStreamId(
+      connection_->transport_version(), Perspective::IS_CLIENT);
+  TestStream stream(stream_id, session_.get(), READ_UNIDIRECTIONAL);
+  QuicWindowUpdateFrame window_update_frame(kInvalidControlFrameId, stream_id,
+                                            0);
+  EXPECT_CALL(
+      *connection_,
+      CloseConnection(
+          QUIC_WINDOW_UPDATE_RECEIVED_ON_READ_UNIDIRECTIONAL_STREAM,
+          "WindowUpdateFrame received on READ_UNIDIRECTIONAL stream.", _));
+  stream.OnWindowUpdateFrame(window_update_frame);
+}
+
 }  // namespace
 }  // namespace test
 }  // namespace quic