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/quic/quic_epoll_connection_helper.h" | 10 #include "net/tools/quic/quic_epoll_connection_helper.h" |
11 | 11 |
12 using base::StringPiece; | 12 using base::StringPiece; |
13 using net::test::MakeAckFrame; | 13 using net::test::MakeAckFrame; |
14 using net::test::MockHelper; | 14 using net::test::MockHelper; |
15 using net::test::QuicConnectionPeer; | 15 using net::test::QuicConnectionPeer; |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 namespace tools { | 18 namespace tools { |
19 namespace test { | 19 namespace test { |
20 | 20 |
21 MockConnection::MockConnection(bool is_server) | 21 MockConnection::MockConnection(bool is_server) |
22 : QuicConnection(kTestConnectionId, | 22 : QuicConnection(kTestConnectionId, |
23 IPEndPoint(net::test::Loopback4(), kTestPort), | 23 IPEndPoint(net::test::Loopback4(), kTestPort), |
24 new testing::NiceMock<MockHelper>(), | 24 new testing::NiceMock<MockHelper>(), |
25 new testing::NiceMock<MockPacketWriter>(), | 25 new testing::NiceMock<MockPacketWriter>(), |
| 26 true /* owns_writer */, |
26 is_server, QuicSupportedVersions()), | 27 is_server, QuicSupportedVersions()), |
27 writer_(QuicConnectionPeer::GetWriter(this)), | |
28 helper_(helper()) { | 28 helper_(helper()) { |
29 } | 29 } |
30 | 30 |
31 MockConnection::MockConnection(IPEndPoint address, | 31 MockConnection::MockConnection(IPEndPoint address, |
32 bool is_server) | 32 bool is_server) |
33 : QuicConnection(kTestConnectionId, address, | 33 : QuicConnection(kTestConnectionId, address, |
34 new testing::NiceMock<MockHelper>(), | 34 new testing::NiceMock<MockHelper>(), |
35 new testing::NiceMock<MockPacketWriter>(), | 35 new testing::NiceMock<MockPacketWriter>(), |
| 36 true /* owns_writer */, |
36 is_server, QuicSupportedVersions()), | 37 is_server, QuicSupportedVersions()), |
37 writer_(QuicConnectionPeer::GetWriter(this)), | |
38 helper_(helper()) { | 38 helper_(helper()) { |
39 } | 39 } |
40 | 40 |
41 MockConnection::MockConnection(QuicConnectionId connection_id, | 41 MockConnection::MockConnection(QuicConnectionId connection_id, |
42 bool is_server) | 42 bool is_server) |
43 : QuicConnection(connection_id, | 43 : QuicConnection(connection_id, |
44 IPEndPoint(net::test::Loopback4(), kTestPort), | 44 IPEndPoint(net::test::Loopback4(), kTestPort), |
45 new testing::NiceMock<MockHelper>(), | 45 new testing::NiceMock<MockHelper>(), |
46 new testing::NiceMock<MockPacketWriter>(), | 46 new testing::NiceMock<MockPacketWriter>(), |
| 47 true /* owns_writer */, |
47 is_server, QuicSupportedVersions()), | 48 is_server, QuicSupportedVersions()), |
48 writer_(QuicConnectionPeer::GetWriter(this)), | |
49 helper_(helper()) { | 49 helper_(helper()) { |
50 } | 50 } |
51 | 51 |
52 MockConnection::MockConnection(bool is_server, | 52 MockConnection::MockConnection(bool is_server, |
53 const QuicVersionVector& supported_versions) | 53 const QuicVersionVector& supported_versions) |
54 : QuicConnection(kTestConnectionId, | 54 : QuicConnection(kTestConnectionId, |
55 IPEndPoint(net::test::Loopback4(), kTestPort), | 55 IPEndPoint(net::test::Loopback4(), kTestPort), |
56 new testing::NiceMock<MockHelper>(), | 56 new testing::NiceMock<MockHelper>(), |
57 new testing::NiceMock<MockPacketWriter>(), | 57 new testing::NiceMock<MockPacketWriter>(), |
| 58 true /* owns_writer */, |
58 is_server, QuicSupportedVersions()), | 59 is_server, QuicSupportedVersions()), |
59 writer_(QuicConnectionPeer::GetWriter(this)), | |
60 helper_(helper()) { | 60 helper_(helper()) { |
61 } | 61 } |
62 | 62 |
63 MockConnection::~MockConnection() { | 63 MockConnection::~MockConnection() { |
64 } | 64 } |
65 | 65 |
66 void MockConnection::AdvanceTime(QuicTime::Delta delta) { | 66 void MockConnection::AdvanceTime(QuicTime::Delta delta) { |
67 static_cast<MockHelper*>(helper())->AdvanceTime(delta); | 67 static_cast<MockHelper*>(helper())->AdvanceTime(delta); |
68 } | 68 } |
69 | 69 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 MockAckNotifierDelegate::MockAckNotifierDelegate() { | 110 MockAckNotifierDelegate::MockAckNotifierDelegate() { |
111 } | 111 } |
112 | 112 |
113 MockAckNotifierDelegate::~MockAckNotifierDelegate() { | 113 MockAckNotifierDelegate::~MockAckNotifierDelegate() { |
114 } | 114 } |
115 | 115 |
116 } // namespace test | 116 } // namespace test |
117 } // namespace tools | 117 } // namespace tools |
118 } // namespace net | 118 } // namespace net |
OLD | NEW |