Change IETF Frame/QUIC_VERSION_99 tests to be symbolic.

This CL replaces checks for QUIC_VERSION_99 that are controlling the IETF frames and their associated functionality with a function call . The function has a name that is indicative of the features for which the version is being checked -- VersionHasIetfQuicFrames().

gfe-relnote: N/A just changes the text by which we test if IETF QUIC has been negotiated.
PiperOrigin-RevId: 253767805
Change-Id: I08ae6738411ac151f90d5d085ea69af90d79fb80
diff --git a/quic/tools/quic_simple_server_session.cc b/quic/tools/quic_simple_server_session.cc
index d2945e3..247e263 100644
--- a/quic/tools/quic_simple_server_session.cc
+++ b/quic/tools/quic_simple_server_session.cc
@@ -149,7 +149,7 @@
     // Since PromisedStreamInfo are queued in sequence, the corresponding
     // index for it in promised_streams_ can be calculated.
     QuicStreamId next_stream_id = next_outgoing_unidirectional_stream_id();
-    if (connection()->transport_version() == QUIC_VERSION_99) {
+    if (VersionHasIetfQuicFrames(connection()->transport_version())) {
       DCHECK(!QuicUtils::IsBidirectionalStreamId(frame.stream_id));
     }
     DCHECK_GE(frame.stream_id, next_stream_id);
diff --git a/quic/tools/quic_simple_server_session_test.cc b/quic/tools/quic_simple_server_session_test.cc
index 457f3fa..1304021 100644
--- a/quic/tools/quic_simple_server_session_test.cc
+++ b/quic/tools/quic_simple_server_session_test.cc
@@ -232,7 +232,7 @@
         ->OnSuccessfulVersionNegotiation(supported_versions.front());
     visitor_ = QuicConnectionPeer::GetVisitor(connection_);
 
-    if (IsVersion99()) {
+    if (VersionHasIetfQuicFrames(transport_version())) {
       EXPECT_CALL(*connection_, SendControlFrame(_))
           .WillRepeatedly(Invoke(
               this, &QuicSimpleServerSessionTest::ClearMaxStreamsControlFrame));
@@ -250,8 +250,8 @@
         connection_->transport_version(), n);
   }
 
-  bool IsVersion99() const {
-    return connection_->transport_version() == QUIC_VERSION_99;
+  QuicTransportVersion transport_version() const {
+    return connection_->transport_version();
   }
 
   void InjectStopSending(QuicStreamId stream_id,
@@ -259,7 +259,7 @@
     // Create and inject a STOP_SENDING frame. In GOOGLE QUIC, receiving a
     // RST_STREAM frame causes a two-way close. For IETF QUIC, RST_STREAM causes
     // a one-way close.
-    if (!IsVersion99()) {
+    if (!VersionHasIetfQuicFrames(transport_version())) {
       // Only needed for version 99/IETF QUIC.
       return;
     }
@@ -305,7 +305,7 @@
                           QUIC_ERROR_PROCESSING_STREAM, 0);
   EXPECT_CALL(owner_, OnRstStreamReceived(_)).Times(1);
   EXPECT_CALL(*connection_, SendControlFrame(_));
-  if (!IsVersion99()) {
+  if (!VersionHasIetfQuicFrames(transport_version())) {
     // For version 99, this is covered in InjectStopSending()
     EXPECT_CALL(*connection_,
                 OnStreamReset(GetNthClientInitiatedBidirectionalId(0),
@@ -333,7 +333,7 @@
                           GetNthClientInitiatedBidirectionalId(0),
                           QUIC_ERROR_PROCESSING_STREAM, 0);
   EXPECT_CALL(owner_, OnRstStreamReceived(_)).Times(1);
-  if (!IsVersion99()) {
+  if (!VersionHasIetfQuicFrames(transport_version())) {
     EXPECT_CALL(*connection_, SendControlFrame(_));
     // For version 99, this is covered in InjectStopSending()
     EXPECT_CALL(*connection_,
@@ -374,7 +374,7 @@
                          GetNthClientInitiatedBidirectionalId(0),
                          QUIC_ERROR_PROCESSING_STREAM, 0);
   EXPECT_CALL(owner_, OnRstStreamReceived(_)).Times(1);
-  if (!IsVersion99()) {
+  if (!VersionHasIetfQuicFrames(transport_version())) {
     EXPECT_CALL(*connection_, SendControlFrame(_));
     // For version 99, this is covered in InjectStopSending()
     EXPECT_CALL(*connection_,
@@ -575,7 +575,7 @@
         ->OnSuccessfulVersionNegotiation(supported_versions.front());
     // Needed to make new session flow control window and server push work.
 
-    if (IsVersion99()) {
+    if (VersionHasIetfQuicFrames(transport_version())) {
       EXPECT_CALL(*connection_, SendControlFrame(_))
           .WillRepeatedly(Invoke(this, &QuicSimpleServerSessionServerPushTest::
                                            ClearMaxStreamsControlFrame));
@@ -761,7 +761,7 @@
           QuicConsumedData(kStreamFlowControlWindowSize - offset, false)));
   EXPECT_CALL(*session_, SendBlocked(next_out_going_stream_id));
 
-  if (IsVersion99()) {
+  if (VersionHasIetfQuicFrames(transport_version())) {
     // The PromisePushedResources call, above, will have used all available
     // stream ids.  For version 99, stream ids are not made available until
     // a MAX_STREAMS frame is received. This emulates the reception of one.
@@ -792,7 +792,7 @@
   // Having two extra resources to be send later. One of them will be reset, so
   // when opened stream become close, only one will become open.
   size_t num_resources = kMaxStreamsForTest + 2;
-  if (IsVersion99()) {
+  if (VersionHasIetfQuicFrames(transport_version())) {
     // V99 will send out a STREAMS_BLOCKED frame when it tries to exceed the
     // limit. This will clear the frames so that they do not block the later
     // rst-stream frame.
@@ -860,7 +860,7 @@
           QuicConsumedData(kStreamFlowControlWindowSize - offset, false)));
   EXPECT_CALL(*session_, SendBlocked(stream_not_reset));
 
-  if (IsVersion99()) {
+  if (VersionHasIetfQuicFrames(transport_version())) {
     // The PromisePushedResources call, above, will have used all available
     // stream ids.  For version 99, stream ids are not made available until
     // a MAX_STREAMS frame is received. This emulates the reception of one.
@@ -879,7 +879,7 @@
        CloseStreamToHandleMorePromisedStream) {
   MaybeConsumeHeadersStreamData();
   size_t num_resources = kMaxStreamsForTest + 1;
-  if (IsVersion99()) {
+  if (VersionHasIetfQuicFrames(transport_version())) {
     // V99 will send out a stream-id-blocked frame when the we desired to exceed
     // the limit. This will clear the frames so that they do not block the later
     // rst-stream frame.
@@ -901,7 +901,7 @@
   QuicStreamId stream_got_reset = GetNthServerInitiatedUnidirectionalId(1);
   EXPECT_CALL(owner_, OnRstStreamReceived(_)).Times(1);
   EXPECT_CALL(*connection_, SendControlFrame(_));
-  if (!IsVersion99()) {
+  if (!VersionHasIetfQuicFrames(transport_version())) {
     // For version 99, this is covered in InjectStopSending()
     EXPECT_CALL(*connection_,
                 OnStreamReset(stream_got_reset, QUIC_RST_ACKNOWLEDGEMENT));
@@ -935,7 +935,7 @@
   EXPECT_CALL(*session_, SendBlocked(stream_to_open));
   QuicRstStreamFrame rst(kInvalidControlFrameId, stream_got_reset,
                          QUIC_STREAM_CANCELLED, 0);
-  if (IsVersion99()) {
+  if (VersionHasIetfQuicFrames(transport_version())) {
     // The PromisePushedResources call, above, will have used all available
     // stream ids.  For version 99, stream ids are not made available until
     // a MAX_STREAMS frame is received. This emulates the reception of one.
diff --git a/quic/tools/quic_simple_server_stream_test.cc b/quic/tools/quic_simple_server_stream_test.cc
index 9ce38fb..7e4af32 100644
--- a/quic/tools/quic_simple_server_stream_test.cc
+++ b/quic/tools/quic_simple_server_stream_test.cc
@@ -99,7 +99,7 @@
                                 crypto_config,
                                 compressed_certs_cache,
                                 quic_simple_server_backend) {
-    if (connection->transport_version() == QUIC_VERSION_99) {
+    if (VersionHasIetfQuicFrames(connection->transport_version())) {
       QuicSessionPeer::SetMaxOpenIncomingUnidirectionalStreams(
           this, kMaxStreamsForTest);
       QuicSessionPeer::SetMaxOpenIncomingBidirectionalStreams(
@@ -217,10 +217,6 @@
     return (*stream_->mutable_headers())[key].as_string();
   }
 
-  bool IsVersion99() const {
-    return connection_->transport_version() == QUIC_VERSION_99;
-  }
-
   bool HasFrameHeader() const {
     return VersionHasDataFrameHeader(connection_->transport_version());
   }
@@ -684,7 +680,7 @@
   QuicRstStreamFrame rst_frame(kInvalidControlFrameId, stream_->id(),
                                QUIC_STREAM_CANCELLED, 1234);
   stream_->OnStreamReset(rst_frame);
-  if (IsVersion99()) {
+  if (VersionHasIetfQuicFrames(connection_->transport_version())) {
     // For V99 receiving a RST_STREAM causes a 1-way close; the test requires
     // a full close. A CloseWriteSide closes the other half of the stream.
     // Everything should then work properly.