| 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/test_tools/quic_test_utils.h" | 5 #include "net/quic/test_tools/quic_test_utils.h" |
| 6 | 6 |
| 7 #include "base/sha1.h" | 7 #include "base/sha1.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "net/quic/crypto/crypto_framer.h" | 10 #include "net/quic/crypto/crypto_framer.h" |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 void MockHelper::AdvanceTime(QuicTime::Delta delta) { | 229 void MockHelper::AdvanceTime(QuicTime::Delta delta) { |
| 230 clock_.AdvanceTime(delta); | 230 clock_.AdvanceTime(delta); |
| 231 } | 231 } |
| 232 | 232 |
| 233 QuicPacketWriter* NiceMockPacketWriterFactory::Create( | 233 QuicPacketWriter* NiceMockPacketWriterFactory::Create( |
| 234 QuicConnection* /*connection*/) const { | 234 QuicConnection* /*connection*/) const { |
| 235 return new testing::NiceMock<MockPacketWriter>(); | 235 return new testing::NiceMock<MockPacketWriter>(); |
| 236 } | 236 } |
| 237 | 237 |
| 238 MockConnection::MockConnection(Perspective perspective) | 238 MockConnection::MockConnection(Perspective perspective) |
| 239 : MockConnection(perspective, | |
| 240 /* is_secure= */ false) { | |
| 241 } | |
| 242 | |
| 243 MockConnection::MockConnection(Perspective perspective, bool is_secure) | |
| 244 : MockConnection(kTestConnectionId, | 239 : MockConnection(kTestConnectionId, |
| 245 IPEndPoint(TestPeerIPAddress(), kTestPort), | 240 IPEndPoint(TestPeerIPAddress(), kTestPort), |
| 246 perspective, | 241 perspective, |
| 247 is_secure, | |
| 248 QuicSupportedVersions()) { | 242 QuicSupportedVersions()) { |
| 249 } | 243 } |
| 250 | 244 |
| 251 MockConnection::MockConnection(IPEndPoint address, Perspective perspective) | 245 MockConnection::MockConnection(IPEndPoint address, Perspective perspective) |
| 252 : MockConnection(kTestConnectionId, | 246 : MockConnection(kTestConnectionId, |
| 253 address, | 247 address, |
| 254 perspective, | 248 perspective, |
| 255 /* is_secure= */ false, | |
| 256 QuicSupportedVersions()) { | 249 QuicSupportedVersions()) { |
| 257 } | 250 } |
| 258 | 251 |
| 259 MockConnection::MockConnection(QuicConnectionId connection_id, | 252 MockConnection::MockConnection(QuicConnectionId connection_id, |
| 260 Perspective perspective) | 253 Perspective perspective) |
| 261 : MockConnection(connection_id, | 254 : MockConnection(connection_id, |
| 262 perspective, | |
| 263 /* is_secure= */ false) { | |
| 264 } | |
| 265 | |
| 266 MockConnection::MockConnection(QuicConnectionId connection_id, | |
| 267 Perspective perspective, | |
| 268 bool is_secure) | |
| 269 : MockConnection(connection_id, | |
| 270 IPEndPoint(TestPeerIPAddress(), kTestPort), | 255 IPEndPoint(TestPeerIPAddress(), kTestPort), |
| 271 perspective, | 256 perspective, |
| 272 is_secure, | |
| 273 QuicSupportedVersions()) { | 257 QuicSupportedVersions()) { |
| 274 } | 258 } |
| 275 | 259 |
| 276 MockConnection::MockConnection(Perspective perspective, | 260 MockConnection::MockConnection(Perspective perspective, |
| 277 const QuicVersionVector& supported_versions) | 261 const QuicVersionVector& supported_versions) |
| 278 : MockConnection(kTestConnectionId, | 262 : MockConnection(kTestConnectionId, |
| 279 IPEndPoint(TestPeerIPAddress(), kTestPort), | 263 IPEndPoint(TestPeerIPAddress(), kTestPort), |
| 280 perspective, | 264 perspective, |
| 281 /* is_secure= */ false, | |
| 282 supported_versions) { | 265 supported_versions) { |
| 283 } | 266 } |
| 284 | 267 |
| 285 MockConnection::MockConnection(QuicConnectionId connection_id, | 268 MockConnection::MockConnection(QuicConnectionId connection_id, |
| 286 IPEndPoint address, | 269 IPEndPoint address, |
| 287 Perspective perspective, | 270 Perspective perspective, |
| 288 bool is_secure, | |
| 289 const QuicVersionVector& supported_versions) | 271 const QuicVersionVector& supported_versions) |
| 290 : QuicConnection(connection_id, | 272 : QuicConnection(connection_id, |
| 291 address, | 273 address, |
| 292 new testing::NiceMock<MockHelper>(), | 274 new testing::NiceMock<MockHelper>(), |
| 293 NiceMockPacketWriterFactory(), | 275 NiceMockPacketWriterFactory(), |
| 294 /* owns_writer= */ true, | 276 /* owns_writer= */ true, |
| 295 perspective, | 277 perspective, |
| 296 is_secure, | |
| 297 supported_versions), | 278 supported_versions), |
| 298 helper_(helper()) { | 279 helper_(helper()) { |
| 299 ON_CALL(*this, OnError(_)) | 280 ON_CALL(*this, OnError(_)) |
| 300 .WillByDefault( | 281 .WillByDefault( |
| 301 Invoke(this, &PacketSavingConnection::QuicConnection_OnError)); | 282 Invoke(this, &PacketSavingConnection::QuicConnection_OnError)); |
| 302 } | 283 } |
| 303 | 284 |
| 304 MockConnection::~MockConnection() { | 285 MockConnection::~MockConnection() { |
| 305 } | 286 } |
| 306 | 287 |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 *server_session = new TestQuicSpdyServerSession( | 807 *server_session = new TestQuicSpdyServerSession( |
| 827 *server_connection, DefaultQuicConfig(), server_crypto_config); | 808 *server_connection, DefaultQuicConfig(), server_crypto_config); |
| 828 | 809 |
| 829 // We advance the clock initially because the default time is zero and the | 810 // We advance the clock initially because the default time is zero and the |
| 830 // strike register worries that we've just overflowed a uint32 time. | 811 // strike register worries that we've just overflowed a uint32 time. |
| 831 (*server_connection)->AdvanceTime(connection_start_time); | 812 (*server_connection)->AdvanceTime(connection_start_time); |
| 832 } | 813 } |
| 833 | 814 |
| 834 } // namespace test | 815 } // namespace test |
| 835 } // namespace net | 816 } // namespace net |
| OLD | NEW |