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

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

Issue 300683008: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « net/tools/quic/test_tools/quic_test_utils.h ('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 (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::kInitialFlowControlWindowForTest; 14 using net::test::kInitialFlowControlWindowForTest;
15 using net::test::MakeAckFrame;
15 using net::test::MockHelper; 16 using net::test::MockHelper;
16 using net::test::QuicConnectionPeer; 17 using net::test::QuicConnectionPeer;
17 18
18 namespace net { 19 namespace net {
19 namespace tools { 20 namespace tools {
20 namespace test { 21 namespace test {
21 22
22 MockConnection::MockConnection(bool is_server) 23 MockConnection::MockConnection(bool is_server)
23 : QuicConnection(kTestConnectionId, 24 : QuicConnection(kTestConnectionId,
24 IPEndPoint(net::test::Loopback4(), kTestPort), 25 IPEndPoint(net::test::Loopback4(), kTestPort),
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 helper_(helper()) { 62 helper_(helper()) {
62 } 63 }
63 64
64 MockConnection::~MockConnection() { 65 MockConnection::~MockConnection() {
65 } 66 }
66 67
67 void MockConnection::AdvanceTime(QuicTime::Delta delta) { 68 void MockConnection::AdvanceTime(QuicTime::Delta delta) {
68 static_cast<MockHelper*>(helper())->AdvanceTime(delta); 69 static_cast<MockHelper*>(helper())->AdvanceTime(delta);
69 } 70 }
70 71
72 QuicAckFrame MakeAckFrameWithNackRanges(
73 size_t num_nack_ranges, QuicPacketSequenceNumber least_unacked) {
74 QuicAckFrame ack = MakeAckFrame(2 * num_nack_ranges + least_unacked,
75 least_unacked);
76 // Add enough missing packets to get num_nack_ranges nack ranges.
77 for (QuicPacketSequenceNumber i = 1; i < 2 * num_nack_ranges; i += 2) {
78 ack.received_info.missing_packets.insert(least_unacked + i);
79 }
80 return ack;
81 }
82
71 uint64 SimpleRandom::RandUint64() { 83 uint64 SimpleRandom::RandUint64() {
72 unsigned char hash[base::kSHA1Length]; 84 unsigned char hash[base::kSHA1Length];
73 base::SHA1HashBytes(reinterpret_cast<unsigned char*>(&seed_), sizeof(seed_), 85 base::SHA1HashBytes(reinterpret_cast<unsigned char*>(&seed_), sizeof(seed_),
74 hash); 86 hash);
75 memcpy(&seed_, hash, sizeof(seed_)); 87 memcpy(&seed_, hash, sizeof(seed_));
76 return seed_; 88 return seed_;
77 } 89 }
78 90
79 TestSession::TestSession(QuicConnection* connection, 91 TestSession::TestSession(QuicConnection* connection,
80 const QuicConfig& config) 92 const QuicConfig& config)
(...skipping 25 matching lines...) Expand all
106 118
107 MockAckNotifierDelegate::MockAckNotifierDelegate() { 119 MockAckNotifierDelegate::MockAckNotifierDelegate() {
108 } 120 }
109 121
110 MockAckNotifierDelegate::~MockAckNotifierDelegate() { 122 MockAckNotifierDelegate::~MockAckNotifierDelegate() {
111 } 123 }
112 124
113 } // namespace test 125 } // namespace test
114 } // namespace tools 126 } // namespace tools
115 } // namespace net 127 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/test_tools/quic_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698