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/quic_session.h" | 5 #include "net/quic/quic_session.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 StrictMock<TestCryptoStream> crypto_stream_; | 190 StrictMock<TestCryptoStream> crypto_stream_; |
191 | 191 |
192 bool writev_consumes_all_data_; | 192 bool writev_consumes_all_data_; |
193 }; | 193 }; |
194 | 194 |
195 class QuicSessionTestBase : public ::testing::TestWithParam<QuicVersion> { | 195 class QuicSessionTestBase : public ::testing::TestWithParam<QuicVersion> { |
196 protected: | 196 protected: |
197 explicit QuicSessionTestBase(Perspective perspective) | 197 explicit QuicSessionTestBase(Perspective perspective) |
198 : connection_( | 198 : connection_( |
199 new StrictMock<MockConnection>(&helper_, | 199 new StrictMock<MockConnection>(&helper_, |
| 200 &alarm_factory_, |
200 perspective, | 201 perspective, |
201 SupportedVersions(GetParam()))), | 202 SupportedVersions(GetParam()))), |
202 session_(connection_) { | 203 session_(connection_) { |
203 FLAGS_quic_always_log_bugs_for_tests = true; | 204 FLAGS_quic_always_log_bugs_for_tests = true; |
204 session_.config()->SetInitialStreamFlowControlWindowToSend( | 205 session_.config()->SetInitialStreamFlowControlWindowToSend( |
205 kInitialStreamFlowControlWindowForTest); | 206 kInitialStreamFlowControlWindowForTest); |
206 session_.config()->SetInitialSessionFlowControlWindowToSend( | 207 session_.config()->SetInitialSessionFlowControlWindowToSend( |
207 kInitialSessionFlowControlWindowForTest); | 208 kInitialSessionFlowControlWindowForTest); |
208 headers_[":host"] = "www.google.com"; | 209 headers_[":host"] = "www.google.com"; |
209 headers_[":path"] = "/index.hml"; | 210 headers_[":path"] = "/index.hml"; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 | 251 |
251 void CloseStream(QuicStreamId id) { | 252 void CloseStream(QuicStreamId id) { |
252 EXPECT_CALL(*connection_, SendRstStream(id, _, _)); | 253 EXPECT_CALL(*connection_, SendRstStream(id, _, _)); |
253 session_.CloseStream(id); | 254 session_.CloseStream(id); |
254 closed_streams_.insert(id); | 255 closed_streams_.insert(id); |
255 } | 256 } |
256 | 257 |
257 QuicVersion version() const { return connection_->version(); } | 258 QuicVersion version() const { return connection_->version(); } |
258 | 259 |
259 MockConnectionHelper helper_; | 260 MockConnectionHelper helper_; |
| 261 MockAlarmFactory alarm_factory_; |
260 StrictMock<MockConnection>* connection_; | 262 StrictMock<MockConnection>* connection_; |
261 TestSession session_; | 263 TestSession session_; |
262 set<QuicStreamId> closed_streams_; | 264 set<QuicStreamId> closed_streams_; |
263 SpdyHeaderBlock headers_; | 265 SpdyHeaderBlock headers_; |
264 }; | 266 }; |
265 | 267 |
266 class QuicSessionTestServer : public QuicSessionTestBase { | 268 class QuicSessionTestServer : public QuicSessionTestBase { |
267 protected: | 269 protected: |
268 QuicSessionTestServer() : QuicSessionTestBase(Perspective::IS_SERVER) {} | 270 QuicSessionTestServer() : QuicSessionTestBase(Perspective::IS_SERVER) {} |
269 }; | 271 }; |
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 session_.OnConfigNegotiated(); | 1181 session_.OnConfigNegotiated(); |
1180 EXPECT_LT(session_.max_open_outgoing_streams(), | 1182 EXPECT_LT(session_.max_open_outgoing_streams(), |
1181 session_.max_open_incoming_streams()); | 1183 session_.max_open_incoming_streams()); |
1182 EXPECT_EQ(session_.max_open_outgoing_streams(), | 1184 EXPECT_EQ(session_.max_open_outgoing_streams(), |
1183 kDefaultMaxStreamsPerConnection); | 1185 kDefaultMaxStreamsPerConnection); |
1184 } | 1186 } |
1185 | 1187 |
1186 } // namespace | 1188 } // namespace |
1187 } // namespace test | 1189 } // namespace test |
1188 } // namespace net | 1190 } // namespace net |
OLD | NEW |