Add functions to enable/disable QuartcPeer and obtain the last sequence numbers
sent by each of its sources.

These functions allow a test to stop sending and drain network traffic before
closing the connection, by disabling both peers and waiting until each receives
the sequence number last sent by the other.

Note that this might not work perfectly on lossy networks, as the last message
may be dropped.  In this case, draining should use a timeout.  For example, the
receiver may stop waiting based if it does not receive any frames for an RTT.

gfe-relnote: n/a (Quartc test-only)
PiperOrigin-RevId: 243880014
Change-Id: I17eb39fe9db65138094be885ba2330936dbeac4e
diff --git a/quic/quartc/test/quartc_peer.h b/quic/quartc/test/quartc_peer.h
index 502024c..32b29be 100644
--- a/quic/quartc/test/quartc_peer.h
+++ b/quic/quartc/test/quartc_peer.h
@@ -51,11 +51,22 @@
 
   ~QuartcPeer();
 
+  // Enable or disable this peer.  Disabling a peer causes it to stop sending
+  // messages (which may be useful for flushing data during tests).
+  // A peer begins disabled.  It automatically enables itself as soon as its
+  // session becomes writable, and disables itself when its session closes.
+  bool Enabled() const { return enabled_; }
+  void SetEnabled(bool value);
+
   // Messages received from the peer, in the order they were received.
   const std::vector<ReceivedMessage>& received_messages() const {
     return received_messages_;
   }
 
+  // Returns a map of source id to the sequence number of the last frame
+  // produced by that source.
+  std::map<int32_t, int64_t> GetLastSequenceNumbers() const;
+
   // QuartcEndpoint::Delegate overrides.
   void OnSessionCreated(QuartcSession* session) override;
   void OnConnectError(QuicErrorCode error,
@@ -81,6 +92,9 @@
   QuicAlarmFactory* alarm_factory_;
   QuicRandom* random_;
 
+  // Whether the peer is currently sending.
+  bool enabled_;
+
   // Session used for sending and receiving data.  Not owned.  Created by an
   // external QuartcEndpoint and set in the |OnSessionCreated| callback.
   QuartcSession* session_;