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

Side by Side Diff: net/tools/quic/test_tools/quic_test_utils.cc

Issue 47283002: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compilation error Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « net/tools/quic/test_tools/quic_test_utils.h ('k') | net/tools/quic/test_tools/server_thread.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/sha1.h" 7 #include "base/sha1.h"
8 #include "net/quic/quic_connection.h" 8 #include "net/quic/quic_connection.h"
9 #include "net/quic/test_tools/quic_connection_peer.h" 9 #include "net/quic/test_tools/quic_connection_peer.h"
10 #include "net/quic/test_tools/quic_test_utils.h" 10 #include "net/quic/test_tools/quic_test_utils.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::MockHelper; 14 using net::test::MockHelper;
15 15
16 namespace net { 16 namespace net {
17 namespace tools { 17 namespace tools {
18 namespace test { 18 namespace test {
19 19
20 QuicVersion QuicVersionMax() { return QuicSupportedVersions().front(); }
21
22 QuicVersion QuicVersionMin() { return QuicSupportedVersions().back(); }
23
20 MockConnection::MockConnection(QuicGuid guid, 24 MockConnection::MockConnection(QuicGuid guid,
21 IPEndPoint address, 25 IPEndPoint address,
22 int fd, 26 int fd,
23 EpollServer* eps, 27 EpollServer* eps,
24 bool is_server) 28 bool is_server)
25 : QuicConnection(guid, address, 29 : QuicConnection(guid, address,
26 new QuicEpollConnectionHelper(eps), 30 new QuicEpollConnectionHelper(eps),
27 new QuicDefaultPacketWriter(fd), is_server, 31 new QuicDefaultPacketWriter(fd), is_server,
28 QuicVersionMax()), 32 QuicSupportedVersions()),
29 has_mock_helper_(false), 33 has_mock_helper_(false),
30 writer_(net::test::QuicConnectionPeer::GetWriter(this)), 34 writer_(net::test::QuicConnectionPeer::GetWriter(this)),
31 helper_(helper()) { 35 helper_(helper()) {
32 } 36 }
33 37
34 MockConnection::MockConnection(QuicGuid guid, 38 MockConnection::MockConnection(QuicGuid guid,
35 IPEndPoint address, 39 IPEndPoint address,
36 bool is_server) 40 bool is_server)
37 : QuicConnection(guid, address, new testing::NiceMock<MockHelper>(), 41 : QuicConnection(guid, address, new testing::NiceMock<MockHelper>(),
38 new testing::NiceMock<MockPacketWriter>(), 42 new testing::NiceMock<MockPacketWriter>(),
39 is_server, QuicVersionMax()), 43 is_server, QuicSupportedVersions()),
40 has_mock_helper_(true), 44 has_mock_helper_(true),
41 writer_(net::test::QuicConnectionPeer::GetWriter(this)), 45 writer_(net::test::QuicConnectionPeer::GetWriter(this)),
42 helper_(helper()) { 46 helper_(helper()) {
43 } 47 }
44 48
45 MockConnection::MockConnection(QuicGuid guid, 49 MockConnection::MockConnection(QuicGuid guid,
46 IPEndPoint address, 50 IPEndPoint address,
47 QuicConnectionHelperInterface* helper, 51 QuicConnectionHelperInterface* helper,
48 QuicPacketWriter* writer, 52 QuicPacketWriter* writer,
49 bool is_server) 53 bool is_server)
50 : QuicConnection(guid, address, helper, writer, is_server, 54 : QuicConnection(guid, address, helper, writer, is_server,
51 QuicVersionMax()), 55 QuicSupportedVersions()),
52 has_mock_helper_(false) { 56 has_mock_helper_(false) {
53 } 57 }
54 58
55 MockConnection::~MockConnection() { 59 MockConnection::~MockConnection() {
56 } 60 }
57 61
58 void MockConnection::AdvanceTime(QuicTime::Delta delta) { 62 void MockConnection::AdvanceTime(QuicTime::Delta delta) {
59 CHECK(has_mock_helper_) << "Cannot advance time unless a MockClock is being" 63 CHECK(has_mock_helper_) << "Cannot advance time unless a MockClock is being"
60 " used"; 64 " used";
61 static_cast<MockHelper*>(helper())->AdvanceTime(delta); 65 static_cast<MockHelper*>(helper())->AdvanceTime(delta);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 113
110 MockPacketWriter::MockPacketWriter() { 114 MockPacketWriter::MockPacketWriter() {
111 } 115 }
112 116
113 MockPacketWriter::~MockPacketWriter() { 117 MockPacketWriter::~MockPacketWriter() {
114 } 118 }
115 119
116 } // namespace test 120 } // namespace test
117 } // namespace tools 121 } // namespace tools
118 } // namespace net 122 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/test_tools/quic_test_utils.h ('k') | net/tools/quic/test_tools/server_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698