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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 const SerializedPacket& packet, | 294 const SerializedPacket& packet, |
295 TransmissionType transmission_type) { | 295 TransmissionType transmission_type) { |
296 packets_.push_back(packet.packet); | 296 packets_.push_back(packet.packet); |
297 QuicEncryptedPacket* encrypted = QuicConnectionPeer::GetFramer(this)-> | 297 QuicEncryptedPacket* encrypted = QuicConnectionPeer::GetFramer(this)-> |
298 EncryptPacket(level, packet.sequence_number, *packet.packet); | 298 EncryptPacket(level, packet.sequence_number, *packet.packet); |
299 encrypted_packets_.push_back(encrypted); | 299 encrypted_packets_.push_back(encrypted); |
300 return true; | 300 return true; |
301 } | 301 } |
302 | 302 |
303 MockSession::MockSession(QuicConnection* connection) | 303 MockSession::MockSession(QuicConnection* connection) |
304 : QuicSession(connection, kInitialFlowControlWindowForTest, | 304 : QuicSession(connection, DefaultQuicConfig()) { |
305 DefaultQuicConfig()) { | |
306 ON_CALL(*this, WritevData(_, _, _, _, _, _)) | 305 ON_CALL(*this, WritevData(_, _, _, _, _, _)) |
307 .WillByDefault(testing::Return(QuicConsumedData(0, false))); | 306 .WillByDefault(testing::Return(QuicConsumedData(0, false))); |
308 } | 307 } |
309 | 308 |
310 MockSession::~MockSession() { | 309 MockSession::~MockSession() { |
311 } | 310 } |
312 | 311 |
313 TestSession::TestSession(QuicConnection* connection, const QuicConfig& config) | 312 TestSession::TestSession(QuicConnection* connection, const QuicConfig& config) |
314 : QuicSession(connection, kInitialFlowControlWindowForTest, config), | 313 : QuicSession(connection, config), |
315 crypto_stream_(NULL) {} | 314 crypto_stream_(NULL) {} |
316 | 315 |
317 TestSession::~TestSession() {} | 316 TestSession::~TestSession() {} |
318 | 317 |
319 void TestSession::SetCryptoStream(QuicCryptoStream* stream) { | 318 void TestSession::SetCryptoStream(QuicCryptoStream* stream) { |
320 crypto_stream_ = stream; | 319 crypto_stream_ = stream; |
321 } | 320 } |
322 | 321 |
323 QuicCryptoStream* TestSession::GetCryptoStream() { | 322 QuicCryptoStream* TestSession::GetCryptoStream() { |
324 return crypto_stream_; | 323 return crypto_stream_; |
325 } | 324 } |
326 | 325 |
327 TestClientSession::TestClientSession(QuicConnection* connection, | 326 TestClientSession::TestClientSession(QuicConnection* connection, |
328 const QuicConfig& config) | 327 const QuicConfig& config) |
329 : QuicClientSessionBase(connection, kInitialFlowControlWindowForTest, | 328 : QuicClientSessionBase(connection, |
330 config), | 329 config), |
331 crypto_stream_(NULL) { | 330 crypto_stream_(NULL) { |
332 EXPECT_CALL(*this, OnProofValid(_)).Times(AnyNumber()); | 331 EXPECT_CALL(*this, OnProofValid(_)).Times(AnyNumber()); |
333 } | 332 } |
334 | 333 |
335 TestClientSession::~TestClientSession() {} | 334 TestClientSession::~TestClientSession() {} |
336 | 335 |
337 void TestClientSession::SetCryptoStream(QuicCryptoStream* stream) { | 336 void TestClientSession::SetCryptoStream(QuicCryptoStream* stream) { |
338 crypto_stream_ = stream; | 337 crypto_stream_ = stream; |
339 } | 338 } |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 return 1u; | 579 return 1u; |
581 } | 580 } |
582 | 581 |
583 MockEntropyCalculator::MockEntropyCalculator() {} | 582 MockEntropyCalculator::MockEntropyCalculator() {} |
584 | 583 |
585 MockEntropyCalculator::~MockEntropyCalculator() {} | 584 MockEntropyCalculator::~MockEntropyCalculator() {} |
586 | 585 |
587 QuicConfig DefaultQuicConfig() { | 586 QuicConfig DefaultQuicConfig() { |
588 QuicConfig config; | 587 QuicConfig config; |
589 config.SetDefaults(); | 588 config.SetDefaults(); |
| 589 config.SetInitialFlowControlWindowToSend(kInitialFlowControlWindowForTest); |
590 return config; | 590 return config; |
591 } | 591 } |
592 | 592 |
593 QuicVersionVector SupportedVersions(QuicVersion version) { | 593 QuicVersionVector SupportedVersions(QuicVersion version) { |
594 QuicVersionVector versions; | 594 QuicVersionVector versions; |
595 versions.push_back(version); | 595 versions.push_back(version); |
596 return versions; | 596 return versions; |
597 } | 597 } |
598 | 598 |
599 } // namespace test | 599 } // namespace test |
600 } // namespace net | 600 } // namespace net |
OLD | NEW |