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/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 QuicConnectionPeer::GetFramer(this)->set_version(version); | 535 QuicConnectionPeer::GetFramer(this)->set_version(version); |
536 } | 536 } |
537 | 537 |
538 void SetSupportedVersions(const QuicVersionVector& versions) { | 538 void SetSupportedVersions(const QuicVersionVector& versions) { |
539 QuicConnectionPeer::GetFramer(this)->SetSupportedVersions(versions); | 539 QuicConnectionPeer::GetFramer(this)->SetSupportedVersions(versions); |
540 writer_->SetSupportedVersions(versions); | 540 writer_->SetSupportedVersions(versions); |
541 } | 541 } |
542 | 542 |
543 void set_is_server(bool is_server) { | 543 void set_is_server(bool is_server) { |
544 writer_->set_is_server(is_server); | 544 writer_->set_is_server(is_server); |
545 QuicPacketCreatorPeer::SetIsServer( | |
546 QuicConnectionPeer::GetPacketCreator(this), is_server); | |
547 QuicConnectionPeer::SetIsServer(this, is_server); | 545 QuicConnectionPeer::SetIsServer(this, is_server); |
548 } | 546 } |
549 | 547 |
550 TestConnectionHelper::TestAlarm* GetAckAlarm() { | 548 TestConnectionHelper::TestAlarm* GetAckAlarm() { |
551 return reinterpret_cast<TestConnectionHelper::TestAlarm*>( | 549 return reinterpret_cast<TestConnectionHelper::TestAlarm*>( |
552 QuicConnectionPeer::GetAckAlarm(this)); | 550 QuicConnectionPeer::GetAckAlarm(this)); |
553 } | 551 } |
554 | 552 |
555 TestConnectionHelper::TestAlarm* GetPingAlarm() { | 553 TestConnectionHelper::TestAlarm* GetPingAlarm() { |
556 return reinterpret_cast<TestConnectionHelper::TestAlarm*>( | 554 return reinterpret_cast<TestConnectionHelper::TestAlarm*>( |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 | 599 |
602 private: | 600 private: |
603 QuicPacketHeader revived_header_; | 601 QuicPacketHeader revived_header_; |
604 }; | 602 }; |
605 | 603 |
606 class QuicConnectionTest : public ::testing::TestWithParam<QuicVersion> { | 604 class QuicConnectionTest : public ::testing::TestWithParam<QuicVersion> { |
607 protected: | 605 protected: |
608 QuicConnectionTest() | 606 QuicConnectionTest() |
609 : connection_id_(42), | 607 : connection_id_(42), |
610 framer_(SupportedVersions(version()), QuicTime::Zero(), false), | 608 framer_(SupportedVersions(version()), QuicTime::Zero(), false), |
611 peer_creator_(connection_id_, &framer_, &random_generator_, false), | 609 peer_creator_(connection_id_, &framer_, &random_generator_), |
612 send_algorithm_(new StrictMock<MockSendAlgorithm>), | 610 send_algorithm_(new StrictMock<MockSendAlgorithm>), |
613 loss_algorithm_(new MockLossAlgorithm()), | 611 loss_algorithm_(new MockLossAlgorithm()), |
614 helper_(new TestConnectionHelper(&clock_, &random_generator_)), | 612 helper_(new TestConnectionHelper(&clock_, &random_generator_)), |
615 writer_(new TestPacketWriter(version())), | 613 writer_(new TestPacketWriter(version())), |
616 connection_(connection_id_, IPEndPoint(), helper_.get(), | 614 connection_(connection_id_, IPEndPoint(), helper_.get(), |
617 writer_.get(), false, version()), | 615 writer_.get(), false, version()), |
618 frame1_(1, false, 0, MakeIOVector(data1)), | 616 frame1_(1, false, 0, MakeIOVector(data1)), |
619 frame2_(1, false, 3, MakeIOVector(data2)), | 617 frame2_(1, false, 3, MakeIOVector(data2)), |
620 sequence_number_length_(PACKET_6BYTE_SEQUENCE_NUMBER), | 618 sequence_number_length_(PACKET_6BYTE_SEQUENCE_NUMBER), |
621 connection_id_length_(PACKET_8BYTE_CONNECTION_ID) { | 619 connection_id_length_(PACKET_8BYTE_CONNECTION_ID) { |
(...skipping 3398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4020 QuicBlockedFrame blocked; | 4018 QuicBlockedFrame blocked; |
4021 blocked.stream_id = 3; | 4019 blocked.stream_id = 3; |
4022 EXPECT_CALL(visitor_, OnBlockedFrames(_)); | 4020 EXPECT_CALL(visitor_, OnBlockedFrames(_)); |
4023 ProcessFramePacket(QuicFrame(&blocked)); | 4021 ProcessFramePacket(QuicFrame(&blocked)); |
4024 EXPECT_TRUE(ack_alarm->IsSet()); | 4022 EXPECT_TRUE(ack_alarm->IsSet()); |
4025 } | 4023 } |
4026 | 4024 |
4027 } // namespace | 4025 } // namespace |
4028 } // namespace test | 4026 } // namespace test |
4029 } // namespace net | 4027 } // namespace net |
OLD | NEW |