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/tools/quic/test_tools/quic_test_utils.h" | 5 #include "net/tools/quic/test_tools/quic_test_utils.h" |
6 | 6 |
7 #include "net/quic/quic_connection.h" | 7 #include "net/quic/quic_connection.h" |
8 #include "net/quic/test_tools/quic_connection_peer.h" | 8 #include "net/quic/test_tools/quic_connection_peer.h" |
9 #include "net/quic/test_tools/quic_test_utils.h" | 9 #include "net/quic/test_tools/quic_test_utils.h" |
10 #include "net/tools/epoll_server/epoll_server.h" | 10 #include "net/tools/epoll_server/epoll_server.h" |
11 #include "net/tools/quic/quic_epoll_connection_helper.h" | 11 #include "net/tools/quic/quic_epoll_connection_helper.h" |
12 | 12 |
13 using base::StringPiece; | 13 using base::StringPiece; |
14 using net::test::MakeAckFrame; | 14 using net::test::MakeAckFrame; |
15 using net::test::MockHelper; | 15 using net::test::MockHelper; |
16 using net::test::QuicConnectionPeer; | 16 using net::test::QuicConnectionPeer; |
17 | 17 |
18 namespace net { | 18 namespace net { |
19 namespace tools { | 19 namespace tools { |
20 namespace test { | 20 namespace test { |
21 | 21 |
| 22 using testing::_; |
| 23 using testing::AnyNumber; |
| 24 using testing::Invoke; |
| 25 |
22 QuicAckFrame MakeAckFrameWithNackRanges( | 26 QuicAckFrame MakeAckFrameWithNackRanges( |
23 size_t num_nack_ranges, QuicPacketSequenceNumber least_unacked) { | 27 size_t num_nack_ranges, QuicPacketSequenceNumber least_unacked) { |
24 QuicAckFrame ack = MakeAckFrame(2 * num_nack_ranges + least_unacked); | 28 QuicAckFrame ack = MakeAckFrame(2 * num_nack_ranges + least_unacked); |
25 // Add enough missing packets to get num_nack_ranges nack ranges. | 29 // Add enough missing packets to get num_nack_ranges nack ranges. |
26 for (QuicPacketSequenceNumber i = 1; i < 2 * num_nack_ranges; i += 2) { | 30 for (QuicPacketSequenceNumber i = 1; i < 2 * num_nack_ranges; i += 2) { |
27 ack.missing_packets.insert(least_unacked + i); | 31 ack.missing_packets.insert(least_unacked + i); |
28 } | 32 } |
29 return ack; | 33 return ack; |
30 } | 34 } |
31 | 35 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 buf_len, | 114 buf_len, |
111 self_address, | 115 self_address, |
112 peer_address); | 116 peer_address); |
113 } | 117 } |
114 | 118 |
115 MockTimeWaitListManager::MockTimeWaitListManager( | 119 MockTimeWaitListManager::MockTimeWaitListManager( |
116 QuicPacketWriter* writer, | 120 QuicPacketWriter* writer, |
117 QuicServerSessionVisitor* visitor, | 121 QuicServerSessionVisitor* visitor, |
118 EpollServer* eps) | 122 EpollServer* eps) |
119 : QuicTimeWaitListManager(writer, visitor, eps, QuicSupportedVersions()) { | 123 : QuicTimeWaitListManager(writer, visitor, eps, QuicSupportedVersions()) { |
| 124 // Though AddConnectionIdToTimeWait is mocked, we want to retain its |
| 125 // functionality. |
| 126 EXPECT_CALL(*this, AddConnectionIdToTimeWait(_, _, _)) |
| 127 .Times(AnyNumber()); |
| 128 ON_CALL(*this, AddConnectionIdToTimeWait(_, _, _)) |
| 129 .WillByDefault(Invoke(this, |
| 130 &MockTimeWaitListManager:: |
| 131 QuicTimeWaitListManager_AddConnectionIdToTimeWait)); |
120 } | 132 } |
121 | 133 |
122 MockTimeWaitListManager::~MockTimeWaitListManager() { | 134 MockTimeWaitListManager::~MockTimeWaitListManager() { |
123 } | 135 } |
124 | 136 |
125 } // namespace test | 137 } // namespace test |
126 } // namespace tools | 138 } // namespace tools |
127 } // namespace net | 139 } // namespace net |
OLD | NEW |