In v99, close the connection if the peer sets the number of unidirectional stream less than the minimum required unidirectional streams.

The spec is reflected at https://quicwg.org/base-drafts/draft-ietf-quic-http.html#rfc.section.6.2

gfe-relnote: v99 only, not protected.
PiperOrigin-RevId: 267241053
Change-Id: I0fc9e909e90d023b5b99cc1a5bb6a37d5c592ab6
diff --git a/quic/core/http/quic_spdy_session_test.cc b/quic/core/http/quic_spdy_session_test.cc
index 55de8b6..4b14600 100644
--- a/quic/core/http/quic_spdy_session_test.cc
+++ b/quic/core/http/quic_spdy_session_test.cc
@@ -13,6 +13,7 @@
 #include "net/third_party/quiche/src/quic/core/crypto/null_encrypter.h"
 #include "net/third_party/quiche/src/quic/core/frames/quic_stream_frame.h"
 #include "net/third_party/quiche/src/quic/core/http/http_constants.h"
+#include "net/third_party/quiche/src/quic/core/quic_config.h"
 #include "net/third_party/quiche/src/quic/core/quic_crypto_stream.h"
 #include "net/third_party/quiche/src/quic/core/quic_data_writer.h"
 #include "net/third_party/quiche/src/quic/core/quic_packets.h"
@@ -1514,6 +1515,23 @@
   session_.OnConfigNegotiated();
 }
 
+TEST_P(QuicSpdySessionTestServer, TooLowUnidirectionalStreamLimitHttp3) {
+  if (!VersionUsesQpack(transport_version()) ||
+      GetParam().handshake_protocol == PROTOCOL_TLS1_3) {
+    // TODO(nharper, b/112643533): Figure out why this test fails when TLS is
+    // enabled and fix it.
+    return;
+  }
+
+  QuicConfigPeer::SetReceivedMaxIncomingUnidirectionalStreams(session_.config(),
+                                                              2u);
+
+  EXPECT_CALL(
+      *connection_,
+      CloseConnection(_, "New unidirectional stream limit is too low.", _));
+  session_.OnConfigNegotiated();
+}
+
 // Test negotiation of custom server initial flow control window.
 TEST_P(QuicSpdySessionTestServer, CustomFlowControlWindow) {
   QuicTagVector copt;