| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 void MockHelper::AdvanceTime(QuicTime::Delta delta) { | 223 void MockHelper::AdvanceTime(QuicTime::Delta delta) { |
| 224 clock_.AdvanceTime(delta); | 224 clock_.AdvanceTime(delta); |
| 225 } | 225 } |
| 226 | 226 |
| 227 QuicPacketWriter* NiceMockPacketWriterFactory::Create( | 227 QuicPacketWriter* NiceMockPacketWriterFactory::Create( |
| 228 QuicConnection* /*connection*/) const { | 228 QuicConnection* /*connection*/) const { |
| 229 return new testing::NiceMock<MockPacketWriter>(); | 229 return new testing::NiceMock<MockPacketWriter>(); |
| 230 } | 230 } |
| 231 | 231 |
| 232 MockConnection::MockConnection(MockHelper* helper, Perspective perspective) | 232 MockConnection::MockConnection(MockHelper* helper, Perspective perspective) |
| 233 : MockConnection(helper, perspective, /* is_secure= */ false) {} | |
| 234 | |
| 235 MockConnection::MockConnection(MockHelper* helper, | |
| 236 Perspective perspective, | |
| 237 bool is_secure) | |
| 238 : MockConnection(kTestConnectionId, | 233 : MockConnection(kTestConnectionId, |
| 239 IPEndPoint(TestPeerIPAddress(), kTestPort), | 234 IPEndPoint(TestPeerIPAddress(), kTestPort), |
| 240 helper, | 235 helper, |
| 241 perspective, | 236 perspective, |
| 242 is_secure, | |
| 243 QuicSupportedVersions()) {} | 237 QuicSupportedVersions()) {} |
| 244 | 238 |
| 245 MockConnection::MockConnection(IPEndPoint address, | 239 MockConnection::MockConnection(IPEndPoint address, |
| 246 MockHelper* helper, | 240 MockHelper* helper, |
| 247 Perspective perspective) | 241 Perspective perspective) |
| 248 : MockConnection(kTestConnectionId, | 242 : MockConnection(kTestConnectionId, |
| 249 address, | 243 address, |
| 250 helper, | 244 helper, |
| 251 perspective, | 245 perspective, |
| 252 /* is_secure= */ false, | |
| 253 QuicSupportedVersions()) {} | 246 QuicSupportedVersions()) {} |
| 254 | 247 |
| 255 MockConnection::MockConnection(QuicConnectionId connection_id, | 248 MockConnection::MockConnection(QuicConnectionId connection_id, |
| 256 MockHelper* helper, | 249 MockHelper* helper, |
| 257 Perspective perspective) | 250 Perspective perspective) |
| 258 : MockConnection(connection_id, | 251 : MockConnection(connection_id, |
| 259 helper, | |
| 260 perspective, | |
| 261 /* is_secure= */ false) {} | |
| 262 | |
| 263 MockConnection::MockConnection(QuicConnectionId connection_id, | |
| 264 MockHelper* helper, | |
| 265 Perspective perspective, | |
| 266 bool is_secure) | |
| 267 : MockConnection(connection_id, | |
| 268 IPEndPoint(TestPeerIPAddress(), kTestPort), | 252 IPEndPoint(TestPeerIPAddress(), kTestPort), |
| 269 helper, | 253 helper, |
| 270 perspective, | 254 perspective, |
| 271 is_secure, | |
| 272 QuicSupportedVersions()) {} | 255 QuicSupportedVersions()) {} |
| 273 | 256 |
| 274 MockConnection::MockConnection(MockHelper* helper, | 257 MockConnection::MockConnection(MockHelper* helper, |
| 275 Perspective perspective, | 258 Perspective perspective, |
| 276 const QuicVersionVector& supported_versions) | 259 const QuicVersionVector& supported_versions) |
| 277 : MockConnection(kTestConnectionId, | 260 : MockConnection(kTestConnectionId, |
| 278 IPEndPoint(TestPeerIPAddress(), kTestPort), | 261 IPEndPoint(TestPeerIPAddress(), kTestPort), |
| 279 helper, | 262 helper, |
| 280 perspective, | 263 perspective, |
| 281 /* is_secure= */ false, | |
| 282 supported_versions) {} | 264 supported_versions) {} |
| 283 | 265 |
| 284 MockConnection::MockConnection(QuicConnectionId connection_id, | 266 MockConnection::MockConnection(QuicConnectionId connection_id, |
| 285 IPEndPoint address, | 267 IPEndPoint address, |
| 286 MockHelper* helper, | 268 MockHelper* helper, |
| 287 Perspective perspective, | 269 Perspective perspective, |
| 288 bool is_secure, | |
| 289 const QuicVersionVector& supported_versions) | 270 const QuicVersionVector& supported_versions) |
| 290 : QuicConnection(connection_id, | 271 : QuicConnection(connection_id, |
| 291 address, | 272 address, |
| 292 helper, | 273 helper, |
| 293 NiceMockPacketWriterFactory(), | 274 NiceMockPacketWriterFactory(), |
| 294 /* owns_writer= */ true, | 275 /* owns_writer= */ true, |
| 295 perspective, | 276 perspective, |
| 296 is_secure, | |
| 297 supported_versions) { | 277 supported_versions) { |
| 298 ON_CALL(*this, OnError(_)) | 278 ON_CALL(*this, OnError(_)) |
| 299 .WillByDefault( | 279 .WillByDefault( |
| 300 Invoke(this, &PacketSavingConnection::QuicConnection_OnError)); | 280 Invoke(this, &PacketSavingConnection::QuicConnection_OnError)); |
| 301 } | 281 } |
| 302 | 282 |
| 303 MockConnection::~MockConnection() {} | 283 MockConnection::~MockConnection() {} |
| 304 | 284 |
| 305 void MockConnection::AdvanceTime(QuicTime::Delta delta) { | 285 void MockConnection::AdvanceTime(QuicTime::Delta delta) { |
| 306 static_cast<MockHelper*>(helper())->AdvanceTime(delta); | 286 static_cast<MockHelper*>(helper())->AdvanceTime(delta); |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 // strike register worries that we've just overflowed a uint32 time. | 798 // strike register worries that we've just overflowed a uint32 time. |
| 819 (*server_connection)->AdvanceTime(connection_start_time); | 799 (*server_connection)->AdvanceTime(connection_start_time); |
| 820 } | 800 } |
| 821 | 801 |
| 822 QuicStreamId QuicClientDataStreamId(int i) { | 802 QuicStreamId QuicClientDataStreamId(int i) { |
| 823 return kClientDataStreamId1 + 2 * i; | 803 return kClientDataStreamId1 + 2 * i; |
| 824 } | 804 } |
| 825 | 805 |
| 826 } // namespace test | 806 } // namespace test |
| 827 } // namespace net | 807 } // namespace net |
| OLD | NEW |