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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 *packet.serialized_packet.packet); | 309 *packet.serialized_packet.packet); |
310 encrypted_packets_.push_back(encrypted); | 310 encrypted_packets_.push_back(encrypted); |
311 // Transfer ownership of the packet to the SentPacketManager and the | 311 // Transfer ownership of the packet to the SentPacketManager and the |
312 // ack notifier to the AckNotifierManager. | 312 // ack notifier to the AckNotifierManager. |
313 sent_packet_manager_.OnPacketSent( | 313 sent_packet_manager_.OnPacketSent( |
314 &packet.serialized_packet, 0, QuicTime::Zero(), 1000, | 314 &packet.serialized_packet, 0, QuicTime::Zero(), 1000, |
315 NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA); | 315 NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA); |
316 } | 316 } |
317 | 317 |
318 MockSession::MockSession(QuicConnection* connection) | 318 MockSession::MockSession(QuicConnection* connection) |
319 : QuicSession(connection, DefaultQuicConfig()) { | 319 : QuicSession(connection, DefaultQuicConfig(), /*is_secure=*/false) { |
320 InitializeSession(); | 320 InitializeSession(); |
321 ON_CALL(*this, WritevData(_, _, _, _, _, _)) | 321 ON_CALL(*this, WritevData(_, _, _, _, _, _)) |
322 .WillByDefault(testing::Return(QuicConsumedData(0, false))); | 322 .WillByDefault(testing::Return(QuicConsumedData(0, false))); |
323 } | 323 } |
324 | 324 |
325 MockSession::~MockSession() { | 325 MockSession::~MockSession() { |
326 } | 326 } |
327 | 327 |
328 TestSession::TestSession(QuicConnection* connection, const QuicConfig& config) | 328 TestSession::TestSession(QuicConnection* connection, const QuicConfig& config) |
329 : QuicSession(connection, config), crypto_stream_(nullptr) { | 329 : QuicSession(connection, config, /*is_secure=*/false), |
| 330 crypto_stream_(nullptr) { |
330 InitializeSession(); | 331 InitializeSession(); |
331 } | 332 } |
332 | 333 |
333 TestSession::~TestSession() {} | 334 TestSession::~TestSession() {} |
334 | 335 |
335 void TestSession::SetCryptoStream(QuicCryptoStream* stream) { | 336 void TestSession::SetCryptoStream(QuicCryptoStream* stream) { |
336 crypto_stream_ = stream; | 337 crypto_stream_ = stream; |
337 } | 338 } |
338 | 339 |
339 QuicCryptoStream* TestSession::GetCryptoStream() { | 340 QuicCryptoStream* TestSession::GetCryptoStream() { |
340 return crypto_stream_; | 341 return crypto_stream_; |
341 } | 342 } |
342 | 343 |
343 TestClientSession::TestClientSession(QuicConnection* connection, | 344 TestClientSession::TestClientSession(QuicConnection* connection, |
344 const QuicConfig& config) | 345 const QuicConfig& config) |
345 : QuicClientSessionBase(connection, config), | 346 : QuicClientSessionBase(connection, config, /*is_secure=*/false), |
346 crypto_stream_(nullptr) { | 347 crypto_stream_(nullptr) { |
347 EXPECT_CALL(*this, OnProofValid(_)).Times(AnyNumber()); | 348 EXPECT_CALL(*this, OnProofValid(_)).Times(AnyNumber()); |
348 InitializeSession(); | 349 InitializeSession(); |
349 } | 350 } |
350 | 351 |
351 TestClientSession::~TestClientSession() {} | 352 TestClientSession::~TestClientSession() {} |
352 | 353 |
353 void TestClientSession::SetCryptoStream(QuicCryptoStream* stream) { | 354 void TestClientSession::SetCryptoStream(QuicCryptoStream* stream) { |
354 crypto_stream_ = stream; | 355 crypto_stream_ = stream; |
355 } | 356 } |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 // called. | 669 // called. |
669 factory_->current_writer_ = this; | 670 factory_->current_writer_ = this; |
670 return QuicPerConnectionPacketWriter::WritePacket(buffer, | 671 return QuicPerConnectionPacketWriter::WritePacket(buffer, |
671 buf_len, | 672 buf_len, |
672 self_address, | 673 self_address, |
673 peer_address); | 674 peer_address); |
674 } | 675 } |
675 | 676 |
676 } // namespace test | 677 } // namespace test |
677 } // namespace net | 678 } // namespace net |
OLD | NEW |