Send bandwidth estimate when the server network idles for half of idle_network_timeout for IETF QUIC guarded by connection option BWID.

Guarded with the same flag and connection option:
1. No longer sending bandwidth estimates when only bandwidth resumption is enabled.
2. When sending the bandwidth after idle long enough, the bandwidth from SendAlgorithm is used.
3. When the NEW_TOKEN frame is sent after the handshake, bandwidth from the previous session is sent along if there is no better measurement.

Protected by FLAGS_quic_reloadable_flag_quic_enable_sending_bandwidth_estimate_when_network_idle.

PiperOrigin-RevId: 443223110
diff --git a/quiche/quic/core/quic_connection_test.cc b/quiche/quic/core/quic_connection_test.cc
index 34c7ba0..932addc 100644
--- a/quiche/quic/core/quic_connection_test.cc
+++ b/quiche/quic/core/quic_connection_test.cc
@@ -5860,6 +5860,7 @@
         &config, connection_.connection_id());
   }
   connection_.SetFromConfig(config);
+  QuicConnectionPeer::DisableBandwidthUpdate(&connection_);
 
   const QuicTime::Delta default_idle_timeout =
       QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs - 1);
@@ -5935,6 +5936,7 @@
   EXPECT_THAT(error, IsQuicNoError());
 
   connection_.SetFromConfig(config);
+  QuicConnectionPeer::DisableBandwidthUpdate(&connection_);
 
   const QuicTime::Delta default_idle_timeout =
       QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs - 1);
@@ -5997,6 +5999,7 @@
         &config, connection_.connection_id());
   }
   connection_.SetFromConfig(config);
+  QuicConnectionPeer::DisableBandwidthUpdate(&connection_);
 
   const QuicTime::Delta default_idle_timeout =
       QuicTime::Delta::FromSeconds(kMaximumIdleTimeoutSecs - 1);
@@ -6092,6 +6095,7 @@
   connection_.SetNetworkTimeouts(
       QuicTime::Delta::Infinite(),
       initial_idle_timeout + QuicTime::Delta::FromSeconds(1));
+  QuicConnectionPeer::DisableBandwidthUpdate(&connection_);
   const QuicTime::Delta five_ms = QuicTime::Delta::FromMilliseconds(5);
   QuicTime default_timeout = clock_.ApproximateNow() + initial_idle_timeout;
 
@@ -11680,14 +11684,14 @@
   ASSERT_TRUE(connection_.GetTimeoutAlarm()->IsSet());
   EXPECT_FALSE(connection_.MaybeTestLiveness());
 
-  QuicTime deadline = connection_.GetTimeoutAlarm()->deadline();
+  QuicTime deadline = QuicConnectionPeer::GetIdleNetworkDeadline(&connection_);
   QuicTime::Delta timeout = deadline - clock_.ApproximateNow();
   // Advance time to near the idle timeout.
   clock_.AdvanceTime(timeout - QuicTime::Delta::FromMilliseconds(1));
   EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(1);
   EXPECT_TRUE(connection_.MaybeTestLiveness());
   // Verify idle deadline does not change.
-  EXPECT_EQ(deadline, connection_.GetTimeoutAlarm()->deadline());
+  EXPECT_EQ(deadline, QuicConnectionPeer::GetIdleNetworkDeadline(&connection_));
 }
 
 TEST_P(QuicConnectionTest, SilentIdleTimeout) {
@@ -11717,6 +11721,11 @@
   EXPECT_CALL(visitor_,
               OnConnectionClosed(_, ConnectionCloseSource::FROM_SELF));
   EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)).Times(0);
+  if (!QuicConnectionPeer::GetBandwidthUpdateTimeout(&connection_)
+           .IsInfinite()) {
+    // Fires the bandwidth update.
+    connection_.GetTimeoutAlarm()->Fire();
+  }
   connection_.GetTimeoutAlarm()->Fire();
   // Verify the connection close packets get serialized and added to
   // termination packets list.