Index: net/quic/core/quic_headers_stream_test.cc |
diff --git a/net/quic/core/quic_headers_stream_test.cc b/net/quic/core/quic_headers_stream_test.cc |
index 600f725188a93f479a6be7ef98c0252029a9a20c..4a407c919b2410644bfaeee6a6b231b79055ca57 100644 |
--- a/net/quic/core/quic_headers_stream_test.cc |
+++ b/net/quic/core/quic_headers_stream_test.cc |
@@ -224,17 +224,6 @@ |
EXPECT_EQ(version(), session_.connection()->version()); |
EXPECT_TRUE(headers_stream_ != nullptr); |
connection_->AdvanceTime(QuicTime::Delta::FromMilliseconds(1)); |
- client_id_1_ = |
- QuicSpdySessionPeer::GetNthClientInitiatedStreamId(session_, 0); |
- client_id_2_ = |
- QuicSpdySessionPeer::GetNthClientInitiatedStreamId(session_, 1); |
- client_id_3_ = |
- QuicSpdySessionPeer::GetNthClientInitiatedStreamId(session_, 2); |
- next_stream_id_ = QuicSpdySessionPeer::NextStreamId(session_); |
- } |
- |
- QuicStreamId GetNthClientInitiatedId(int n) { |
- return QuicSpdySessionPeer::GetNthClientInitiatedStreamId(session_, n); |
} |
QuicConsumedData SaveIov(const QuicIOVector& data) { |
@@ -372,9 +361,7 @@ |
QuicConnectionPeer::TearDownLocalConnectionState(connection_); |
} |
- QuicStreamId NextPromisedStreamId() { |
- return next_promised_stream_id_ += next_stream_id_; |
- } |
+ QuicStreamId NextPromisedStreamId() { return next_promised_stream_id_ += 2; } |
static const bool kFrameComplete = true; |
static const bool kHasPriority = true; |
@@ -395,10 +382,6 @@ |
StrictMock<MockVisitor> visitor_; |
QuicStreamFrame stream_frame_; |
QuicStreamId next_promised_stream_id_; |
- QuicStreamId client_id_1_; |
- QuicStreamId client_id_2_; |
- QuicStreamId client_id_3_; |
- QuicStreamId next_stream_id_; |
}; |
// Run all tests with each version, perspective (client or server), |
@@ -418,8 +401,8 @@ |
} |
TEST_P(QuicHeadersStreamTest, WriteHeaders) { |
- for (QuicStreamId stream_id = client_id_1_; stream_id < client_id_3_; |
- stream_id += next_stream_id_) { |
+ for (QuicStreamId stream_id = kClientDataStreamId1; |
+ stream_id < kClientDataStreamId3; stream_id += 2) { |
for (bool fin : kFins) { |
if (perspective() == Perspective::IS_SERVER) { |
WriteAndExpectResponseHeaders(stream_id, fin); |
@@ -434,8 +417,8 @@ |
} |
TEST_P(QuicHeadersStreamTest, WritePushPromises) { |
- for (QuicStreamId stream_id = client_id_1_; stream_id < client_id_3_; |
- stream_id += next_stream_id_) { |
+ for (QuicStreamId stream_id = kClientDataStreamId1; |
+ stream_id < kClientDataStreamId3; stream_id += 2) { |
QuicStreamId promised_stream_id = NextPromisedStreamId(); |
if (perspective() == Perspective::IS_SERVER) { |
// Write the headers and capture the outgoing data |
@@ -466,8 +449,8 @@ |
} |
TEST_P(QuicHeadersStreamTest, ProcessRawData) { |
- for (QuicStreamId stream_id = client_id_1_; stream_id < client_id_3_; |
- stream_id += next_stream_id_) { |
+ for (QuicStreamId stream_id = kClientDataStreamId1; |
+ stream_id < kClientDataStreamId3; stream_id += 2) { |
for (bool fin : {false, true}) { |
for (SpdyPriority priority = 0; priority < 7; ++priority) { |
// Replace with "WriteHeadersAndSaveData" |
@@ -500,8 +483,8 @@ |
TEST_P(QuicHeadersStreamTest, ProcessPushPromise) { |
if (perspective() == Perspective::IS_SERVER) |
return; |
- for (QuicStreamId stream_id = client_id_1_; stream_id < client_id_3_; |
- stream_id += next_stream_id_) { |
+ for (QuicStreamId stream_id = kClientDataStreamId1; |
+ stream_id < kClientDataStreamId3; stream_id += 2) { |
QuicStreamId promised_stream_id = NextPromisedStreamId(); |
SpdyPushPromiseIR push_promise(stream_id, promised_stream_id, |
headers_.Clone()); |
@@ -554,7 +537,7 @@ |
InSequence seq; |
bool fin = true; |
for (int stream_num = 0; stream_num < 10; stream_num++) { |
- QuicStreamId stream_id = GetNthClientInitiatedId(stream_num); |
+ QuicStreamId stream_id = QuicClientDataStreamId(stream_num); |
// Replace with "WriteHeadersAndSaveData" |
SpdySerializedFrame frame; |
if (perspective() == Perspective::IS_SERVER) { |
@@ -588,7 +571,7 @@ |
{ |
InSequence seq; |
for (int stream_num = 0; stream_num < 10; ++stream_num) { |
- stream_id = GetNthClientInitiatedId(stream_num); |
+ stream_id = QuicClientDataStreamId(stream_num); |
if (perspective() == Perspective::IS_SERVER) { |
SpdyHeadersIR headers_frame(stream_id, headers_.Clone()); |
headers_frame.set_fin(fin); |
@@ -631,8 +614,8 @@ |
headers_["key0"] = string(1 << 13, '.'); |
headers_["key1"] = string(1 << 13, '.'); |
headers_["key2"] = string(1 << 13, '.'); |
- for (QuicStreamId stream_id = client_id_1_; stream_id < client_id_3_; |
- stream_id += next_stream_id_) { |
+ for (QuicStreamId stream_id = kClientDataStreamId1; |
+ stream_id < kClientDataStreamId3; stream_id += 2) { |
for (bool fin : {false, true}) { |
for (SpdyPriority priority = 0; priority < 7; ++priority) { |
// Replace with "WriteHeadersAndSaveData" |
@@ -862,8 +845,8 @@ |
headers_["key0"] = string(1 << 1, '.'); |
headers_["key1"] = string(1 << 2, '.'); |
headers_["key2"] = string(1 << 3, '.'); |
- for (QuicStreamId stream_id = client_id_1_; stream_id < client_id_3_; |
- stream_id += next_stream_id_) { |
+ for (QuicStreamId stream_id = kClientDataStreamId1; |
+ stream_id < kClientDataStreamId3; stream_id += 2) { |
for (bool fin : {false, true}) { |
for (SpdyPriority priority = 0; priority < 7; ++priority) { |
// Replace with "WriteHeadersAndSaveData" |
@@ -913,8 +896,8 @@ |
QuicSpdySessionPeer::SetHpackEncoderDebugVisitor( |
&session_, std::move(hpack_encoder_visitor)); |
- for (QuicStreamId stream_id = client_id_1_; stream_id < client_id_3_; |
- stream_id += next_stream_id_) { |
+ for (QuicStreamId stream_id = kClientDataStreamId1; |
+ stream_id < kClientDataStreamId3; stream_id += 2) { |
for (bool fin : {false, true}) { |
if (perspective() == Perspective::IS_SERVER) { |
WriteAndExpectResponseHeaders(stream_id, fin); |
@@ -931,7 +914,7 @@ |
} |
TEST_P(QuicHeadersStreamTest, WritevStreamData) { |
- QuicStreamId id = client_id_1_; |
+ QuicStreamId id = kClientDataStreamId1; |
QuicStreamOffset offset = 0; |
struct iovec iov; |
@@ -993,14 +976,14 @@ |
Invoke(this, &QuicHeadersStreamTest::SaveIovAndNotifyAckListener))); |
QuicConsumedData consumed_data = session_.WritevStreamData( |
- client_id_1_, MakeIOVector(data, &iov), 0, true, nullptr); |
+ kClientDataStreamId1, MakeIOVector(data, &iov), 0, true, nullptr); |
EXPECT_EQ(consumed_data.bytes_consumed, 0u); |
EXPECT_EQ(consumed_data.fin_consumed, true); |
} |
TEST_P(QuicHeadersStreamTest, WritevStreamDataSendBlocked) { |
- QuicStreamId id = client_id_1_; |
+ QuicStreamId id = kClientDataStreamId1; |
QuicStreamOffset offset = 0; |
struct iovec iov; |