OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/quic/quic_headers_stream.h" | 5 #include "net/quic/quic_headers_stream.h" |
6 | 6 |
7 #include "net/quic/quic_utils.h" | 7 #include "net/quic/quic_utils.h" |
8 #include "net/quic/spdy_utils.h" | 8 #include "net/quic/spdy_utils.h" |
9 #include "net/quic/test_tools/quic_connection_peer.h" | 9 #include "net/quic/test_tools/quic_connection_peer.h" |
10 #include "net/quic/test_tools/quic_session_peer.h" | 10 #include "net/quic/test_tools/quic_session_peer.h" |
11 #include "net/quic/test_tools/quic_test_utils.h" | 11 #include "net/quic/test_tools/quic_test_utils.h" |
12 #include "net/quic/test_tools/reliable_quic_stream_peer.h" | 12 #include "net/quic/test_tools/reliable_quic_stream_peer.h" |
13 #include "net/spdy/spdy_protocol.h" | 13 #include "net/spdy/spdy_protocol.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 using base::StringPiece; | 16 using base::StringPiece; |
| 17 using std::ostream; |
17 using std::string; | 18 using std::string; |
| 19 using std::vector; |
18 using testing::Invoke; | 20 using testing::Invoke; |
19 using testing::StrictMock; | 21 using testing::StrictMock; |
20 using testing::WithArgs; | 22 using testing::WithArgs; |
21 using testing::_; | 23 using testing::_; |
22 | 24 |
23 namespace net { | 25 namespace net { |
24 namespace test { | 26 namespace test { |
25 namespace { | 27 namespace { |
26 | 28 |
27 class MockVisitor : public SpdyFramerVisitorInterface { | 29 class MockVisitor : public SpdyFramerVisitorInterface { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 MOCK_METHOD2(OnContinuation, void(SpdyStreamId stream_id, bool end)); | 67 MOCK_METHOD2(OnContinuation, void(SpdyStreamId stream_id, bool end)); |
66 MOCK_METHOD6(OnAltSvc, void(SpdyStreamId stream_id, | 68 MOCK_METHOD6(OnAltSvc, void(SpdyStreamId stream_id, |
67 uint32 max_age, | 69 uint32 max_age, |
68 uint16 port, | 70 uint16 port, |
69 StringPiece protocol_id, | 71 StringPiece protocol_id, |
70 StringPiece host, | 72 StringPiece host, |
71 StringPiece origin)); | 73 StringPiece origin)); |
72 MOCK_METHOD2(OnUnknownFrame, bool(SpdyStreamId stream_id, int frame_type)); | 74 MOCK_METHOD2(OnUnknownFrame, bool(SpdyStreamId stream_id, int frame_type)); |
73 }; | 75 }; |
74 | 76 |
75 class QuicHeadersStreamTest : public ::testing::TestWithParam<bool> { | 77 // Run all tests with each version, and client or server |
76 public: | 78 struct TestParams { |
77 static QuicVersionVector GetVersions() { | 79 TestParams(QuicVersion version, bool is_server) |
78 QuicVersionVector versions; | 80 : version(version), is_server(is_server) {} |
79 versions.push_back(QuicVersionMax()); | 81 |
80 return versions; | 82 friend ostream& operator<<(ostream& os, const TestParams& p) { |
| 83 os << "{ version: " << QuicVersionToString(p.version); |
| 84 os << " is_server: " << p.is_server << " }"; |
| 85 return os; |
81 } | 86 } |
82 | 87 |
| 88 QuicVersion version; |
| 89 bool is_server; |
| 90 }; |
| 91 |
| 92 // Constructs various test permutations. |
| 93 vector<TestParams> GetTestParams() { |
| 94 vector<TestParams> params; |
| 95 QuicVersionVector all_supported_versions = QuicSupportedVersions(); |
| 96 for (const QuicVersion version : all_supported_versions) { |
| 97 params.push_back(TestParams(version, true)); |
| 98 params.push_back(TestParams(version, true)); |
| 99 } |
| 100 return params; |
| 101 } |
| 102 |
| 103 class QuicHeadersStreamTest : public ::testing::TestWithParam<TestParams> { |
| 104 public: |
83 QuicHeadersStreamTest() | 105 QuicHeadersStreamTest() |
84 : connection_(new StrictMock<MockConnection>(is_server(), GetVersions())), | 106 : connection_(new StrictMock<MockConnection>(is_server(), GetVersion())), |
85 session_(connection_), | 107 session_(connection_), |
86 headers_stream_(QuicSessionPeer::GetHeadersStream(&session_)), | 108 headers_stream_(QuicSessionPeer::GetHeadersStream(&session_)), |
87 body_("hello world"), | 109 body_("hello world"), |
88 framer_(SPDY3) { | 110 framer_(version() > QUIC_VERSION_23 ? SPDY4 : SPDY3) { |
89 headers_[":version"] = "HTTP/1.1"; | 111 headers_[":version"] = "HTTP/1.1"; |
90 headers_[":status"] = "200 Ok"; | 112 headers_[":status"] = "200 Ok"; |
91 headers_["content-length"] = "11"; | 113 headers_["content-length"] = "11"; |
92 framer_.set_visitor(&visitor_); | 114 framer_.set_visitor(&visitor_); |
93 EXPECT_EQ(QuicVersionMax(), session_.connection()->version()); | 115 EXPECT_EQ(version(), session_.connection()->version()); |
94 EXPECT_TRUE(headers_stream_ != nullptr); | 116 EXPECT_TRUE(headers_stream_ != nullptr); |
| 117 VLOG(1) << GetParam(); |
95 } | 118 } |
96 | 119 |
97 QuicConsumedData SaveIov(const IOVector& data) { | 120 QuicConsumedData SaveIov(const IOVector& data) { |
98 const iovec* iov = data.iovec(); | 121 const iovec* iov = data.iovec(); |
99 int count = data.Capacity(); | 122 int count = data.Capacity(); |
100 for (int i = 0 ; i < count; ++i) { | 123 for (int i = 0 ; i < count; ++i) { |
101 saved_data_.append(static_cast<char*>(iov[i].iov_base), iov[i].iov_len); | 124 saved_data_.append(static_cast<char*>(iov[i].iov_base), iov[i].iov_len); |
102 } | 125 } |
103 return QuicConsumedData(saved_data_.length(), false); | 126 return QuicConsumedData(saved_data_.length(), false); |
104 } | 127 } |
(...skipping 22 matching lines...) Expand all Loading... |
127 bool fin, | 150 bool fin, |
128 QuicPriority priority, | 151 QuicPriority priority, |
129 SpdyFrameType type) { | 152 SpdyFrameType type) { |
130 // Write the headers and capture the outgoing data | 153 // Write the headers and capture the outgoing data |
131 EXPECT_CALL(session_, WritevData(kHeadersStreamId, _, _, false, _, nullptr)) | 154 EXPECT_CALL(session_, WritevData(kHeadersStreamId, _, _, false, _, nullptr)) |
132 .WillOnce(WithArgs<1>(Invoke(this, &QuicHeadersStreamTest::SaveIov))); | 155 .WillOnce(WithArgs<1>(Invoke(this, &QuicHeadersStreamTest::SaveIov))); |
133 headers_stream_->WriteHeaders(stream_id, headers_, fin, nullptr); | 156 headers_stream_->WriteHeaders(stream_id, headers_, fin, nullptr); |
134 | 157 |
135 // Parse the outgoing data and check that it matches was was written. | 158 // Parse the outgoing data and check that it matches was was written. |
136 if (type == SYN_STREAM) { | 159 if (type == SYN_STREAM) { |
137 EXPECT_CALL(visitor_, OnSynStream(stream_id, kNoAssociatedStream, 0, | 160 if (version() > QUIC_VERSION_23) { |
138 // priority, | 161 EXPECT_CALL(visitor_, OnHeaders(stream_id, kHasPriority, priority, fin, |
139 fin, kNotUnidirectional)); | 162 kFrameComplete)); |
| 163 } else { |
| 164 EXPECT_CALL(visitor_, |
| 165 OnSynStream(stream_id, kNoAssociatedStream, |
| 166 /*priority=*/0, fin, kNotUnidirectional)); |
| 167 } |
140 } else { | 168 } else { |
141 EXPECT_CALL(visitor_, OnSynReply(stream_id, fin)); | 169 if (version() > QUIC_VERSION_23) { |
| 170 EXPECT_CALL(visitor_, OnHeaders(stream_id, !kHasPriority, |
| 171 /*priority=*/0, fin, kFrameComplete)); |
| 172 } else { |
| 173 EXPECT_CALL(visitor_, OnSynReply(stream_id, fin)); |
| 174 } |
142 } | 175 } |
143 EXPECT_CALL(visitor_, OnControlFrameHeaderData(stream_id, _, _)) | 176 EXPECT_CALL(visitor_, OnControlFrameHeaderData(stream_id, _, _)) |
144 .WillRepeatedly(WithArgs<1, 2>( | 177 .WillRepeatedly(WithArgs<1, 2>( |
145 Invoke(this, &QuicHeadersStreamTest::SaveHeaderData))); | 178 Invoke(this, &QuicHeadersStreamTest::SaveHeaderData))); |
146 if (fin) { | 179 if (fin) { |
147 EXPECT_CALL(visitor_, OnStreamFrameData(stream_id, nullptr, 0, true)); | 180 EXPECT_CALL(visitor_, OnStreamFrameData(stream_id, nullptr, 0, true)); |
148 } | 181 } |
149 framer_.ProcessInput(saved_data_.data(), saved_data_.length()); | 182 framer_.ProcessInput(saved_data_.data(), saved_data_.length()); |
150 EXPECT_FALSE(framer_.HasError()) << framer_.error_code(); | 183 EXPECT_FALSE(framer_.HasError()) << framer_.error_code(); |
151 | 184 |
152 CheckHeaders(); | 185 CheckHeaders(); |
153 saved_data_.clear(); | 186 saved_data_.clear(); |
154 } | 187 } |
155 | 188 |
156 void CheckHeaders() { | 189 void CheckHeaders() { |
157 SpdyHeaderBlock headers; | 190 SpdyHeaderBlock headers; |
158 EXPECT_EQ(saved_header_data_.length(), | 191 EXPECT_EQ(saved_header_data_.length(), |
159 framer_.ParseHeaderBlockInBuffer(saved_header_data_.data(), | 192 framer_.ParseHeaderBlockInBuffer(saved_header_data_.data(), |
160 saved_header_data_.length(), | 193 saved_header_data_.length(), |
161 &headers)); | 194 &headers)); |
162 EXPECT_EQ(headers_, headers); | 195 EXPECT_EQ(headers_, headers); |
163 saved_header_data_.clear(); | 196 saved_header_data_.clear(); |
164 } | 197 } |
165 | 198 |
166 bool is_server() { | 199 bool is_server() { return GetParam().is_server; } |
167 return GetParam(); | 200 |
| 201 QuicVersion version() { return GetParam().version; } |
| 202 |
| 203 QuicVersionVector GetVersion() { |
| 204 QuicVersionVector versions; |
| 205 versions.push_back(version()); |
| 206 return versions; |
168 } | 207 } |
169 | 208 |
170 void CloseConnection() { | 209 void CloseConnection() { |
171 QuicConnectionPeer::CloseConnection(connection_); | 210 QuicConnectionPeer::CloseConnection(connection_); |
172 } | 211 } |
173 | 212 |
| 213 static const bool kFrameComplete = true; |
| 214 static const bool kHasPriority = true; |
174 static const bool kNotUnidirectional = false; | 215 static const bool kNotUnidirectional = false; |
175 static const bool kNoAssociatedStream = false; | 216 static const bool kNoAssociatedStream = false; |
176 | 217 |
177 StrictMock<MockConnection>* connection_; | 218 StrictMock<MockConnection>* connection_; |
178 StrictMock<MockSession> session_; | 219 StrictMock<MockSession> session_; |
179 QuicHeadersStream* headers_stream_; | 220 QuicHeadersStream* headers_stream_; |
180 SpdyHeaderBlock headers_; | 221 SpdyHeaderBlock headers_; |
181 string body_; | 222 string body_; |
182 string saved_data_; | 223 string saved_data_; |
183 string saved_header_data_; | 224 string saved_header_data_; |
184 SpdyFramer framer_; | 225 SpdyFramer framer_; |
185 StrictMock<MockVisitor> visitor_; | 226 StrictMock<MockVisitor> visitor_; |
186 }; | 227 }; |
187 | 228 |
188 INSTANTIATE_TEST_CASE_P(Tests, QuicHeadersStreamTest, testing::Bool()); | 229 INSTANTIATE_TEST_CASE_P(Tests, |
| 230 QuicHeadersStreamTest, |
| 231 ::testing::ValuesIn(GetTestParams())); |
189 | 232 |
190 TEST_P(QuicHeadersStreamTest, StreamId) { | 233 TEST_P(QuicHeadersStreamTest, StreamId) { |
191 EXPECT_EQ(3u, headers_stream_->id()); | 234 EXPECT_EQ(3u, headers_stream_->id()); |
192 } | 235 } |
193 | 236 |
194 TEST_P(QuicHeadersStreamTest, EffectivePriority) { | 237 TEST_P(QuicHeadersStreamTest, EffectivePriority) { |
195 EXPECT_EQ(0u, headers_stream_->EffectivePriority()); | 238 EXPECT_EQ(0u, headers_stream_->EffectivePriority()); |
196 } | 239 } |
197 | 240 |
198 TEST_P(QuicHeadersStreamTest, WriteHeaders) { | 241 TEST_P(QuicHeadersStreamTest, WriteHeaders) { |
(...skipping 14 matching lines...) Expand all Loading... |
213 | 256 |
214 TEST_P(QuicHeadersStreamTest, ProcessRawData) { | 257 TEST_P(QuicHeadersStreamTest, ProcessRawData) { |
215 for (QuicStreamId stream_id = kClientDataStreamId1; | 258 for (QuicStreamId stream_id = kClientDataStreamId1; |
216 stream_id < kClientDataStreamId3; stream_id += 2) { | 259 stream_id < kClientDataStreamId3; stream_id += 2) { |
217 for (int count = 0; count < 2; ++count) { | 260 for (int count = 0; count < 2; ++count) { |
218 bool fin = (count == 0); | 261 bool fin = (count == 0); |
219 for (QuicPriority priority = 0; priority < 7; ++priority) { | 262 for (QuicPriority priority = 0; priority < 7; ++priority) { |
220 // Replace with "WriteHeadersAndSaveData" | 263 // Replace with "WriteHeadersAndSaveData" |
221 scoped_ptr<SpdySerializedFrame> frame; | 264 scoped_ptr<SpdySerializedFrame> frame; |
222 if (is_server()) { | 265 if (is_server()) { |
223 SpdySynStreamIR syn_stream(stream_id); | 266 if (version() > QUIC_VERSION_23) { |
224 syn_stream.set_name_value_block(headers_); | 267 SpdyHeadersIR headers_frame(stream_id); |
225 syn_stream.set_fin(fin); | 268 headers_frame.set_name_value_block(headers_); |
226 frame.reset(framer_.SerializeSynStream(syn_stream)); | 269 headers_frame.set_fin(fin); |
| 270 headers_frame.set_has_priority(true); |
| 271 frame.reset(framer_.SerializeFrame(headers_frame)); |
| 272 } else { |
| 273 SpdySynStreamIR syn_stream(stream_id); |
| 274 syn_stream.set_name_value_block(headers_); |
| 275 syn_stream.set_fin(fin); |
| 276 frame.reset(framer_.SerializeSynStream(syn_stream)); |
| 277 } |
227 EXPECT_CALL(session_, OnStreamHeadersPriority(stream_id, 0)); | 278 EXPECT_CALL(session_, OnStreamHeadersPriority(stream_id, 0)); |
228 } else { | 279 } else { |
229 SpdySynReplyIR syn_reply(stream_id); | 280 if (version() > QUIC_VERSION_23) { |
230 syn_reply.set_name_value_block(headers_); | 281 SpdyHeadersIR headers_frame(stream_id); |
231 syn_reply.set_fin(fin); | 282 headers_frame.set_name_value_block(headers_); |
232 frame.reset(framer_.SerializeSynReply(syn_reply)); | 283 headers_frame.set_fin(fin); |
| 284 frame.reset(framer_.SerializeFrame(headers_frame)); |
| 285 } else { |
| 286 SpdySynReplyIR syn_reply(stream_id); |
| 287 syn_reply.set_name_value_block(headers_); |
| 288 syn_reply.set_fin(fin); |
| 289 frame.reset(framer_.SerializeSynReply(syn_reply)); |
| 290 } |
233 } | 291 } |
234 EXPECT_CALL(session_, OnStreamHeaders(stream_id, _)) | 292 EXPECT_CALL(session_, OnStreamHeaders(stream_id, _)) |
235 .WillRepeatedly(WithArgs<1>( | 293 .WillRepeatedly(WithArgs<1>( |
236 Invoke(this, | 294 Invoke(this, |
237 &QuicHeadersStreamTest::SaveHeaderDataStringPiece))); | 295 &QuicHeadersStreamTest::SaveHeaderDataStringPiece))); |
238 EXPECT_CALL(session_, | 296 EXPECT_CALL(session_, |
239 OnStreamHeadersComplete(stream_id, fin, frame->size())); | 297 OnStreamHeadersComplete(stream_id, fin, frame->size())); |
240 headers_stream_->ProcessRawData(frame->data(), frame->size()); | 298 headers_stream_->ProcessRawData(frame->data(), frame->size()); |
241 | 299 |
242 CheckHeaders(); | 300 CheckHeaders(); |
243 } | 301 } |
244 } | 302 } |
245 } | 303 } |
246 } | 304 } |
247 | 305 |
248 TEST_P(QuicHeadersStreamTest, ProcessBadData) { | 306 TEST_P(QuicHeadersStreamTest, ProcessBadData) { |
249 const char kBadData[] = "blah blah blah"; | 307 const char kBadData[] = "blah blah blah"; |
250 EXPECT_CALL(*connection_, | 308 EXPECT_CALL(*connection_, SendConnectionCloseWithDetails( |
251 SendConnectionCloseWithDetails( | 309 QUIC_INVALID_HEADERS_STREAM_DATA, _)) |
252 QUIC_INVALID_HEADERS_STREAM_DATA, | 310 .Times(::testing::AnyNumber()); |
253 "SPDY framing error: SPDY_INVALID_DATA_FRAME_FLAGS")); | |
254 headers_stream_->ProcessRawData(kBadData, strlen(kBadData)); | 311 headers_stream_->ProcessRawData(kBadData, strlen(kBadData)); |
255 } | 312 } |
256 | 313 |
257 TEST_P(QuicHeadersStreamTest, ProcessSpdyDataFrame) { | 314 TEST_P(QuicHeadersStreamTest, ProcessSpdyDataFrame) { |
258 SpdyDataIR data(2, ""); | 315 SpdyDataIR data(2, ""); |
259 scoped_ptr<SpdySerializedFrame> frame(framer_.SerializeFrame(data)); | 316 scoped_ptr<SpdySerializedFrame> frame(framer_.SerializeFrame(data)); |
260 EXPECT_CALL(*connection_, | 317 EXPECT_CALL(*connection_, |
261 SendConnectionCloseWithDetails(QUIC_INVALID_HEADERS_STREAM_DATA, | 318 SendConnectionCloseWithDetails(QUIC_INVALID_HEADERS_STREAM_DATA, |
262 "SPDY DATA frame received.")) | 319 "SPDY DATA frame received.")) |
263 .WillOnce(InvokeWithoutArgs(this, | 320 .WillOnce(InvokeWithoutArgs(this, |
264 &QuicHeadersStreamTest::CloseConnection)); | 321 &QuicHeadersStreamTest::CloseConnection)); |
265 headers_stream_->ProcessRawData(frame->data(), frame->size()); | 322 headers_stream_->ProcessRawData(frame->data(), frame->size()); |
266 } | 323 } |
267 | 324 |
268 TEST_P(QuicHeadersStreamTest, ProcessSpdyRstStreamFrame) { | 325 TEST_P(QuicHeadersStreamTest, ProcessSpdyRstStreamFrame) { |
269 SpdyRstStreamIR data(2, RST_STREAM_PROTOCOL_ERROR, ""); | 326 SpdyRstStreamIR data(2, RST_STREAM_PROTOCOL_ERROR, ""); |
270 scoped_ptr<SpdySerializedFrame> frame(framer_.SerializeFrame(data)); | 327 scoped_ptr<SpdySerializedFrame> frame(framer_.SerializeFrame(data)); |
271 EXPECT_CALL(*connection_, | 328 EXPECT_CALL(*connection_, |
272 SendConnectionCloseWithDetails( | 329 SendConnectionCloseWithDetails( |
273 QUIC_INVALID_HEADERS_STREAM_DATA, | 330 QUIC_INVALID_HEADERS_STREAM_DATA, |
274 "SPDY RST_STREAM frame received.")) | 331 "SPDY RST_STREAM frame received.")) |
275 .WillOnce(InvokeWithoutArgs(this, | 332 .WillOnce(InvokeWithoutArgs(this, |
276 &QuicHeadersStreamTest::CloseConnection)); | 333 &QuicHeadersStreamTest::CloseConnection)); |
277 headers_stream_->ProcessRawData(frame->data(), frame->size()); | 334 headers_stream_->ProcessRawData(frame->data(), frame->size()); |
278 } | 335 } |
279 | 336 |
280 TEST_P(QuicHeadersStreamTest, ProcessSpdySettingsFrame) { | 337 TEST_P(QuicHeadersStreamTest, ProcessSpdySettingsFrame) { |
281 SpdySettingsIR data; | 338 SpdySettingsIR data; |
282 data.AddSetting(SETTINGS_UPLOAD_BANDWIDTH, true, true, 0); | 339 if (version() > QUIC_VERSION_23) { |
| 340 data.AddSetting(SETTINGS_HEADER_TABLE_SIZE, true, true, 0); |
| 341 } else { |
| 342 data.AddSetting(SETTINGS_UPLOAD_BANDWIDTH, true, true, 0); |
| 343 } |
283 scoped_ptr<SpdySerializedFrame> frame(framer_.SerializeFrame(data)); | 344 scoped_ptr<SpdySerializedFrame> frame(framer_.SerializeFrame(data)); |
284 EXPECT_CALL(*connection_, | 345 EXPECT_CALL(*connection_, |
285 SendConnectionCloseWithDetails( | 346 SendConnectionCloseWithDetails( |
286 QUIC_INVALID_HEADERS_STREAM_DATA, | 347 QUIC_INVALID_HEADERS_STREAM_DATA, |
287 "SPDY SETTINGS frame received.")) | 348 "SPDY SETTINGS frame received.")) |
288 .WillOnce(InvokeWithoutArgs(this, | 349 .WillOnce(InvokeWithoutArgs(this, |
289 &QuicHeadersStreamTest::CloseConnection)); | 350 &QuicHeadersStreamTest::CloseConnection)); |
290 headers_stream_->ProcessRawData(frame->data(), frame->size()); | 351 headers_stream_->ProcessRawData(frame->data(), frame->size()); |
291 } | 352 } |
292 | 353 |
(...skipping 13 matching lines...) Expand all Loading... |
306 scoped_ptr<SpdySerializedFrame> frame(framer_.SerializeFrame(data)); | 367 scoped_ptr<SpdySerializedFrame> frame(framer_.SerializeFrame(data)); |
307 EXPECT_CALL(*connection_, | 368 EXPECT_CALL(*connection_, |
308 SendConnectionCloseWithDetails(QUIC_INVALID_HEADERS_STREAM_DATA, | 369 SendConnectionCloseWithDetails(QUIC_INVALID_HEADERS_STREAM_DATA, |
309 "SPDY GOAWAY frame received.")) | 370 "SPDY GOAWAY frame received.")) |
310 .WillOnce(InvokeWithoutArgs(this, | 371 .WillOnce(InvokeWithoutArgs(this, |
311 &QuicHeadersStreamTest::CloseConnection)); | 372 &QuicHeadersStreamTest::CloseConnection)); |
312 headers_stream_->ProcessRawData(frame->data(), frame->size()); | 373 headers_stream_->ProcessRawData(frame->data(), frame->size()); |
313 } | 374 } |
314 | 375 |
315 TEST_P(QuicHeadersStreamTest, ProcessSpdyHeadersFrame) { | 376 TEST_P(QuicHeadersStreamTest, ProcessSpdyHeadersFrame) { |
| 377 if (version() > QUIC_VERSION_23) { |
| 378 // HEADERS frames are an error when using SPDY/3, but |
| 379 // when using SPDY/4 they're the "normal" way of sending headers |
| 380 // so we test their handling in the ProcessRawData test. |
| 381 return; |
| 382 } |
316 SpdyHeadersIR data(1); | 383 SpdyHeadersIR data(1); |
317 scoped_ptr<SpdySerializedFrame> frame(framer_.SerializeFrame(data)); | 384 scoped_ptr<SpdySerializedFrame> frame(framer_.SerializeFrame(data)); |
318 EXPECT_CALL(*connection_, | 385 EXPECT_CALL(*connection_, |
319 SendConnectionCloseWithDetails(QUIC_INVALID_HEADERS_STREAM_DATA, | 386 SendConnectionCloseWithDetails(QUIC_INVALID_HEADERS_STREAM_DATA, |
320 "SPDY HEADERS frame received.")) | 387 "SPDY HEADERS frame received.")) |
321 .WillOnce(InvokeWithoutArgs(this, | 388 .WillOnce(InvokeWithoutArgs(this, |
322 &QuicHeadersStreamTest::CloseConnection)); | 389 &QuicHeadersStreamTest::CloseConnection)); |
323 headers_stream_->ProcessRawData(frame->data(), frame->size()); | 390 headers_stream_->ProcessRawData(frame->data(), frame->size()); |
324 } | 391 } |
325 | 392 |
(...skipping 11 matching lines...) Expand all Loading... |
337 | 404 |
338 TEST_P(QuicHeadersStreamTest, NoConnectionLevelFlowControl) { | 405 TEST_P(QuicHeadersStreamTest, NoConnectionLevelFlowControl) { |
339 EXPECT_TRUE(headers_stream_->flow_controller()->IsEnabled()); | 406 EXPECT_TRUE(headers_stream_->flow_controller()->IsEnabled()); |
340 EXPECT_FALSE(ReliableQuicStreamPeer::StreamContributesToConnectionFlowControl( | 407 EXPECT_FALSE(ReliableQuicStreamPeer::StreamContributesToConnectionFlowControl( |
341 headers_stream_)); | 408 headers_stream_)); |
342 } | 409 } |
343 | 410 |
344 } // namespace | 411 } // namespace |
345 } // namespace test | 412 } // namespace test |
346 } // namespace net | 413 } // namespace net |
OLD | NEW |