In QUIC, instead of looking up QuicConnection states, consult the session on whether the connection should be closed on STATELESS_RESET.

The new approach allows Chrome's connectivity probing manager to make decisions, which is consistent with other path determination logic for probing.

Client side change only. not protected.

PiperOrigin-RevId: 312556190
Change-Id: I0a295b84312b7c53bdf14c4c7940ce1f60609b09
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc
index fe94fcf..bb61130 100644
--- a/quic/core/quic_connection_test.cc
+++ b/quic/core/quic_connection_test.cc
@@ -7418,6 +7418,7 @@
                                                 kTestStatelessResetToken));
   std::unique_ptr<QuicReceivedPacket> received(
       ConstructReceivedPacket(*packet, QuicTime::Zero()));
+  EXPECT_CALL(visitor_, ValidateStatelessReset(_, _)).WillOnce(Return(true));
   EXPECT_CALL(visitor_, OnConnectionClosed(_, ConnectionCloseSource::FROM_PEER))
       .WillOnce(Invoke(this, &QuicConnectionTest::SaveConnectionCloseFrame));
   connection_.ProcessUdpPacket(kSelfAddress, kPeerAddress, *received);
@@ -7426,33 +7427,6 @@
               IsError(QUIC_PUBLIC_RESET));
 }
 
-TEST_P(QuicConnectionTest, IetfStatelessResetOnProbingPath) {
-  if (!VersionHasIetfInvariantHeader(GetParam().version.transport_version)) {
-    return;
-  }
-  const QuicUint128 kTestStatelessResetToken = 1010101;
-  QuicConfig config;
-  QuicConfigPeer::SetReceivedStatelessResetToken(&config,
-                                                 kTestStatelessResetToken);
-  EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _));
-  connection_.SetFromConfig(config);
-
-  // Process a normal packet first to set the self address.
-  QuicReceivedPacket encrypted(nullptr, 0, QuicTime::Zero());
-  connection_.ProcessUdpPacket(kSelfAddress, kPeerAddress, encrypted);
-
-  std::unique_ptr<QuicEncryptedPacket> packet(
-      QuicFramer::BuildIetfStatelessResetPacket(connection_id_,
-                                                kTestStatelessResetToken));
-  std::unique_ptr<QuicReceivedPacket> received(
-      ConstructReceivedPacket(*packet, QuicTime::Zero()));
-  EXPECT_CALL(visitor_, OnConnectionClosed(_, _)).Times(0);
-  EXPECT_CALL(visitor_, OnStatelessResetForProbing());
-  auto host = kSelfAddress.host();
-  QuicSocketAddress alternate_address(host, 80);
-  connection_.ProcessUdpPacket(alternate_address, kPeerAddress, *received);
-}
-
 TEST_P(QuicConnectionTest, GoAway) {
   if (VersionHasIetfQuicFrames(GetParam().version.transport_version)) {
     // GoAway is not available in version 99.