OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/core/quic_session.h" | 5 #include "net/quic/core/quic_session.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 class QuicSessionTestBase : public ::testing::TestWithParam<QuicVersion> { | 205 class QuicSessionTestBase : public ::testing::TestWithParam<QuicVersion> { |
206 protected: | 206 protected: |
207 explicit QuicSessionTestBase(Perspective perspective) | 207 explicit QuicSessionTestBase(Perspective perspective) |
208 : connection_( | 208 : connection_( |
209 new StrictMock<MockQuicConnection>(&helper_, | 209 new StrictMock<MockQuicConnection>(&helper_, |
210 &alarm_factory_, | 210 &alarm_factory_, |
211 perspective, | 211 perspective, |
212 SupportedVersions(GetParam()))), | 212 SupportedVersions(GetParam()))), |
213 session_(connection_) { | 213 session_(connection_) { |
214 FLAGS_quic_always_log_bugs_for_tests = true; | |
215 session_.config()->SetInitialStreamFlowControlWindowToSend( | 214 session_.config()->SetInitialStreamFlowControlWindowToSend( |
216 kInitialStreamFlowControlWindowForTest); | 215 kInitialStreamFlowControlWindowForTest); |
217 session_.config()->SetInitialSessionFlowControlWindowToSend( | 216 session_.config()->SetInitialSessionFlowControlWindowToSend( |
218 kInitialSessionFlowControlWindowForTest); | 217 kInitialSessionFlowControlWindowForTest); |
219 headers_[":host"] = "www.google.com"; | 218 headers_[":host"] = "www.google.com"; |
220 headers_[":path"] = "/index.hml"; | 219 headers_[":path"] = "/index.hml"; |
221 headers_[":scheme"] = "http"; | 220 headers_[":scheme"] = "http"; |
222 headers_["cookie"] = | 221 headers_["cookie"] = |
223 "__utma=208381060.1228362404.1372200928.1372200928.1372200928.1; " | 222 "__utma=208381060.1228362404.1372200928.1372200928.1372200928.1; " |
224 "__utmc=160408618; " | 223 "__utmc=160408618; " |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 // Create the largest stream ID of a threatened total of 200 streams. | 373 // Create the largest stream ID of a threatened total of 200 streams. |
375 session_.GetOrCreateDynamicStream(stream_id + 2 * (200 - 1)); | 374 session_.GetOrCreateDynamicStream(stream_id + 2 * (200 - 1)); |
376 } | 375 } |
377 | 376 |
378 TEST_P(QuicSessionTestServer, DebugDFatalIfMarkingClosedStreamWriteBlocked) { | 377 TEST_P(QuicSessionTestServer, DebugDFatalIfMarkingClosedStreamWriteBlocked) { |
379 TestStream* stream2 = session_.CreateOutgoingDynamicStream(kDefaultPriority); | 378 TestStream* stream2 = session_.CreateOutgoingDynamicStream(kDefaultPriority); |
380 QuicStreamId closed_stream_id = stream2->id(); | 379 QuicStreamId closed_stream_id = stream2->id(); |
381 // Close the stream. | 380 // Close the stream. |
382 EXPECT_CALL(*connection_, SendRstStream(closed_stream_id, _, _)); | 381 EXPECT_CALL(*connection_, SendRstStream(closed_stream_id, _, _)); |
383 stream2->Reset(QUIC_BAD_APPLICATION_PAYLOAD); | 382 stream2->Reset(QUIC_BAD_APPLICATION_PAYLOAD); |
384 EXPECT_DEBUG_DFATAL( | 383 EXPECT_QUIC_BUG(session_.MarkConnectionLevelWriteBlocked(closed_stream_id), |
385 session_.MarkConnectionLevelWriteBlocked(closed_stream_id), | 384 "Marking unknown stream 2 blocked."); |
386 "Marking unknown stream 2 blocked."); | |
387 } | 385 } |
388 | 386 |
389 TEST_P(QuicSessionTestServer, OnCanWrite) { | 387 TEST_P(QuicSessionTestServer, OnCanWrite) { |
390 TestStream* stream2 = session_.CreateOutgoingDynamicStream(kDefaultPriority); | 388 TestStream* stream2 = session_.CreateOutgoingDynamicStream(kDefaultPriority); |
391 TestStream* stream4 = session_.CreateOutgoingDynamicStream(kDefaultPriority); | 389 TestStream* stream4 = session_.CreateOutgoingDynamicStream(kDefaultPriority); |
392 TestStream* stream6 = session_.CreateOutgoingDynamicStream(kDefaultPriority); | 390 TestStream* stream6 = session_.CreateOutgoingDynamicStream(kDefaultPriority); |
393 | 391 |
394 session_.MarkConnectionLevelWriteBlocked(stream2->id()); | 392 session_.MarkConnectionLevelWriteBlocked(stream2->id()); |
395 session_.MarkConnectionLevelWriteBlocked(stream6->id()); | 393 session_.MarkConnectionLevelWriteBlocked(stream6->id()); |
396 session_.MarkConnectionLevelWriteBlocked(stream4->id()); | 394 session_.MarkConnectionLevelWriteBlocked(stream4->id()); |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 if (version() <= QUIC_VERSION_35) { | 1252 if (version() <= QUIC_VERSION_35) { |
1255 EXPECT_FALSE(session_.force_hol_blocking()); | 1253 EXPECT_FALSE(session_.force_hol_blocking()); |
1256 } else { | 1254 } else { |
1257 EXPECT_TRUE(session_.force_hol_blocking()); | 1255 EXPECT_TRUE(session_.force_hol_blocking()); |
1258 } | 1256 } |
1259 } | 1257 } |
1260 | 1258 |
1261 } // namespace | 1259 } // namespace |
1262 } // namespace test | 1260 } // namespace test |
1263 } // namespace net | 1261 } // namespace net |
OLD | NEW |