Add QpackEncoder::SetMaximumDynamicTableCapacity() and SetMaximumBlockedStreams() and call them when corresponding settings are received.

gfe-relnote: n/a, change to QUIC v99-only code.  Protected by existing disabled gfe2_reloadable_flag_quic_enable_version_99.
PiperOrigin-RevId: 261579634
Change-Id: Ice97e1d26210c622fbbf6c6894901ed6b44c01ca
diff --git a/quic/core/http/quic_spdy_session.cc b/quic/core/http/quic_spdy_session.cc
index 3c00c2b..2a83d24 100644
--- a/quic/core/http/quic_spdy_session.cc
+++ b/quic/core/http/quic_spdy_session.cc
@@ -647,7 +647,7 @@
         QUIC_DVLOG(1)
             << "SETTINGS_QPACK_MAX_TABLE_CAPACITY received with value "
             << value;
-        // TODO(b/112770235): implement.
+        qpack_encoder_->SetMaximumDynamicTableCapacity(value);
         break;
       case SETTINGS_MAX_HEADER_LIST_SIZE:
         QUIC_DVLOG(1) << "SETTINGS_MAX_HEADER_LIST_SIZE received with value "
@@ -657,7 +657,7 @@
       case SETTINGS_QPACK_BLOCKED_STREAMS:
         QUIC_DVLOG(1) << "SETTINGS_QPACK_BLOCKED_STREAMS received with value "
                       << value;
-        // TODO(b/112770235): implement.
+        qpack_encoder_->SetMaximumBlockedStreams(value);
         break;
       case SETTINGS_NUM_PLACEHOLDERS:
         QUIC_DVLOG(1) << "SETTINGS_NUM_PLACEHOLDERS received with value "
diff --git a/quic/core/http/quic_spdy_session_test.cc b/quic/core/http/quic_spdy_session_test.cc
index a2b4846..6a0b96e 100644
--- a/quic/core/http/quic_spdy_session_test.cc
+++ b/quic/core/http/quic_spdy_session_test.cc
@@ -25,6 +25,8 @@
 #include "net/third_party/quiche/src/quic/platform/api/quic_string_piece.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_test.h"
 #include "net/third_party/quiche/src/quic/platform/api/quic_text_utils.h"
+#include "net/third_party/quiche/src/quic/test_tools/qpack_encoder_peer.h"
+#include "net/third_party/quiche/src/quic/test_tools/qpack_header_table_peer.h"
 #include "net/third_party/quiche/src/quic/test_tools/quic_config_peer.h"
 #include "net/third_party/quiche/src/quic/test_tools/quic_connection_peer.h"
 #include "net/third_party/quiche/src/quic/test_tools/quic_flow_controller_peer.h"
@@ -2119,7 +2121,7 @@
   if (!VersionHasStreamType(transport_version())) {
     return;
   }
-  // Use a arbitrary stream id.
+  // Use an arbitrary stream id.
   QuicStreamId stream_id =
       GetNthClientInitiatedUnidirectionalStreamId(transport_version(), 3);
   char type[] = {kControlStream};
@@ -2130,14 +2132,27 @@
             QuicSpdySessionPeer::GetReceiveControlStream(&session_)->id());
 
   SettingsFrame settings;
-  settings.values[3] = 2;
+  settings.values[SETTINGS_QPACK_MAX_TABLE_CAPACITY] = 512;
   settings.values[SETTINGS_MAX_HEADER_LIST_SIZE] = 5;
+  settings.values[SETTINGS_QPACK_BLOCKED_STREAMS] = 42;
   std::string data = EncodeSettings(settings);
   QuicStreamFrame frame(stream_id, false, 1, QuicStringPiece(data));
 
+  QpackEncoder* qpack_encoder = session_.qpack_encoder();
+  QpackHeaderTable* header_table =
+      QpackEncoderPeer::header_table(qpack_encoder);
+
+  EXPECT_NE(512u,
+            QpackHeaderTablePeer::maximum_dynamic_table_capacity(header_table));
   EXPECT_NE(5u, session_.max_outbound_header_list_size());
+  EXPECT_NE(42u, QpackEncoderPeer::maximum_blocked_streams(qpack_encoder));
+
   session_.OnStreamFrame(frame);
+
+  EXPECT_EQ(512u,
+            QpackHeaderTablePeer::maximum_dynamic_table_capacity(header_table));
   EXPECT_EQ(5u, session_.max_outbound_header_list_size());
+  EXPECT_EQ(42u, QpackEncoderPeer::maximum_blocked_streams(qpack_encoder));
 }
 
 TEST_P(QuicSpdySessionTestServer, ReceiveControlStreamOutOfOrderDelivery) {