Add client connection ID methods to quic_packets

gfe-relnote: n/a, adds new currently unused methods
PiperOrigin-RevId: 250704882
Change-Id: I0205e7638c229df39c1bb60661433c34adec5f84
diff --git a/quic/core/quic_packets_test.cc b/quic/core/quic_packets_test.cc
index 9ea369e..be35d20 100644
--- a/quic/core/quic_packets_test.cc
+++ b/quic/core/quic_packets_test.cc
@@ -86,6 +86,31 @@
                                       header, Perspective::IS_CLIENT));
 }
 
+TEST_F(QuicPacketsTest, GetClientConnectionIdAsRecipient) {
+  SetQuicRestartFlag(quic_do_not_override_connection_id, true);
+  QuicPacketHeader header = CreateFakePacketHeader();
+  EXPECT_EQ(TestConnectionId(2),
+            GetClientConnectionIdAsRecipient(header, Perspective::IS_SERVER));
+  EXPECT_EQ(TestConnectionId(1),
+            GetClientConnectionIdAsRecipient(header, Perspective::IS_CLIENT));
+}
+
+TEST_F(QuicPacketsTest, GetClientConnectionIdAsSender) {
+  QuicPacketHeader header = CreateFakePacketHeader();
+  if (!GetQuicRestartFlag(quic_do_not_override_connection_id)) {
+    EXPECT_EQ(TestConnectionId(2),
+              GetClientConnectionIdAsSender(header, Perspective::IS_SERVER));
+    EXPECT_EQ(TestConnectionId(2),
+              GetClientConnectionIdAsSender(header, Perspective::IS_CLIENT));
+    return;
+  }
+
+  EXPECT_EQ(TestConnectionId(1),
+            GetClientConnectionIdAsSender(header, Perspective::IS_SERVER));
+  EXPECT_EQ(TestConnectionId(2),
+            GetClientConnectionIdAsSender(header, Perspective::IS_CLIENT));
+}
+
 }  // namespace
 }  // namespace test
 }  // namespace quic