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 <errno.h> |
7 #include <memory> | 8 #include <memory> |
8 #include <ostream> | 9 #include <ostream> |
| 10 #include <utility> |
9 | 11 |
10 #include "base/bind.h" | 12 #include "base/bind.h" |
11 #include "base/macros.h" | 13 #include "base/macros.h" |
12 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
13 #include "net/base/ip_address.h" | 15 #include "net/base/ip_address.h" |
14 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
15 #include "net/quic/congestion_control/loss_detection_interface.h" | 17 #include "net/quic/congestion_control/loss_detection_interface.h" |
16 #include "net/quic/congestion_control/send_algorithm_interface.h" | 18 #include "net/quic/congestion_control/send_algorithm_interface.h" |
17 #include "net/quic/crypto/null_encrypter.h" | 19 #include "net/quic/crypto/null_encrypter.h" |
18 #include "net/quic/crypto/quic_decrypter.h" | 20 #include "net/quic/crypto/quic_decrypter.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 const char* cipher_name() const override { return "StrictTagging"; } | 199 const char* cipher_name() const override { return "StrictTagging"; } |
198 // Use a distinct value starting with 0xFFFFFF, which is never used by TLS. | 200 // Use a distinct value starting with 0xFFFFFF, which is never used by TLS. |
199 uint32_t cipher_id() const override { return 0xFFFFFFF1; } | 201 uint32_t cipher_id() const override { return 0xFFFFFFF1; } |
200 | 202 |
201 private: | 203 private: |
202 const uint8_t tag_; | 204 const uint8_t tag_; |
203 }; | 205 }; |
204 | 206 |
205 class TestConnectionHelper : public QuicConnectionHelperInterface { | 207 class TestConnectionHelper : public QuicConnectionHelperInterface { |
206 public: | 208 public: |
| 209 TestConnectionHelper(MockClock* clock, MockRandom* random_generator) |
| 210 : clock_(clock), random_generator_(random_generator) { |
| 211 clock_->AdvanceTime(QuicTime::Delta::FromSeconds(1)); |
| 212 } |
| 213 |
| 214 // QuicConnectionHelperInterface |
| 215 const QuicClock* GetClock() const override { return clock_; } |
| 216 |
| 217 QuicRandom* GetRandomGenerator() override { return random_generator_; } |
| 218 |
| 219 QuicBufferAllocator* GetBufferAllocator() override { |
| 220 return &buffer_allocator_; |
| 221 } |
| 222 |
| 223 private: |
| 224 MockClock* clock_; |
| 225 MockRandom* random_generator_; |
| 226 SimpleBufferAllocator buffer_allocator_; |
| 227 |
| 228 DISALLOW_COPY_AND_ASSIGN(TestConnectionHelper); |
| 229 }; |
| 230 |
| 231 class TestAlarmFactory : public QuicAlarmFactory { |
| 232 public: |
207 class TestAlarm : public QuicAlarm { | 233 class TestAlarm : public QuicAlarm { |
208 public: | 234 public: |
209 explicit TestAlarm(QuicArenaScopedPtr<QuicAlarm::Delegate> delegate) | 235 explicit TestAlarm(QuicArenaScopedPtr<QuicAlarm::Delegate> delegate) |
210 : QuicAlarm(std::move(delegate)) {} | 236 : QuicAlarm(std::move(delegate)) {} |
211 | 237 |
212 void SetImpl() override {} | 238 void SetImpl() override {} |
213 void CancelImpl() override {} | 239 void CancelImpl() override {} |
214 using QuicAlarm::Fire; | 240 using QuicAlarm::Fire; |
215 }; | 241 }; |
216 | 242 |
217 TestConnectionHelper(MockClock* clock, MockRandom* random_generator) | 243 TestAlarmFactory() {} |
218 : clock_(clock), random_generator_(random_generator) { | |
219 clock_->AdvanceTime(QuicTime::Delta::FromSeconds(1)); | |
220 } | |
221 | |
222 // QuicConnectionHelperInterface | |
223 const QuicClock* GetClock() const override { return clock_; } | |
224 | |
225 QuicRandom* GetRandomGenerator() override { return random_generator_; } | |
226 | 244 |
227 QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) override { | 245 QuicAlarm* CreateAlarm(QuicAlarm::Delegate* delegate) override { |
228 return new TestAlarm(QuicArenaScopedPtr<QuicAlarm::Delegate>(delegate)); | 246 return new TestAlarm(QuicArenaScopedPtr<QuicAlarm::Delegate>(delegate)); |
229 } | 247 } |
230 | 248 |
231 QuicArenaScopedPtr<QuicAlarm> CreateAlarm( | 249 QuicArenaScopedPtr<QuicAlarm> CreateAlarm( |
232 QuicArenaScopedPtr<QuicAlarm::Delegate> delegate, | 250 QuicArenaScopedPtr<QuicAlarm::Delegate> delegate, |
233 QuicConnectionArena* arena) override { | 251 QuicConnectionArena* arena) override { |
234 return arena->New<TestAlarm>(std::move(delegate)); | 252 return arena->New<TestAlarm>(std::move(delegate)); |
235 } | 253 } |
236 | 254 |
237 QuicBufferAllocator* GetBufferAllocator() override { | |
238 return &buffer_allocator_; | |
239 } | |
240 | |
241 private: | 255 private: |
242 MockClock* clock_; | 256 DISALLOW_COPY_AND_ASSIGN(TestAlarmFactory); |
243 MockRandom* random_generator_; | |
244 SimpleBufferAllocator buffer_allocator_; | |
245 | |
246 DISALLOW_COPY_AND_ASSIGN(TestConnectionHelper); | |
247 }; | 257 }; |
248 | 258 |
249 class TestPacketWriter : public QuicPacketWriter { | 259 class TestPacketWriter : public QuicPacketWriter { |
250 public: | 260 public: |
251 TestPacketWriter(QuicVersion version, MockClock* clock) | 261 TestPacketWriter(QuicVersion version, MockClock* clock) |
252 : version_(version), | 262 : version_(version), |
253 framer_(SupportedVersions(version_)), | 263 framer_(SupportedVersions(version_)), |
254 last_packet_size_(0), | 264 last_packet_size_(0), |
255 write_blocked_(false), | 265 write_blocked_(false), |
256 write_should_fail_(false), | 266 write_should_fail_(false), |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 QuicByteCount max_packet_size_; | 428 QuicByteCount max_packet_size_; |
419 | 429 |
420 DISALLOW_COPY_AND_ASSIGN(TestPacketWriter); | 430 DISALLOW_COPY_AND_ASSIGN(TestPacketWriter); |
421 }; | 431 }; |
422 | 432 |
423 class TestConnection : public QuicConnection { | 433 class TestConnection : public QuicConnection { |
424 public: | 434 public: |
425 TestConnection(QuicConnectionId connection_id, | 435 TestConnection(QuicConnectionId connection_id, |
426 IPEndPoint address, | 436 IPEndPoint address, |
427 TestConnectionHelper* helper, | 437 TestConnectionHelper* helper, |
| 438 TestAlarmFactory* alarm_factory, |
428 TestPacketWriter* writer, | 439 TestPacketWriter* writer, |
429 Perspective perspective, | 440 Perspective perspective, |
430 QuicVersion version) | 441 QuicVersion version) |
431 : QuicConnection(connection_id, | 442 : QuicConnection(connection_id, |
432 address, | 443 address, |
433 helper, | 444 helper, |
| 445 alarm_factory, |
434 writer, | 446 writer, |
435 /* owns_writer= */ false, | 447 /* owns_writer= */ false, |
436 perspective, | 448 perspective, |
437 SupportedVersions(version)) { | 449 SupportedVersions(version)) { |
438 writer->set_perspective(perspective); | 450 writer->set_perspective(perspective); |
439 } | 451 } |
440 | 452 |
441 void SendAck() { QuicConnectionPeer::SendAck(this); } | 453 void SendAck() { QuicConnectionPeer::SendAck(this); } |
442 | 454 |
443 void SetSendAlgorithm(SendAlgorithmInterface* send_algorithm) { | 455 void SetSendAlgorithm(SendAlgorithmInterface* send_algorithm) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 EXPECT_CALL(*send_algorithm, SetFromConfig(_, _)); | 547 EXPECT_CALL(*send_algorithm, SetFromConfig(_, _)); |
536 SetFromConfig(config); | 548 SetFromConfig(config); |
537 | 549 |
538 // Normally, the pacing would be disabled in the test, but calling | 550 // Normally, the pacing would be disabled in the test, but calling |
539 // SetFromConfig enables it. Set nearly-infinite bandwidth to make the | 551 // SetFromConfig enables it. Set nearly-infinite bandwidth to make the |
540 // pacing algorithm work. | 552 // pacing algorithm work. |
541 EXPECT_CALL(*send_algorithm, PacingRate()) | 553 EXPECT_CALL(*send_algorithm, PacingRate()) |
542 .WillRepeatedly(Return(QuicBandwidth::FromKBytesPerSecond(10000))); | 554 .WillRepeatedly(Return(QuicBandwidth::FromKBytesPerSecond(10000))); |
543 } | 555 } |
544 | 556 |
545 TestConnectionHelper::TestAlarm* GetAckAlarm() { | 557 TestAlarmFactory::TestAlarm* GetAckAlarm() { |
546 return reinterpret_cast<TestConnectionHelper::TestAlarm*>( | 558 return reinterpret_cast<TestAlarmFactory::TestAlarm*>( |
547 QuicConnectionPeer::GetAckAlarm(this)); | 559 QuicConnectionPeer::GetAckAlarm(this)); |
548 } | 560 } |
549 | 561 |
550 TestConnectionHelper::TestAlarm* GetPingAlarm() { | 562 TestAlarmFactory::TestAlarm* GetPingAlarm() { |
551 return reinterpret_cast<TestConnectionHelper::TestAlarm*>( | 563 return reinterpret_cast<TestAlarmFactory::TestAlarm*>( |
552 QuicConnectionPeer::GetPingAlarm(this)); | 564 QuicConnectionPeer::GetPingAlarm(this)); |
553 } | 565 } |
554 | 566 |
555 TestConnectionHelper::TestAlarm* GetResumeWritesAlarm() { | 567 TestAlarmFactory::TestAlarm* GetResumeWritesAlarm() { |
556 return reinterpret_cast<TestConnectionHelper::TestAlarm*>( | 568 return reinterpret_cast<TestAlarmFactory::TestAlarm*>( |
557 QuicConnectionPeer::GetResumeWritesAlarm(this)); | 569 QuicConnectionPeer::GetResumeWritesAlarm(this)); |
558 } | 570 } |
559 | 571 |
560 TestConnectionHelper::TestAlarm* GetRetransmissionAlarm() { | 572 TestAlarmFactory::TestAlarm* GetRetransmissionAlarm() { |
561 return reinterpret_cast<TestConnectionHelper::TestAlarm*>( | 573 return reinterpret_cast<TestAlarmFactory::TestAlarm*>( |
562 QuicConnectionPeer::GetRetransmissionAlarm(this)); | 574 QuicConnectionPeer::GetRetransmissionAlarm(this)); |
563 } | 575 } |
564 | 576 |
565 TestConnectionHelper::TestAlarm* GetSendAlarm() { | 577 TestAlarmFactory::TestAlarm* GetSendAlarm() { |
566 return reinterpret_cast<TestConnectionHelper::TestAlarm*>( | 578 return reinterpret_cast<TestAlarmFactory::TestAlarm*>( |
567 QuicConnectionPeer::GetSendAlarm(this)); | 579 QuicConnectionPeer::GetSendAlarm(this)); |
568 } | 580 } |
569 | 581 |
570 TestConnectionHelper::TestAlarm* GetTimeoutAlarm() { | 582 TestAlarmFactory::TestAlarm* GetTimeoutAlarm() { |
571 return reinterpret_cast<TestConnectionHelper::TestAlarm*>( | 583 return reinterpret_cast<TestAlarmFactory::TestAlarm*>( |
572 QuicConnectionPeer::GetTimeoutAlarm(this)); | 584 QuicConnectionPeer::GetTimeoutAlarm(this)); |
573 } | 585 } |
574 | 586 |
575 TestConnectionHelper::TestAlarm* GetMtuDiscoveryAlarm() { | 587 TestAlarmFactory::TestAlarm* GetMtuDiscoveryAlarm() { |
576 return reinterpret_cast<TestConnectionHelper::TestAlarm*>( | 588 return reinterpret_cast<TestAlarmFactory::TestAlarm*>( |
577 QuicConnectionPeer::GetMtuDiscoveryAlarm(this)); | 589 QuicConnectionPeer::GetMtuDiscoveryAlarm(this)); |
578 } | 590 } |
579 | 591 |
580 void DisableTailLossProbe() { | 592 void DisableTailLossProbe() { |
581 QuicSentPacketManagerPeer::SetMaxTailLossProbes( | 593 QuicSentPacketManagerPeer::SetMaxTailLossProbes( |
582 QuicConnectionPeer::GetSentPacketManager(this), 0); | 594 QuicConnectionPeer::GetSentPacketManager(this), 0); |
583 } | 595 } |
584 | 596 |
585 using QuicConnection::SelectMutualVersion; | 597 using QuicConnection::SelectMutualVersion; |
586 using QuicConnection::set_defer_send_in_response_to_packets; | 598 using QuicConnection::set_defer_send_in_response_to_packets; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 class QuicConnectionTest : public ::testing::TestWithParam<TestParams> { | 640 class QuicConnectionTest : public ::testing::TestWithParam<TestParams> { |
629 protected: | 641 protected: |
630 QuicConnectionTest() | 642 QuicConnectionTest() |
631 : connection_id_(42), | 643 : connection_id_(42), |
632 framer_(SupportedVersions(version()), | 644 framer_(SupportedVersions(version()), |
633 QuicTime::Zero(), | 645 QuicTime::Zero(), |
634 Perspective::IS_CLIENT), | 646 Perspective::IS_CLIENT), |
635 send_algorithm_(new StrictMock<MockSendAlgorithm>), | 647 send_algorithm_(new StrictMock<MockSendAlgorithm>), |
636 loss_algorithm_(new MockLossAlgorithm()), | 648 loss_algorithm_(new MockLossAlgorithm()), |
637 helper_(new TestConnectionHelper(&clock_, &random_generator_)), | 649 helper_(new TestConnectionHelper(&clock_, &random_generator_)), |
| 650 alarm_factory_(new TestAlarmFactory()), |
638 peer_creator_(connection_id_, | 651 peer_creator_(connection_id_, |
639 &framer_, | 652 &framer_, |
640 &random_generator_, | 653 &random_generator_, |
641 &buffer_allocator_, | 654 &buffer_allocator_, |
642 /*delegate=*/nullptr), | 655 /*delegate=*/nullptr), |
643 writer_(new TestPacketWriter(version(), &clock_)), | 656 writer_(new TestPacketWriter(version(), &clock_)), |
644 connection_(connection_id_, | 657 connection_(connection_id_, |
645 kPeerAddress, | 658 kPeerAddress, |
646 helper_.get(), | 659 helper_.get(), |
| 660 alarm_factory_.get(), |
647 writer_.get(), | 661 writer_.get(), |
648 Perspective::IS_CLIENT, | 662 Perspective::IS_CLIENT, |
649 version()), | 663 version()), |
650 creator_(QuicConnectionPeer::GetPacketCreator(&connection_)), | 664 creator_(QuicConnectionPeer::GetPacketCreator(&connection_)), |
651 generator_(QuicConnectionPeer::GetPacketGenerator(&connection_)), | 665 generator_(QuicConnectionPeer::GetPacketGenerator(&connection_)), |
652 manager_(QuicConnectionPeer::GetSentPacketManager(&connection_)), | 666 manager_(QuicConnectionPeer::GetSentPacketManager(&connection_)), |
653 frame1_(1, false, 0, StringPiece(data1)), | 667 frame1_(1, false, 0, StringPiece(data1)), |
654 frame2_(1, false, 3, StringPiece(data2)), | 668 frame2_(1, false, 3, StringPiece(data2)), |
655 packet_number_length_(PACKET_6BYTE_PACKET_NUMBER), | 669 packet_number_length_(PACKET_6BYTE_PACKET_NUMBER), |
656 connection_id_length_(PACKET_8BYTE_CONNECTION_ID) { | 670 connection_id_length_(PACKET_8BYTE_CONNECTION_ID) { |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 QuicConnectionId connection_id_; | 1002 QuicConnectionId connection_id_; |
989 QuicFramer framer_; | 1003 QuicFramer framer_; |
990 MockEntropyCalculator entropy_calculator_; | 1004 MockEntropyCalculator entropy_calculator_; |
991 | 1005 |
992 MockSendAlgorithm* send_algorithm_; | 1006 MockSendAlgorithm* send_algorithm_; |
993 MockLossAlgorithm* loss_algorithm_; | 1007 MockLossAlgorithm* loss_algorithm_; |
994 MockClock clock_; | 1008 MockClock clock_; |
995 MockRandom random_generator_; | 1009 MockRandom random_generator_; |
996 SimpleBufferAllocator buffer_allocator_; | 1010 SimpleBufferAllocator buffer_allocator_; |
997 std::unique_ptr<TestConnectionHelper> helper_; | 1011 std::unique_ptr<TestConnectionHelper> helper_; |
| 1012 std::unique_ptr<TestAlarmFactory> alarm_factory_; |
998 QuicPacketCreator peer_creator_; | 1013 QuicPacketCreator peer_creator_; |
999 std::unique_ptr<TestPacketWriter> writer_; | 1014 std::unique_ptr<TestPacketWriter> writer_; |
1000 TestConnection connection_; | 1015 TestConnection connection_; |
1001 QuicPacketCreator* creator_; | 1016 QuicPacketCreator* creator_; |
1002 QuicPacketGenerator* generator_; | 1017 QuicPacketGenerator* generator_; |
1003 QuicSentPacketManager* manager_; | 1018 QuicSentPacketManager* manager_; |
1004 StrictMock<MockConnectionVisitor> visitor_; | 1019 StrictMock<MockConnectionVisitor> visitor_; |
1005 | 1020 |
1006 QuicStreamFrame frame1_; | 1021 QuicStreamFrame frame1_; |
1007 QuicStreamFrame frame2_; | 1022 QuicStreamFrame frame2_; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 } | 1074 } |
1060 | 1075 |
1061 TEST_P(QuicConnectionTest, MaxPacketSize) { | 1076 TEST_P(QuicConnectionTest, MaxPacketSize) { |
1062 EXPECT_EQ(Perspective::IS_CLIENT, connection_.perspective()); | 1077 EXPECT_EQ(Perspective::IS_CLIENT, connection_.perspective()); |
1063 EXPECT_EQ(1350u, connection_.max_packet_length()); | 1078 EXPECT_EQ(1350u, connection_.max_packet_length()); |
1064 } | 1079 } |
1065 | 1080 |
1066 TEST_P(QuicConnectionTest, SmallerServerMaxPacketSize) { | 1081 TEST_P(QuicConnectionTest, SmallerServerMaxPacketSize) { |
1067 QuicConnectionId connection_id = 42; | 1082 QuicConnectionId connection_id = 42; |
1068 TestConnection connection(connection_id, kPeerAddress, helper_.get(), | 1083 TestConnection connection(connection_id, kPeerAddress, helper_.get(), |
1069 writer_.get(), Perspective::IS_SERVER, version()); | 1084 alarm_factory_.get(), writer_.get(), |
| 1085 Perspective::IS_SERVER, version()); |
1070 EXPECT_EQ(Perspective::IS_SERVER, connection.perspective()); | 1086 EXPECT_EQ(Perspective::IS_SERVER, connection.perspective()); |
1071 EXPECT_EQ(1000u, connection.max_packet_length()); | 1087 EXPECT_EQ(1000u, connection.max_packet_length()); |
1072 } | 1088 } |
1073 | 1089 |
1074 TEST_P(QuicConnectionTest, IncreaseServerMaxPacketSize) { | 1090 TEST_P(QuicConnectionTest, IncreaseServerMaxPacketSize) { |
1075 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 1091 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
1076 | 1092 |
1077 connection_.set_perspective(Perspective::IS_SERVER); | 1093 connection_.set_perspective(Perspective::IS_SERVER); |
1078 connection_.SetMaxPacketLength(1000); | 1094 connection_.SetMaxPacketLength(1000); |
1079 | 1095 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 connection_.SetMaxPacketLength(kDefaultMaxPacketSize); | 1163 connection_.SetMaxPacketLength(kDefaultMaxPacketSize); |
1148 | 1164 |
1149 EXPECT_EQ(lower_max_packet_size, connection_.max_packet_length()); | 1165 EXPECT_EQ(lower_max_packet_size, connection_.max_packet_length()); |
1150 } | 1166 } |
1151 | 1167 |
1152 TEST_P(QuicConnectionTest, LimitMaxPacketSizeByWriterForNewConnection) { | 1168 TEST_P(QuicConnectionTest, LimitMaxPacketSizeByWriterForNewConnection) { |
1153 const QuicConnectionId connection_id = 17; | 1169 const QuicConnectionId connection_id = 17; |
1154 const QuicByteCount lower_max_packet_size = 1240; | 1170 const QuicByteCount lower_max_packet_size = 1240; |
1155 writer_->set_max_packet_size(lower_max_packet_size); | 1171 writer_->set_max_packet_size(lower_max_packet_size); |
1156 TestConnection connection(connection_id, kPeerAddress, helper_.get(), | 1172 TestConnection connection(connection_id, kPeerAddress, helper_.get(), |
1157 writer_.get(), Perspective::IS_CLIENT, version()); | 1173 alarm_factory_.get(), writer_.get(), |
| 1174 Perspective::IS_CLIENT, version()); |
1158 EXPECT_EQ(Perspective::IS_CLIENT, connection.perspective()); | 1175 EXPECT_EQ(Perspective::IS_CLIENT, connection.perspective()); |
1159 EXPECT_EQ(lower_max_packet_size, connection.max_packet_length()); | 1176 EXPECT_EQ(lower_max_packet_size, connection.max_packet_length()); |
1160 } | 1177 } |
1161 | 1178 |
1162 TEST_P(QuicConnectionTest, PacketsInOrder) { | 1179 TEST_P(QuicConnectionTest, PacketsInOrder) { |
1163 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 1180 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
1164 | 1181 |
1165 ProcessPacket(kDefaultPathId, 1); | 1182 ProcessPacket(kDefaultPathId, 1); |
1166 EXPECT_EQ(1u, outgoing_ack()->largest_observed); | 1183 EXPECT_EQ(1u, outgoing_ack()->largest_observed); |
1167 EXPECT_TRUE(outgoing_ack()->missing_packets.Empty()); | 1184 EXPECT_TRUE(outgoing_ack()->missing_packets.Empty()); |
(...skipping 3334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4502 new MockQuicConnectionDebugVisitor()); | 4519 new MockQuicConnectionDebugVisitor()); |
4503 connection_.set_debug_visitor(debug_visitor.get()); | 4520 connection_.set_debug_visitor(debug_visitor.get()); |
4504 EXPECT_CALL(*debug_visitor, OnPacketHeader(Ref(header))).Times(1); | 4521 EXPECT_CALL(*debug_visitor, OnPacketHeader(Ref(header))).Times(1); |
4505 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)).Times(1); | 4522 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)).Times(1); |
4506 EXPECT_CALL(*debug_visitor, OnSuccessfulVersionNegotiation(_)).Times(1); | 4523 EXPECT_CALL(*debug_visitor, OnSuccessfulVersionNegotiation(_)).Times(1); |
4507 connection_.OnPacketHeader(header); | 4524 connection_.OnPacketHeader(header); |
4508 } | 4525 } |
4509 | 4526 |
4510 TEST_P(QuicConnectionTest, Pacing) { | 4527 TEST_P(QuicConnectionTest, Pacing) { |
4511 TestConnection server(connection_id_, kSelfAddress, helper_.get(), | 4528 TestConnection server(connection_id_, kSelfAddress, helper_.get(), |
4512 writer_.get(), Perspective::IS_SERVER, version()); | 4529 alarm_factory_.get(), writer_.get(), |
| 4530 Perspective::IS_SERVER, version()); |
4513 TestConnection client(connection_id_, kPeerAddress, helper_.get(), | 4531 TestConnection client(connection_id_, kPeerAddress, helper_.get(), |
4514 writer_.get(), Perspective::IS_CLIENT, version()); | 4532 alarm_factory_.get(), writer_.get(), |
| 4533 Perspective::IS_CLIENT, version()); |
4515 EXPECT_FALSE(client.sent_packet_manager().using_pacing()); | 4534 EXPECT_FALSE(client.sent_packet_manager().using_pacing()); |
4516 EXPECT_FALSE(server.sent_packet_manager().using_pacing()); | 4535 EXPECT_FALSE(server.sent_packet_manager().using_pacing()); |
4517 } | 4536 } |
4518 | 4537 |
4519 TEST_P(QuicConnectionTest, WindowUpdateInstigateAcks) { | 4538 TEST_P(QuicConnectionTest, WindowUpdateInstigateAcks) { |
4520 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); | 4539 EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); |
4521 | 4540 |
4522 // Send a WINDOW_UPDATE frame. | 4541 // Send a WINDOW_UPDATE frame. |
4523 QuicWindowUpdateFrame window_update; | 4542 QuicWindowUpdateFrame window_update; |
4524 window_update.stream_id = 3; | 4543 window_update.stream_id = 3; |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4697 EXPECT_CALL(visitor_, OnConnectionClosed(_, _, _)).Times(1); | 4716 EXPECT_CALL(visitor_, OnConnectionClosed(_, _, _)).Times(1); |
4698 connection_.CloseConnection(QUIC_NO_ERROR, "no reason", | 4717 connection_.CloseConnection(QUIC_NO_ERROR, "no reason", |
4699 ConnectionCloseBehavior::SILENT_CLOSE); | 4718 ConnectionCloseBehavior::SILENT_CLOSE); |
4700 connection_.CloseConnection(QUIC_NO_ERROR, "no reason", | 4719 connection_.CloseConnection(QUIC_NO_ERROR, "no reason", |
4701 ConnectionCloseBehavior::SILENT_CLOSE); | 4720 ConnectionCloseBehavior::SILENT_CLOSE); |
4702 } | 4721 } |
4703 | 4722 |
4704 } // namespace | 4723 } // namespace |
4705 } // namespace test | 4724 } // namespace test |
4706 } // namespace net | 4725 } // namespace net |
OLD | NEW |