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/test_tools/quic_packet_creator_peer.cc b/quic/test_tools/quic_packet_creator_peer.cc
index c5dd747..e7af2d5 100644
--- a/quic/test_tools/quic_packet_creator_peer.cc
+++ b/quic/test_tools/quic_packet_creator_peer.cc
@@ -19,7 +19,7 @@
void QuicPacketCreatorPeer::SetSendVersionInPacket(
QuicPacketCreator* creator,
bool send_version_in_packet) {
- if (creator->framer_->transport_version() != QUIC_VERSION_99) {
+ if (!VersionHasIetfQuicFrames(creator->framer_->transport_version())) {
creator->send_version_in_packet_ = send_version_in_packet;
return;
}
diff --git a/quic/test_tools/quic_session_peer.cc b/quic/test_tools/quic_session_peer.cc
index 60133cf..3d4c9f3 100644
--- a/quic/test_tools/quic_session_peer.cc
+++ b/quic/test_tools/quic_session_peer.cc
@@ -27,7 +27,7 @@
// static
void QuicSessionPeer::SetNextOutgoingBidirectionalStreamId(QuicSession* session,
QuicStreamId id) {
- if (session->connection()->transport_version() == QUIC_VERSION_99) {
+ if (VersionHasIetfQuicFrames(session->connection()->transport_version())) {
session->v99_streamid_manager_.bidirectional_stream_id_manager_
.next_outgoing_stream_id_ = id;
return;
@@ -38,8 +38,8 @@
// static
void QuicSessionPeer::SetMaxOpenIncomingStreams(QuicSession* session,
uint32_t max_streams) {
- if (session->connection()->transport_version() == QUIC_VERSION_99) {
- QUIC_BUG << "SetmaxOpenIncomingStreams deprecated for IETF QUIC/V99";
+ if (VersionHasIetfQuicFrames(session->connection()->transport_version())) {
+ QUIC_BUG << "SetmaxOpenIncomingStreams deprecated for IETF QUIC";
session->v99_streamid_manager_.SetMaxOpenIncomingUnidirectionalStreams(
max_streams);
session->v99_streamid_manager_.SetMaxOpenIncomingBidirectionalStreams(
@@ -53,9 +53,9 @@
void QuicSessionPeer::SetMaxOpenIncomingBidirectionalStreams(
QuicSession* session,
uint32_t max_streams) {
- DCHECK_EQ(QUIC_VERSION_99, session->connection()->transport_version())
+ DCHECK(VersionHasIetfQuicFrames(session->connection()->transport_version()))
<< "SetmaxOpenIncomingBidirectionalStreams not supported for Google "
- "QUIC/not-V99";
+ "QUIC";
session->v99_streamid_manager_.SetMaxOpenIncomingBidirectionalStreams(
max_streams);
}
@@ -63,9 +63,9 @@
void QuicSessionPeer::SetMaxOpenIncomingUnidirectionalStreams(
QuicSession* session,
uint32_t max_streams) {
- DCHECK_EQ(QUIC_VERSION_99, session->connection()->transport_version())
+ DCHECK(VersionHasIetfQuicFrames(session->connection()->transport_version()))
<< "SetmaxOpenIncomingUnidirectionalStreams not supported for Google "
- "QUIC/not-V99";
+ "QUIC";
session->v99_streamid_manager_.SetMaxOpenIncomingUnidirectionalStreams(
max_streams);
}
@@ -73,8 +73,8 @@
// static
void QuicSessionPeer::SetMaxOpenOutgoingStreams(QuicSession* session,
uint32_t max_streams) {
- if (session->connection()->transport_version() == QUIC_VERSION_99) {
- QUIC_BUG << "SetmaxOpenOutgoingStreams deprecated for IETF QUIC/V99";
+ if (VersionHasIetfQuicFrames(session->connection()->transport_version())) {
+ QUIC_BUG << "SetmaxOpenOutgoingStreams deprecated for IETF QUIC";
session->v99_streamid_manager_.SetMaxOpenOutgoingUnidirectionalStreams(
max_streams);
session->v99_streamid_manager_.SetMaxOpenOutgoingBidirectionalStreams(
@@ -88,9 +88,9 @@
void QuicSessionPeer::SetMaxOpenOutgoingBidirectionalStreams(
QuicSession* session,
uint32_t max_streams) {
- DCHECK_EQ(QUIC_VERSION_99, session->connection()->transport_version())
+ DCHECK(VersionHasIetfQuicFrames(session->connection()->transport_version()))
<< "SetmaxOpenOutgoingBidirectionalStreams not supported for Google "
- "QUIC/not-V99";
+ "QUIC";
session->v99_streamid_manager_.SetMaxOpenOutgoingBidirectionalStreams(
max_streams);
}
@@ -98,9 +98,9 @@
void QuicSessionPeer::SetMaxOpenOutgoingUnidirectionalStreams(
QuicSession* session,
uint32_t max_streams) {
- DCHECK_EQ(QUIC_VERSION_99, session->connection()->transport_version())
+ DCHECK(VersionHasIetfQuicFrames(session->connection()->transport_version()))
<< "SetmaxOpenOutgoingUnidirectionalStreams not supported for Google "
- "QUIC/not-V99";
+ "QUIC";
session->v99_streamid_manager_.SetMaxOpenOutgoingUnidirectionalStreams(
max_streams);
}
@@ -192,8 +192,10 @@
// static
bool QuicSessionPeer::IsStreamAvailable(QuicSession* session, QuicStreamId id) {
- if (session->connection()->transport_version() == QUIC_VERSION_99) {
- if (id % QuicUtils::StreamIdDelta(QUIC_VERSION_99) < 2) {
+ if (VersionHasIetfQuicFrames(session->connection()->transport_version())) {
+ if (id % QuicUtils::StreamIdDelta(
+ session->connection()->transport_version()) <
+ 2) {
return QuicContainsKey(
session->v99_streamid_manager_.bidirectional_stream_id_manager_
.available_streams_,
diff --git a/quic/test_tools/quic_test_utils.cc b/quic/test_tools/quic_test_utils.cc
index 100f4e9..dbfca44 100644
--- a/quic/test_tools/quic_test_utils.cc
+++ b/quic/test_tools/quic_test_utils.cc
@@ -1185,7 +1185,7 @@
Perspective perspective,
bool is_incoming,
StreamType default_type) {
- return version == QUIC_VERSION_99
+ return VersionHasIetfQuicFrames(version)
? QuicUtils::GetStreamType(id, perspective, is_incoming)
: default_type;
}