Deprecate TLPR in QUIC.

Protected by quic_reloadable_flag_quic_deprecate_tlpr.

PiperOrigin-RevId: 403110777
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc
index e525fd1..ad04ccf 100644
--- a/quic/core/quic_connection_test.cc
+++ b/quic/core/quic_connection_test.cc
@@ -4483,7 +4483,7 @@
 }
 
 TEST_P(QuicConnectionTest, TailLossProbeDelayForStreamDataInTLPR) {
-  if (connection_.PtoEnabled()) {
+  if (connection_.PtoEnabled() || GetQuicReloadableFlag(quic_deprecate_tlpr)) {
     return;
   }
 
@@ -4518,7 +4518,7 @@
 }
 
 TEST_P(QuicConnectionTest, TailLossProbeDelayForNonStreamDataInTLPR) {
-  if (connection_.PtoEnabled()) {
+  if (connection_.PtoEnabled() || GetQuicReloadableFlag(quic_deprecate_tlpr)) {
     return;
   }
 
diff --git a/quic/core/quic_flags_list.h b/quic/core/quic_flags_list.h
index 3416be7..72e65f3 100644
--- a/quic/core/quic_flags_list.h
+++ b/quic/core/quic_flags_list.h
@@ -23,6 +23,8 @@
 QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_reject_invalid_chars_in_field_value, true)
 // If true, QUIC will default enable MTU discovery at server, with a target of 1450 bytes.
 QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_enable_mtu_discovery_at_server, false)
+// If true, QUIC won\'t honor the connection option TLPR
+QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_deprecate_tlpr, false)
 // If true, QuicAlarms that belong to a single QuicConnection will fire under the corresponding QuicConnectionContext.
 QUIC_FLAG(FLAGS_quic_reloadable_flag_quic_restore_connection_context_in_alarms, true)
 // If true, QuicGsoBatchWriter will support release time if it is available and the process has the permission to do so.
diff --git a/quic/core/quic_sent_packet_manager.cc b/quic/core/quic_sent_packet_manager.cc
index d9d384f..b7c3a5b 100644
--- a/quic/core/quic_sent_packet_manager.cc
+++ b/quic/core/quic_sent_packet_manager.cc
@@ -209,8 +209,12 @@
       QUIC_CODE_COUNT(two_aggressive_ptos);
       num_tlp_timeout_ptos_ = 2;
     }
