In quic, add a connection option to disable blackhole detection on both sides. not used yet. not protected.

Disable blackhole detection for those e2e tests with high losses, because they are testing loss recovery.

PiperOrigin-RevId: 318881605
Change-Id: I28eb9fb3717efeb9c93b56ba460376fa1c584df2
diff --git a/quic/core/crypto/crypto_protocol.h b/quic/core/crypto/crypto_protocol.h
index 4beec0b..289821b 100644
--- a/quic/core/crypto/crypto_protocol.h
+++ b/quic/core/crypto/crypto_protocol.h
@@ -169,6 +169,7 @@
 const QuicTag k6RTO = TAG('6', 'R', 'T', 'O');   // Close connection on 6 RTOs
 const QuicTag kCBHD = TAG('C', 'B', 'H', 'D');   // Client only blackhole
                                                  // detection.
+const QuicTag kNBHD = TAG('N', 'B', 'H', 'D');   // No blackhole detection.
 const QuicTag kCONH = TAG('C', 'O', 'N', 'H');   // Conservative Handshake
                                                  // Retransmissions.
 const QuicTag kLFAK = TAG('L', 'F', 'A', 'K');   // Don't invoke FACK on the
diff --git a/quic/core/http/end_to_end_test.cc b/quic/core/http/end_to_end_test.cc
index 56a130c..005e463 100644
--- a/quic/core/http/end_to_end_test.cc
+++ b/quic/core/http/end_to_end_test.cc
@@ -1150,6 +1150,8 @@
   // Connect with lower fake packet loss than we'd like to test.
   // Until b/10126687 is fixed, losing handshake packets is pretty
   // brutal.
+  // Disable blackhole detection as this test is testing loss recovery.
+  client_extra_copts_.push_back(kNBHD);
   SetPacketLossPercentage(5);
   ASSERT_TRUE(Initialize());
   EXPECT_TRUE(client_->client()->WaitForHandshakeConfirmed());
@@ -1170,6 +1172,8 @@
 
 // Regression test for b/80090281.
 TEST_P(EndToEndTest, LargePostWithPacketLossAndAlwaysBundleWindowUpdates) {
+  // Disable blackhole detection as this test is testing loss recovery.
+  client_extra_copts_.push_back(kNBHD);
   ASSERT_TRUE(Initialize());
   EXPECT_TRUE(client_->client()->WaitForHandshakeConfirmed());
   server_thread_->WaitForCryptoHandshakeConfirmed();
@@ -1200,6 +1204,8 @@
 TEST_P(EndToEndTest, LargePostWithPacketLossAndBlockedSocket) {
   // Connect with lower fake packet loss than we'd like to test.  Until
   // b/10126687 is fixed, losing handshake packets is pretty brutal.
+  // Disable blackhole detection as this test is testing loss recovery.
+  client_extra_copts_.push_back(kNBHD);
   SetPacketLossPercentage(5);
   ASSERT_TRUE(Initialize());
   EXPECT_TRUE(client_->client()->WaitForHandshakeConfirmed());
@@ -2391,6 +2397,8 @@
   // socket,  an AckNotifierDelegate will get informed that the data it is
   // interested in has been ACKed. This tests end-to-end ACK notification, and
   // demonstrates that retransmissions do not break this functionality.
+  // Disable blackhole detection as this test is testing loss recovery.
+  client_extra_copts_.push_back(kNBHD);
   SetPacketLossPercentage(5);
   ASSERT_TRUE(Initialize());
   // Wait for the server SHLO before upping the packet loss.
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index 50a42f5..02ca259 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -539,6 +539,9 @@
       QUIC_CODE_COUNT(quic_client_only_blackhole_detection);
       blackhole_detection_disabled_ = true;
     }
+    if (config.HasClientSentConnectionOption(kNBHD, perspective_)) {
+      blackhole_detection_disabled_ = true;
+    }
     if (config.HasClientSentConnectionOption(k2RTO, perspective_)) {
       QUIC_CODE_COUNT(quic_2rto_blackhole_detection);
       num_rtos_for_blackhole_detection_ = 2;