Introduce QuicUtils::InvertPerspective and refactor code to use it

gfe-relnote: quic perspective refactor, no behavior change
PiperOrigin-RevId: 255318447
Change-Id: I10a7cb3478382f851d3f5a1293a248918ec95844
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc
index b51ca45..749b3b6 100644
--- a/quic/core/quic_connection_test.cc
+++ b/quic/core/quic_connection_test.cc
@@ -85,11 +85,6 @@
     QuicSocketAddress(QuicIpAddress::Loopback6(),
                       /*port=*/443);
 
-Perspective InvertPerspective(Perspective perspective) {
-  return perspective == Perspective::IS_CLIENT ? Perspective::IS_SERVER
-                                               : Perspective::IS_CLIENT;
-}
-
 QuicStreamId GetNthClientInitiatedStreamId(int n,
                                            QuicTransportVersion version) {
   return QuicUtils::GetFirstBidirectionalStreamId(version,
@@ -533,7 +528,7 @@
     // We invert perspective here, because the framer needs to parse packets
     // we send.
     QuicFramerPeer::SetPerspective(framer_.framer(),
-                                   InvertPerspective(perspective));
+                                   QuicUtils::InvertPerspective(perspective));
   }
 
   // final_bytes_of_last_packet_ returns the last four bytes of the previous
@@ -1539,7 +1534,7 @@
       connection_.set_can_truncate_connection_ids(true);
     }
     QuicFramerPeer::SetPerspective(&peer_framer_,
-                                   InvertPerspective(perspective));
+                                   QuicUtils::InvertPerspective(perspective));
   }
 
   void set_packets_between_probes_base(