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_connection.h" | 5 #include "net/quic/quic_connection.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "net/base/net_errors.h" | 8 #include "net/base/net_errors.h" |
9 #include "net/quic/congestion_control/receive_algorithm_interface.h" | 9 #include "net/quic/congestion_control/receive_algorithm_interface.h" |
10 #include "net/quic/congestion_control/send_algorithm_interface.h" | 10 #include "net/quic/congestion_control/send_algorithm_interface.h" |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 protected: | 256 protected: |
257 QuicConnectionTest() | 257 QuicConnectionTest() |
258 : guid_(42), | 258 : guid_(42), |
259 framer_(kQuicVersion1, | 259 framer_(kQuicVersion1, |
260 QuicDecrypter::Create(kNULL), | 260 QuicDecrypter::Create(kNULL), |
261 QuicEncrypter::Create(kNULL), | 261 QuicEncrypter::Create(kNULL), |
262 false), | 262 false), |
263 creator_(guid_, &framer_, QuicRandom::GetInstance(), false), | 263 creator_(guid_, &framer_, QuicRandom::GetInstance(), false), |
264 send_algorithm_(new StrictMock<MockSendAlgorithm>), | 264 send_algorithm_(new StrictMock<MockSendAlgorithm>), |
265 helper_(new TestConnectionHelper(&clock_, &random_generator_)), | 265 helper_(new TestConnectionHelper(&clock_, &random_generator_)), |
266 connection_(guid_, IPEndPoint(), helper_.get(), false), | 266 connection_(guid_, IPEndPoint(), helper_, false), |
267 frame1_(1, false, 0, data1), | 267 frame1_(1, false, 0, data1), |
268 frame2_(1, false, 3, data2), | 268 frame2_(1, false, 3, data2), |
269 accept_packet_(true) { | 269 accept_packet_(true) { |
270 connection_.set_visitor(&visitor_); | 270 connection_.set_visitor(&visitor_); |
271 connection_.SetSendAlgorithm(send_algorithm_); | 271 connection_.SetSendAlgorithm(send_algorithm_); |
272 // Simplify tests by not sending feedback unless specifically configured. | 272 // Simplify tests by not sending feedback unless specifically configured. |
273 SetFeedback(NULL); | 273 SetFeedback(NULL); |
274 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)).WillRepeatedly(Return( | 274 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)).WillRepeatedly(Return( |
275 QuicTime::Delta::Zero())); | 275 QuicTime::Delta::Zero())); |
276 EXPECT_CALL(*receive_algorithm_, | 276 EXPECT_CALL(*receive_algorithm_, |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 } | 488 } |
489 | 489 |
490 QuicGuid guid_; | 490 QuicGuid guid_; |
491 QuicFramer framer_; | 491 QuicFramer framer_; |
492 QuicPacketCreator creator_; | 492 QuicPacketCreator creator_; |
493 | 493 |
494 MockSendAlgorithm* send_algorithm_; | 494 MockSendAlgorithm* send_algorithm_; |
495 TestReceiveAlgorithm* receive_algorithm_; | 495 TestReceiveAlgorithm* receive_algorithm_; |
496 MockClock clock_; | 496 MockClock clock_; |
497 MockRandom random_generator_; | 497 MockRandom random_generator_; |
498 scoped_ptr<TestConnectionHelper> helper_; | 498 TestConnectionHelper* helper_; |
499 TestConnection connection_; | 499 TestConnection connection_; |
500 testing::StrictMock<MockConnectionVisitor> visitor_; | 500 testing::StrictMock<MockConnectionVisitor> visitor_; |
501 | 501 |
502 QuicPacketHeader header_; | 502 QuicPacketHeader header_; |
503 QuicPacketHeader revived_header_; | 503 QuicPacketHeader revived_header_; |
504 QuicStreamFrame frame1_; | 504 QuicStreamFrame frame1_; |
505 QuicStreamFrame frame2_; | 505 QuicStreamFrame frame2_; |
506 bool accept_packet_; | 506 bool accept_packet_; |
507 | 507 |
508 private: | 508 private: |
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1779 EXPECT_EQ(received_bytes, stats.bytes_received); | 1779 EXPECT_EQ(received_bytes, stats.bytes_received); |
1780 EXPECT_EQ(4u, stats.packets_received); | 1780 EXPECT_EQ(4u, stats.packets_received); |
1781 | 1781 |
1782 EXPECT_EQ(1u, stats.packets_revived); | 1782 EXPECT_EQ(1u, stats.packets_revived); |
1783 EXPECT_EQ(1u, stats.packets_dropped); | 1783 EXPECT_EQ(1u, stats.packets_dropped); |
1784 } | 1784 } |
1785 | 1785 |
1786 } // namespace | 1786 } // namespace |
1787 } // namespace test | 1787 } // namespace test |
1788 } // namespace net | 1788 } // namespace net |
OLD | NEW |