gfe-relnote: Use QPACK Dynamic Table in the toy client and server, but not in the test client and server. Protected by disabled --v99 flag.

PiperOrigin-RevId: 275026885
Change-Id: I9d051f4b377992a03e974c6f4f57e9fee6970c63
diff --git a/quic/test_tools/quic_test_client.cc b/quic/test_tools/quic_test_client.cc
index 3531318..237d9f6 100644
--- a/quic/test_tools/quic_test_client.cc
+++ b/quic/test_tools/quic_test_client.cc
@@ -347,6 +347,10 @@
   num_requests_ = 0;
   num_responses_ = 0;
   ClearPerConnectionState();
+  // TODO(b/142715651): Figure out how to use QPACK in tests.
+  // Do not use the QPACK dynamic table in tests to avoid flakiness due to the
+  // uncertain order of receiving the SETTINGS frame and sending headers.
+  client_->disable_qpack_dynamic_table();
   // As chrome will generally do this, we want it to be the default when it's
   // not overridden.
   if (!client_->config()->HasSetBytesForConnectionIdToSend()) {
diff --git a/quic/test_tools/quic_test_server.cc b/quic/test_tools/quic_test_server.cc
index 26e50a8..a893830 100644
--- a/quic/test_tools/quic_test_server.cc
+++ b/quic/test_tools/quic_test_server.cc
@@ -118,6 +118,11 @@
           config(), connection, this, session_helper(), crypto_config(),
           compressed_certs_cache(), server_backend());
     }
+    // TODO(b/142715651): Figure out how to use QPACK in tests.
+    // Do not use the QPACK dynamic table in tests to avoid flakiness due to the
+    // uncertain order of receiving the SETTINGS frame and sending headers.
+    session->set_qpack_maximum_dynamic_table_capacity(0);
+    session->set_qpack_maximum_blocked_streams(0);
     session->Initialize();
     return session;
   }
diff --git a/quic/tools/quic_simple_client_session.cc b/quic/tools/quic_simple_client_session.cc
index c62786f..38ff4fc 100644
--- a/quic/tools/quic_simple_client_session.cc
+++ b/quic/tools/quic_simple_client_session.cc
@@ -22,12 +22,7 @@
                             server_id,
                             crypto_config,
                             push_promise_index),
-      drop_response_body_(drop_response_body) {
-  // Do not use the QPACK dynamic table in tests to avoid flakiness due to the
-  // uncertain order of receiving the SETTINGS frame and sending headers.
-  set_qpack_maximum_dynamic_table_capacity(0);
-  set_qpack_maximum_blocked_streams(0);
-}
+      drop_response_body_(drop_response_body) {}
 
 std::unique_ptr<QuicSpdyClientStream>
 QuicSimpleClientSession::CreateClientStream() {
diff --git a/quic/tools/quic_simple_server_session.cc b/quic/tools/quic_simple_server_session.cc
index b2ee913..c60a9e2 100644
--- a/quic/tools/quic_simple_server_session.cc
+++ b/quic/tools/quic_simple_server_session.cc
@@ -36,11 +36,6 @@
           QuicUtils::GetInvalidStreamId(connection->transport_version())),
       quic_simple_server_backend_(quic_simple_server_backend) {
   DCHECK(quic_simple_server_backend_);
-
-  // Do not use the QPACK dynamic table in tests to avoid flakiness due to the
-  // uncertain order of receiving the SETTINGS frame and sending headers.
-  set_qpack_maximum_dynamic_table_capacity(0);
-  set_qpack_maximum_blocked_streams(0);
 }
 
 QuicSimpleServerSession::~QuicSimpleServerSession() {
diff --git a/quic/tools/quic_spdy_client_base.cc b/quic/tools/quic_spdy_client_base.cc
index ab1542d..3cd4cbd 100644
--- a/quic/tools/quic_spdy_client_base.cc
+++ b/quic/tools/quic_spdy_client_base.cc
@@ -47,7 +47,8 @@
                      std::move(proof_verifier)),
       store_response_(false),
       latest_response_code_(-1),
-      max_allowed_push_id_(0) {}
+      max_allowed_push_id_(0),
+      disable_qpack_dynamic_table_(false) {}
 
 QuicSpdyClientBase::~QuicSpdyClientBase() {
   // We own the push promise index. We need to explicitly kill
@@ -60,6 +61,10 @@
 }
 
 void QuicSpdyClientBase::InitializeSession() {
+  if (disable_qpack_dynamic_table_) {
+    client_session()->set_qpack_maximum_dynamic_table_capacity(0);
+    client_session()->set_qpack_maximum_blocked_streams(0);
+  }
   client_session()->Initialize();
   client_session()->CryptoConnect();
   if (max_allowed_push_id_ > 0) {
diff --git a/quic/tools/quic_spdy_client_base.h b/quic/tools/quic_spdy_client_base.h
index 3107d60..2a1267f 100644
--- a/quic/tools/quic_spdy_client_base.h
+++ b/quic/tools/quic_spdy_client_base.h
@@ -139,6 +139,10 @@
   // Set the max promise id for the client session.
   void SetMaxAllowedPushId(QuicStreamId max) { max_allowed_push_id_ = max; }
 
+  // Disables the use of the QPACK dynamic table and of blocked streams.
+  // Must be called before InitializeSession().
+  void disable_qpack_dynamic_table() { disable_qpack_dynamic_table_ = true; }
+
  protected:
   int GetNumSentClientHellosFromSession() override;
   int GetNumReceivedServerConfigUpdatesFromSession() override;
@@ -215,6 +219,8 @@
 
   // The max promise id to set on the client session when created.
   QuicStreamId max_allowed_push_id_;
+
+  bool disable_qpack_dynamic_table_;
 };
 
 }  // namespace quic
diff --git a/quic/tools/quic_toy_client.cc b/quic/tools/quic_toy_client.cc
index a9a3886..eee4e61 100644
--- a/quic/tools/quic_toy_client.cc
+++ b/quic/tools/quic_toy_client.cc
@@ -237,6 +237,10 @@
     std::cerr << "Failed to initialize client." << std::endl;
     return 1;
   }
+  client->client_session()->set_qpack_maximum_dynamic_table_capacity(
+      kDefaultQpackMaxDynamicTableCapacity);
+  client->client_session()->set_qpack_maximum_blocked_streams(
+      kDefaultMaximumBlockedStreams);
   if (!client->Connect()) {
     quic::QuicErrorCode error = client->session()->error();
     if (error == quic::QUIC_INVALID_VERSION) {