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" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 147 |
148 virtual void DescribeTo(::std::ostream* os) const { } | 148 virtual void DescribeTo(::std::ostream* os) const { } |
149 | 149 |
150 virtual void DescribeNegationTo(::std::ostream* os) const { } | 150 virtual void DescribeNegationTo(::std::ostream* os) const { } |
151 | 151 |
152 private: | 152 private: |
153 QuicGuid guid_; | 153 QuicGuid guid_; |
154 QuicPacketSequenceNumber sequence_number_; | 154 QuicPacketSequenceNumber sequence_number_; |
155 }; | 155 }; |
156 | 156 |
157 void ValidPublicResetPacketPredicate( | |
158 QuicGuid expected_guid, | |
159 QuicPacketSequenceNumber expected_sequence_number, | |
160 const std::tr1::tuple<const char*, int>& packet_buffer) { | |
161 FramerVisitorCapturingPublicReset visitor; | |
162 QuicFramer framer(QuicSupportedVersions(), QuicTime::Zero(), false); | |
163 framer.set_visitor(&visitor); | |
164 QuicEncryptedPacket encrypted(std::tr1::get<0>(packet_buffer), | |
165 std::tr1::get<1>(packet_buffer)); | |
166 framer.ProcessPacket(encrypted); | |
167 QuicPublicResetPacket packet = visitor.public_reset_packet(); | |
168 EXPECT_EQ(expected_guid, packet.public_header.guid); | |
169 EXPECT_TRUE(packet.public_header.reset_flag); | |
170 EXPECT_FALSE(packet.public_header.version_flag); | |
171 EXPECT_EQ(expected_sequence_number, packet.rejected_sequence_number); | |
172 } | |
173 | |
174 | 157 |
175 Matcher<const std::tr1::tuple<const char*, int> > PublicResetPacketEq( | 158 Matcher<const std::tr1::tuple<const char*, int> > PublicResetPacketEq( |
176 QuicGuid guid, | 159 QuicGuid guid, |
177 QuicPacketSequenceNumber sequence_number) { | 160 QuicPacketSequenceNumber sequence_number) { |
178 return MakeMatcher(new ValidatePublicResetPacketPredicate(guid, | 161 return MakeMatcher(new ValidatePublicResetPacketPredicate(guid, |
179 sequence_number)); | 162 sequence_number)); |
180 } | 163 } |
181 | 164 |
182 TEST_F(QuicTimeWaitListManagerTest, CheckGuidInTimeWait) { | 165 TEST_F(QuicTimeWaitListManagerTest, CheckGuidInTimeWait) { |
183 EXPECT_FALSE(IsGuidInTimeWait(guid_)); | 166 EXPECT_FALSE(IsGuidInTimeWait(guid_)); |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 EXPECT_EQ(test::QuicVersionMax(), | 367 EXPECT_EQ(test::QuicVersionMax(), |
385 time_wait_list_manager_.GetQuicVersionFromGuid(kGuid2)); | 368 time_wait_list_manager_.GetQuicVersionFromGuid(kGuid2)); |
386 EXPECT_EQ(test::QuicVersionMax(), | 369 EXPECT_EQ(test::QuicVersionMax(), |
387 time_wait_list_manager_.GetQuicVersionFromGuid(kGuid3)); | 370 time_wait_list_manager_.GetQuicVersionFromGuid(kGuid3)); |
388 } | 371 } |
389 | 372 |
390 } // namespace | 373 } // namespace |
391 } // namespace test | 374 } // namespace test |
392 } // namespace tools | 375 } // namespace tools |
393 } // namespace net | 376 } // namespace net |
OLD | NEW |