No longer send SETTINGS in gQUIC.

The frame is discarded by the peer. So we don't need to send this data.

gfe-relnote: protected by gfe2_reloadable_flag_quic_do_not_send_settings.
PiperOrigin-RevId: 265543664
Change-Id: Ie2333e55051bb6c3111b855be481b2d64bca079a
diff --git a/quic/core/http/quic_spdy_session.cc b/quic/core/http/quic_spdy_session.cc
index 08ff7e6..491f1de 100644
--- a/quic/core/http/quic_spdy_session.cc
+++ b/quic/core/http/quic_spdy_session.cc
@@ -568,6 +568,11 @@
     qpack_decoder_send_stream_->MaybeSendStreamType();
     return;
   }
+  if (GetQuicReloadableFlag(quic_do_not_send_settings)) {
+    QUIC_RELOADABLE_FLAG_COUNT(quic_do_not_send_settings);
+    return;
+  }
+
   SpdySettingsIR settings_frame;
   settings_frame.AddSetting(SETTINGS_MAX_HEADER_LIST_SIZE, value);
 
diff --git a/quic/core/http/quic_spdy_session_test.cc b/quic/core/http/quic_spdy_session_test.cc
index 0520c70..34f0b92 100644
--- a/quic/core/http/quic_spdy_session_test.cc
+++ b/quic/core/http/quic_spdy_session_test.cc
@@ -417,7 +417,14 @@
 }
 
 TEST_P(QuicSpdySessionTestServer, IsCryptoHandshakeConfirmed) {
-  EXPECT_CALL(*connection_, CloseConnection(_, _, _));
+  if (!GetQuicReloadableFlag(quic_do_not_send_settings) ||
+      VersionUsesQpack(transport_version())) {
+    MockPacketWriter* writer = static_cast<MockPacketWriter*>(
+        QuicConnectionPeer::GetWriter(session_.connection()));
+    EXPECT_CALL(*writer, WritePacket(_, _, _, _, _))
+        .Times(1)
+        .WillRepeatedly(Return(WriteResult(WRITE_STATUS_OK, 0)));
+  }
   EXPECT_FALSE(session_.IsCryptoHandshakeConfirmed());
   CryptoHandshakeMessage message;
   session_.GetMutableCryptoStream()->OnHandshakeMessage(message);
@@ -1030,7 +1037,14 @@
 }
 
 TEST_P(QuicSpdySessionTestServer, IncreasedTimeoutAfterCryptoHandshake) {
-  EXPECT_CALL(*connection_, CloseConnection(_, _, _));
+  if (!GetQuicReloadableFlag(quic_do_not_send_settings) ||
+      VersionUsesQpack(transport_version())) {
+    MockPacketWriter* writer = static_cast<MockPacketWriter*>(
+        QuicConnectionPeer::GetWriter(session_.connection()));
+    EXPECT_CALL(*writer, WritePacket(_, _, _, _, _))
+        .Times(1)
+        .WillRepeatedly(Return(WriteResult(WRITE_STATUS_OK, 0)));
+  }
   EXPECT_EQ(kInitialIdleTimeoutSecs + 3,
             QuicConnectionPeer::GetNetworkTimeout(connection_).ToSeconds());
   CryptoHandshakeMessage msg;