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