| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/tools/quic/quic_time_wait_list_manager.h" | 5 #include "net/tools/quic/quic_time_wait_list_manager.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 | 8 |
| 9 #include "net/quic/crypto/crypto_protocol.h" | 9 #include "net/quic/crypto/crypto_protocol.h" |
| 10 #include "net/quic/crypto/null_encrypter.h" | 10 #include "net/quic/crypto/null_encrypter.h" |
| 11 #include "net/quic/crypto/quic_decrypter.h" | 11 #include "net/quic/crypto/quic_decrypter.h" |
| 12 #include "net/quic/crypto/quic_encrypter.h" | 12 #include "net/quic/crypto/quic_encrypter.h" |
| 13 #include "net/quic/quic_data_reader.h" | 13 #include "net/quic/quic_data_reader.h" |
| 14 #include "net/quic/quic_framer.h" | 14 #include "net/quic/quic_framer.h" |
| 15 #include "net/quic/quic_packet_writer.h" | 15 #include "net/quic/quic_packet_writer.h" |
| 16 #include "net/quic/quic_protocol.h" | 16 #include "net/quic/quic_protocol.h" |
| 17 #include "net/quic/quic_utils.h" | 17 #include "net/quic/quic_utils.h" |
| 18 #include "net/quic/test_tools/quic_test_utils.h" | 18 #include "net/quic/test_tools/quic_test_utils.h" |
| 19 #include "net/tools/quic/test_tools/mock_epoll_server.h" | 19 #include "net/tools/quic/test_tools/mock_epoll_server.h" |
| 20 #include "net/tools/quic/test_tools/quic_test_utils.h" | 20 #include "net/tools/quic/test_tools/quic_test_utils.h" |
| 21 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 23 | 23 |
| 24 using net::test::BuildUnsizedDataPacket; |
| 24 using net::test::NoOpFramerVisitor; | 25 using net::test::NoOpFramerVisitor; |
| 25 using net::test::QuicVersionMax; | 26 using net::test::QuicVersionMax; |
| 26 using net::test::QuicVersionMin; | 27 using net::test::QuicVersionMin; |
| 27 using testing::_; | |
| 28 using testing::Args; | 28 using testing::Args; |
| 29 using testing::Assign; | 29 using testing::Assign; |
| 30 using testing::DoAll; | 30 using testing::DoAll; |
| 31 using testing::Matcher; | 31 using testing::Matcher; |
| 32 using testing::MatcherInterface; | 32 using testing::MatcherInterface; |
| 33 using testing::NiceMock; | 33 using testing::NiceMock; |
| 34 using testing::Return; | 34 using testing::Return; |
| 35 using testing::ReturnPointee; | 35 using testing::ReturnPointee; |
| 36 using testing::SetArgPointee; | 36 using testing::SetArgPointee; |
| 37 using testing::StrictMock; | 37 using testing::StrictMock; |
| 38 using testing::Truly; | 38 using testing::Truly; |
| 39 using testing::_; |
| 39 | 40 |
| 40 namespace net { | 41 namespace net { |
| 41 namespace tools { | 42 namespace tools { |
| 42 namespace test { | 43 namespace test { |
| 43 | 44 |
| 44 class FramerVisitorCapturingPublicReset : public NoOpFramerVisitor { | 45 class FramerVisitorCapturingPublicReset : public NoOpFramerVisitor { |
| 45 public: | 46 public: |
| 46 FramerVisitorCapturingPublicReset() {} | 47 FramerVisitorCapturingPublicReset() {} |
| 47 virtual ~FramerVisitorCapturingPublicReset() {} | 48 virtual ~FramerVisitorCapturingPublicReset() {} |
| 48 | 49 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 header.entropy_flag = false; | 144 header.entropy_flag = false; |
| 144 header.entropy_hash = 0; | 145 header.entropy_hash = 0; |
| 145 header.fec_flag = false; | 146 header.fec_flag = false; |
| 146 header.is_in_fec_group = NOT_IN_FEC_GROUP; | 147 header.is_in_fec_group = NOT_IN_FEC_GROUP; |
| 147 header.fec_group = 0; | 148 header.fec_group = 0; |
| 148 QuicStreamFrame stream_frame(1, false, 0, MakeIOVector("data")); | 149 QuicStreamFrame stream_frame(1, false, 0, MakeIOVector("data")); |
| 149 QuicFrame frame(&stream_frame); | 150 QuicFrame frame(&stream_frame); |
| 150 QuicFrames frames; | 151 QuicFrames frames; |
| 151 frames.push_back(frame); | 152 frames.push_back(frame); |
| 152 scoped_ptr<QuicPacket> packet( | 153 scoped_ptr<QuicPacket> packet( |
| 153 framer_.BuildUnsizedDataPacket(header, frames).packet); | 154 BuildUnsizedDataPacket(&framer_, header, frames).packet); |
| 154 EXPECT_TRUE(packet != NULL); | 155 EXPECT_TRUE(packet != NULL); |
| 155 QuicEncryptedPacket* encrypted = framer_.EncryptPacket(ENCRYPTION_NONE, | 156 QuicEncryptedPacket* encrypted = framer_.EncryptPacket(ENCRYPTION_NONE, |
| 156 sequence_number, | 157 sequence_number, |
| 157 *packet); | 158 *packet); |
| 158 EXPECT_TRUE(encrypted != NULL); | 159 EXPECT_TRUE(encrypted != NULL); |
| 159 return encrypted; | 160 return encrypted; |
| 160 } | 161 } |
| 161 | 162 |
| 162 NiceMock<MockFakeTimeEpollServer> epoll_server_; | 163 NiceMock<MockFakeTimeEpollServer> epoll_server_; |
| 163 StrictMock<MockPacketWriter> writer_; | 164 StrictMock<MockPacketWriter> writer_; |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 EXPECT_CALL(epoll_server_, RegisterAlarm(_, _)); | 452 EXPECT_CALL(epoll_server_, RegisterAlarm(_, _)); |
| 452 | 453 |
| 453 time_wait_list_manager_.CleanUpOldConnectionIds(); | 454 time_wait_list_manager_.CleanUpOldConnectionIds(); |
| 454 EXPECT_FALSE(IsConnectionIdInTimeWait(kConnectionId1)); | 455 EXPECT_FALSE(IsConnectionIdInTimeWait(kConnectionId1)); |
| 455 EXPECT_TRUE(IsConnectionIdInTimeWait(kConnectionId2)); | 456 EXPECT_TRUE(IsConnectionIdInTimeWait(kConnectionId2)); |
| 456 } | 457 } |
| 457 } // namespace | 458 } // namespace |
| 458 } // namespace test | 459 } // namespace test |
| 459 } // namespace tools | 460 } // namespace tools |
| 460 } // namespace net | 461 } // namespace net |
| OLD | NEW |