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 using testing::_; |
| 18 using testing::AnyNumber; |
| 19 using testing::Invoke; |
17 | 20 |
18 namespace net { | 21 namespace net { |
19 namespace tools { | 22 namespace tools { |
20 namespace test { | 23 namespace test { |
21 | 24 |
22 QuicAckFrame MakeAckFrameWithNackRanges( | 25 QuicAckFrame MakeAckFrameWithNackRanges( |
23 size_t num_nack_ranges, QuicPacketSequenceNumber least_unacked) { | 26 size_t num_nack_ranges, QuicPacketSequenceNumber least_unacked) { |
24 QuicAckFrame ack = MakeAckFrame(2 * num_nack_ranges + least_unacked); | 27 QuicAckFrame ack = MakeAckFrame(2 * num_nack_ranges + least_unacked); |
25 // Add enough missing packets to get num_nack_ranges nack ranges. | 28 // Add enough missing packets to get num_nack_ranges nack ranges. |
26 for (QuicPacketSequenceNumber i = 1; i < 2 * num_nack_ranges; i += 2) { | 29 for (QuicPacketSequenceNumber i = 1; i < 2 * num_nack_ranges; i += 2) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 buf_len, | 113 buf_len, |
111 self_address, | 114 self_address, |
112 peer_address); | 115 peer_address); |
113 } | 116 } |
114 | 117 |
115 MockTimeWaitListManager::MockTimeWaitListManager( | 118 MockTimeWaitListManager::MockTimeWaitListManager( |
116 QuicPacketWriter* writer, | 119 QuicPacketWriter* writer, |
117 QuicServerSessionVisitor* visitor, | 120 QuicServerSessionVisitor* visitor, |
118 EpollServer* eps) | 121 EpollServer* eps) |
119 : QuicTimeWaitListManager(writer, visitor, eps, QuicSupportedVersions()) { | 122 : QuicTimeWaitListManager(writer, visitor, eps, QuicSupportedVersions()) { |
| 123 // Though AddConnectionIdToTimeWait is mocked, we want to retain its |
| 124 // functionality. |
| 125 EXPECT_CALL(*this, AddConnectionIdToTimeWait(_, _, _)).Times(AnyNumber()); |
| 126 ON_CALL(*this, AddConnectionIdToTimeWait(_, _, _)) |
| 127 .WillByDefault( |
| 128 Invoke(this, &MockTimeWaitListManager:: |
| 129 QuicTimeWaitListManager_AddConnectionIdToTimeWait)); |
120 } | 130 } |
121 | 131 |
122 MockTimeWaitListManager::~MockTimeWaitListManager() { | 132 MockTimeWaitListManager::~MockTimeWaitListManager() { |
123 } | 133 } |
124 | 134 |
125 } // namespace test | 135 } // namespace test |
126 } // namespace tools | 136 } // namespace tools |
127 } // namespace net | 137 } // namespace net |
OLD | NEW |