Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Side by Side Diff: net/tools/quic/quic_time_wait_list_manager_test.cc

Issue 1009543004: Create a Perspective enum to use instead of a bool is_server to improve (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added NET_EXPORT_PRIVATE to fix compiler error Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/tools/quic/quic_spdy_server_stream_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 class MockFakeTimeEpollServer : public FakeTimeEpollServer { 84 class MockFakeTimeEpollServer : public FakeTimeEpollServer {
85 public: 85 public:
86 MOCK_METHOD2(RegisterAlarm, void(int64 timeout_in_us, 86 MOCK_METHOD2(RegisterAlarm, void(int64 timeout_in_us,
87 EpollAlarmCallbackInterface* alarm)); 87 EpollAlarmCallbackInterface* alarm));
88 }; 88 };
89 89
90 class QuicTimeWaitListManagerTest : public ::testing::Test { 90 class QuicTimeWaitListManagerTest : public ::testing::Test {
91 protected: 91 protected:
92 QuicTimeWaitListManagerTest() 92 QuicTimeWaitListManagerTest()
93 : time_wait_list_manager_(&writer_, &visitor_, 93 : time_wait_list_manager_(&writer_,
94 &epoll_server_, QuicSupportedVersions()), 94 &visitor_,
95 framer_(QuicSupportedVersions(), QuicTime::Zero(), true), 95 &epoll_server_,
96 QuicSupportedVersions()),
97 framer_(QuicSupportedVersions(),
98 QuicTime::Zero(),
99 Perspective::IS_SERVER),
96 connection_id_(45), 100 connection_id_(45),
97 client_address_(net::test::TestPeerIPAddress(), kTestPort), 101 client_address_(net::test::TestPeerIPAddress(), kTestPort),
98 writer_is_blocked_(false) {} 102 writer_is_blocked_(false) {}
99 103
100 ~QuicTimeWaitListManagerTest() override {} 104 ~QuicTimeWaitListManagerTest() override {}
101 105
102 void SetUp() override { 106 void SetUp() override {
103 EXPECT_CALL(writer_, IsWriteBlocked()) 107 EXPECT_CALL(writer_, IsWriteBlocked())
104 .WillRepeatedly(ReturnPointee(&writer_is_blocked_)); 108 .WillRepeatedly(ReturnPointee(&writer_is_blocked_));
105 EXPECT_CALL(writer_, IsWriteBlockedDataBuffered()) 109 EXPECT_CALL(writer_, IsWriteBlockedDataBuffered())
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 public: 181 public:
178 explicit ValidatePublicResetPacketPredicate(QuicConnectionId connection_id, 182 explicit ValidatePublicResetPacketPredicate(QuicConnectionId connection_id,
179 QuicPacketSequenceNumber number) 183 QuicPacketSequenceNumber number)
180 : connection_id_(connection_id), sequence_number_(number) { 184 : connection_id_(connection_id), sequence_number_(number) {
181 } 185 }
182 186
183 virtual bool MatchAndExplain( 187 virtual bool MatchAndExplain(
184 const std::tr1::tuple<const char*, int> packet_buffer, 188 const std::tr1::tuple<const char*, int> packet_buffer,
185 testing::MatchResultListener* /* listener */) const override { 189 testing::MatchResultListener* /* listener */) const override {
186 FramerVisitorCapturingPublicReset visitor; 190 FramerVisitorCapturingPublicReset visitor;
187 QuicFramer framer(QuicSupportedVersions(), 191 QuicFramer framer(QuicSupportedVersions(), QuicTime::Zero(),
188 QuicTime::Zero(), 192 Perspective::IS_CLIENT);
189 false);
190 framer.set_visitor(&visitor); 193 framer.set_visitor(&visitor);
191 QuicEncryptedPacket encrypted(std::tr1::get<0>(packet_buffer), 194 QuicEncryptedPacket encrypted(std::tr1::get<0>(packet_buffer),
192 std::tr1::get<1>(packet_buffer)); 195 std::tr1::get<1>(packet_buffer));
193 framer.ProcessPacket(encrypted); 196 framer.ProcessPacket(encrypted);
194 QuicPublicResetPacket packet = visitor.public_reset_packet(); 197 QuicPublicResetPacket packet = visitor.public_reset_packet();
195 return connection_id_ == packet.public_header.connection_id && 198 return connection_id_ == packet.public_header.connection_id &&
196 packet.public_header.reset_flag && !packet.public_header.version_flag && 199 packet.public_header.reset_flag && !packet.public_header.version_flag &&
197 sequence_number_ == packet.rejected_sequence_number && 200 sequence_number_ == packet.rejected_sequence_number &&
198 net::test::TestPeerIPAddress() == packet.client_address.address() && 201 net::test::TestPeerIPAddress() == packet.client_address.address() &&
199 kTestPort == packet.client_address.port(); 202 kTestPort == packet.client_address.port();
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 time_wait_list_manager_.num_connections()); 523 time_wait_list_manager_.num_connections());
521 EXPECT_FALSE(IsConnectionIdInTimeWait(id_to_evict)); 524 EXPECT_FALSE(IsConnectionIdInTimeWait(id_to_evict));
522 EXPECT_TRUE(IsConnectionIdInTimeWait(current_connection_id)); 525 EXPECT_TRUE(IsConnectionIdInTimeWait(current_connection_id));
523 } 526 }
524 } 527 }
525 528
526 } // namespace 529 } // namespace
527 } // namespace test 530 } // namespace test
528 } // namespace tools 531 } // namespace tools
529 } // namespace net 532 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_spdy_server_stream_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698