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_session_test.cc b/quic/core/quic_session_test.cc
index 5ea8633..6188b05 100644
--- a/quic/core/quic_session_test.cc
+++ b/quic/core/quic_session_test.cc
@@ -1766,6 +1766,27 @@
   EXPECT_EQ(0, session_.num_incoming_streams_created());
 }
 
+TEST_P(QuicSessionTestServer, PendingStreamOnWindowUpdate) {
+  if (!VersionHasIetfQuicFrames(transport_version())) {
+    return;
+  }
+
+  session_.set_uses_pending_streams(true);
+  QuicStreamId stream_id = QuicUtils::GetFirstUnidirectionalStreamId(
+      transport_version(), Perspective::IS_CLIENT);
+  QuicStreamFrame data1(stream_id, true, 10, QuicStringPiece("HT"));
+  session_.OnStreamFrame(data1);
+  EXPECT_EQ(0, session_.num_incoming_streams_created());
+  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.", _));
+  session_.OnWindowUpdateFrame(window_update_frame);
+}
+
 TEST_P(QuicSessionTestServer, DrainingStreamsDoNotCountAsOpened) {
   // Verify that a draining stream (which has received a FIN but not consumed
   // it) does not count against the open quota (because it is closed from the