+    if (GetQuicReloadableFlag(quic_deprecate_tlpr)) {
+      QUIC_RELOADABLE_FLAG_COUNT_N(quic_deprecate_tlpr, 2, 2);
+    }
     if (config.HasClientSentConnectionOption(kPLE1, perspective) ||
-        config.HasClientSentConnectionOption(kTLPR, perspective)) {
+        (config.HasClientSentConnectionOption(kTLPR, perspective) &&
+         !GetQuicReloadableFlag(quic_deprecate_tlpr))) {
       first_pto_srtt_multiplier_ = 0.5;
     } else if (config.HasClientSentConnectionOption(kPLE2, perspective)) {
       first_pto_srtt_multiplier_ = 1.5;
@@ -297,10 +301,15 @@
   if (config.HasClientSentConnectionOption(k1RTO, perspective)) {
     max_rto_packets_ = 1;
   }
-  if (config.HasClientSentConnectionOption(kTLPR, perspective)) {
+  if (GetQuicReloadableFlag(quic_deprecate_tlpr)) {
+    QUIC_RELOADABLE_FLAG_COUNT_N(quic_deprecate_tlpr, 1, 2);
+  }
+  if (config.HasClientSentConnectionOption(kTLPR, perspective) &&
+      !GetQuicReloadableFlag(quic_deprecate_tlpr)) {
     enable_half_rtt_tail_loss_probe_ = true;
   }
-  if (config.HasClientRequestedIndependentOption(kTLPR, perspective)) {
+  if (config.HasClientRequestedIndependentOption(kTLPR, perspective) &&
+      !GetQuicReloadableFlag(quic_deprecate_tlpr)) {
     enable_half_rtt_tail_loss_probe_ = true;
   }
   if (config.HasClientSentConnectionOption(kNRTO, perspective)) {
diff --git a/quic/core/quic_sent_packet_manager.h b/quic/core/quic_sent_packet_manager.h
index eeb474f..b34aa20 100644
--- a/quic/core/quic_sent_packet_manager.h
+++ b/quic/core/quic_sent_packet_manager.h
@@ -618,6 +618,7 @@
   // Maximum number of packets to send upon RTO.
   QuicPacketCount max_rto_packets_;
   // If true, send the TLP at 0.5 RTT.
+  // TODO(renjietang): remove it once quic_deprecate_tlpr flag is deprecated.
   bool enable_half_rtt_tail_loss_probe_;
   bool using_pacing_;
   // If true, use the new RTO with loss based CWND reduction instead of the send
diff --git a/quic/core/quic_sent_packet_manager_test.cc b/quic/core/quic_sent_packet_manager_test.cc
index e457e09..99865a0 100644
--- a/quic/core/quic_sent_packet_manager_test.cc
+++ b/quic/core/quic_sent_packet_manager_test.cc
@@ -41,8 +41,7 @@
 
 // Matcher to check that the packet number matches the second argument.
 MATCHER(PacketNumberEq, "") {
-  return ::testing::get<0>(arg).packet_number ==
-         QuicPacketNumber(::testing::get<1>(arg));
+  return std::get<0>(arg).packet_number == QuicPacketNumber(std::get<1>(arg));
 }
 
 class MockDebugDelegate : public QuicSentPacketManager::DebugDelegate {
@@ -1465,7 +1464,8 @@
 }
 
 TEST_F(QuicSentPacketManagerTest, TLPRWithPendingStreamData) {
-  if (GetQuicReloadableFlag(quic_default_on_pto)) {
+  if (GetQuicReloadableFlag(quic_default_on_pto) ||
+      GetQuicReloadableFlag(quic_deprecate_tlpr)) {
     return;
   }
   QuicConfig config;
@@ -1518,7 +1518,8 @@
 }
 
 TEST_F(QuicSentPacketManagerTest, TLPRWithoutPendingStreamData) {
-  if (GetQuicReloadableFlag(quic_default_on_pto)) {
+  if (GetQuicReloadableFlag(quic_default_on_pto) ||
+      GetQuicReloadableFlag(quic_deprecate_tlpr)) {
     return;
   }
   QuicConfig config;
@@ -2125,7 +2126,8 @@
 }
 
 TEST_F(QuicSentPacketManagerTest, NegotiateTLPRttFromOptionsAtServer) {
-  if (GetQuicReloadableFlag(quic_default_on_pto)) {
+  if (GetQuicReloadableFlag(quic_default_on_pto) ||
+      GetQuicReloadableFlag(quic_deprecate_tlpr)) {
     return;
   }
   QuicConfig config;
@@ -2141,7 +2143,8 @@
 }
 
 TEST_F(QuicSentPacketManagerTest, NegotiateTLPRttFromOptionsAtClient) {
-  if (GetQuicReloadableFlag(quic_default_on_pto)) {
+  if (GetQuicReloadableFlag(quic_default_on_pto) ||
+      GetQuicReloadableFlag(quic_deprecate_tlpr)) {
     return;
   }
   QuicConfig client_config;
@@ -4352,6 +4355,9 @@
 }
 
 TEST_F(QuicSentPacketManagerTest, ClientOnlyTLPRServer) {
+  if (GetQuicReloadableFlag(quic_deprecate_tlpr)) {
+    return;
+  }
   QuicConfig config;
   QuicTagVector options;
 
@@ -4366,6 +4372,9 @@
 }
 
 TEST_F(QuicSentPacketManagerTest, ClientOnlyTLPR) {
+  if (GetQuicReloadableFlag(quic_deprecate_tlpr)) {
+    return;
+  }
   QuicSentPacketManagerPeer::SetPerspective(&manager_, Perspective::IS_CLIENT);
   QuicConfig config;
   QuicTagVector options;
@@ -4380,6 +4389,9 @@
 }
 
 TEST_F(QuicSentPacketManagerTest, PtoWithTlpr) {
+  if (GetQuicReloadableFlag(quic_deprecate_tlpr)) {
+    return;
+  }
   QuicConfig config;
   QuicTagVector options;