QuicConnection methods call CloseConnection rather than
TearDownLocalConnectionState

Some of the QuicConnection methods call TearDownLocalConnectionState
rather than CloseConnection. This changes then all to call CloseConnection,
specifying ConnectionCloseBehavior::SILENT_CLOSE.

Some tests modified to expect calls to CloseConnection (preventing test failure due to unexpected calls).  Before this CL the connection closing happened via internal calls directly to TearDownLocalConnectionState; now these calls go through CloseConnection and trigger the expect.

This is done in preparation for landing another CL adding IETF QUIC Connection Close functionality.

QuicConnection::OnUnrecoverableError (which is an override of QuicPacketCreator::OnUnrecoverableError) called TearDownLocalConnectionState. It had to be modified to call CloseConnection.  OnUnrecoverableError has a ConnectionCloseSource parameter, which CloseConnection does not take.  Thus the parameter was removed from OnUnrecoverableError.  This is OK since all of the calls to OnUnrecoverableError specified FROM_SELF as the source. CloseConnection uses FROM_SELF as the source (unless the error code is a stateless reject or public reset).

gfe-relnote: No flag protection as it is only moving existing functionality around.
PiperOrigin-RevId: 250341745
Change-Id: Iafe499eda682f3db678d0eddbf7e2e3e4367cebd
diff --git a/quic/core/quic_packet_creator.cc b/quic/core/quic_packet_creator.cc
index 9f9a68f..5a53ffd 100644
--- a/quic/core/quic_packet_creator.cc
+++ b/quic/core/quic_packet_creator.cc
@@ -200,8 +200,7 @@
     QUIC_BUG << error_details << " Constructed stream frame length: "
              << frame->stream_frame.data_length
              << " CHLO length: " << data_size;
-    delegate_->OnUnrecoverableError(QUIC_CRYPTO_CHLO_TOO_LARGE, error_details,
-                                    ConnectionCloseSource::FROM_SELF);
+    delegate_->OnUnrecoverableError(QUIC_CRYPTO_CHLO_TOO_LARGE, error_details);
     return false;
   }
   if (!AddFrame(*frame, /*save_retransmittable_frames=*/true,
@@ -384,8 +383,7 @@
     const std::string error_details = "Failed to SerializePacket.";
     QUIC_BUG << error_details;
     delegate_->OnUnrecoverableError(QUIC_FAILED_TO_SERIALIZE_PACKET,
-                                    error_details,
-                                    ConnectionCloseSource::FROM_SELF);
+                                    error_details);
     return;
   }
 
@@ -897,8 +895,7 @@
         QuicUtils::EncryptionLevelToString(packet_.encryption_level));
     QUIC_BUG << error_details;
     delegate_->OnUnrecoverableError(
-        QUIC_ATTEMPT_TO_SEND_UNENCRYPTED_STREAM_DATA, error_details,
-        ConnectionCloseSource::FROM_SELF);
+        QUIC_ATTEMPT_TO_SEND_UNENCRYPTED_STREAM_DATA, error_details);
     return false;
   }
   size_t frame_len = framer_->GetSerializedFrameLength(