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

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

Issue 19858003: * Removed QuicTag kQuicVersion1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed comments from rch Created 7 years, 5 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/quic/test_tools/quic_test_utils.h ('k') | net/quic/test_tools/simple_quic_framer.cc » ('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/quic/test_tools/quic_test_utils.h" 5 #include "net/quic/test_tools/quic_test_utils.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "net/quic/crypto/crypto_framer.h" 8 #include "net/quic/crypto/crypto_framer.h"
9 #include "net/quic/crypto/crypto_handshake.h" 9 #include "net/quic/crypto/crypto_handshake.h"
10 #include "net/quic/crypto/crypto_utils.h" 10 #include "net/quic/crypto/crypto_utils.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 ON_CALL(*this, OnConnectionCloseFrame(_)) 48 ON_CALL(*this, OnConnectionCloseFrame(_))
49 .WillByDefault(testing::Return(true)); 49 .WillByDefault(testing::Return(true));
50 50
51 ON_CALL(*this, OnGoAwayFrame(_)) 51 ON_CALL(*this, OnGoAwayFrame(_))
52 .WillByDefault(testing::Return(true)); 52 .WillByDefault(testing::Return(true));
53 } 53 }
54 54
55 MockFramerVisitor::~MockFramerVisitor() { 55 MockFramerVisitor::~MockFramerVisitor() {
56 } 56 }
57 57
58 bool NoOpFramerVisitor::OnProtocolVersionMismatch(QuicTag version) { 58 bool NoOpFramerVisitor::OnProtocolVersionMismatch(QuicVersion version) {
59 return false; 59 return false;
60 } 60 }
61 61
62 bool NoOpFramerVisitor::OnPacketHeader(const QuicPacketHeader& header) { 62 bool NoOpFramerVisitor::OnPacketHeader(const QuicPacketHeader& header) {
63 return true; 63 return true;
64 } 64 }
65 65
66 bool NoOpFramerVisitor::OnStreamFrame(const QuicStreamFrame& frame) { 66 bool NoOpFramerVisitor::OnStreamFrame(const QuicStreamFrame& frame) {
67 return true; 67 return true;
68 } 68 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 } 182 }
183 183
184 void MockHelper::AdvanceTime(QuicTime::Delta delta) { 184 void MockHelper::AdvanceTime(QuicTime::Delta delta) {
185 clock_.AdvanceTime(delta); 185 clock_.AdvanceTime(delta);
186 } 186 }
187 187
188 MockConnection::MockConnection(QuicGuid guid, 188 MockConnection::MockConnection(QuicGuid guid,
189 IPEndPoint address, 189 IPEndPoint address,
190 bool is_server) 190 bool is_server)
191 : QuicConnection(guid, address, new testing::NiceMock<MockHelper>(), 191 : QuicConnection(guid, address, new testing::NiceMock<MockHelper>(),
192 is_server), 192 is_server, QuicVersionMax()),
193 has_mock_helper_(true) { 193 has_mock_helper_(true) {
194 } 194 }
195 195
196 MockConnection::MockConnection(QuicGuid guid, 196 MockConnection::MockConnection(QuicGuid guid,
197 IPEndPoint address, 197 IPEndPoint address,
198 QuicConnectionHelperInterface* helper, 198 QuicConnectionHelperInterface* helper,
199 bool is_server) 199 bool is_server)
200 : QuicConnection(guid, address, helper, is_server), 200 : QuicConnection(guid, address, helper, is_server, QuicVersionMax()),
201 has_mock_helper_(false) { 201 has_mock_helper_(false) {
202 } 202 }
203 203
204 MockConnection::~MockConnection() { 204 MockConnection::~MockConnection() {
205 } 205 }
206 206
207 void MockConnection::AdvanceTime(QuicTime::Delta delta) { 207 void MockConnection::AdvanceTime(QuicTime::Delta delta) {
208 CHECK(has_mock_helper_) << "Cannot advance time unless a MockClock is being" 208 CHECK(has_mock_helper_) << "Cannot advance time unless a MockClock is being"
209 " used"; 209 " used";
210 static_cast<MockHelper*>(helper())->AdvanceTime(delta); 210 static_cast<MockHelper*>(helper())->AdvanceTime(delta);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 actual->data(), actual->length(), 347 actual->data(), actual->length(),
348 expected->data(), expected->length()); 348 expected->data(), expected->length());
349 } 349 }
350 350
351 static QuicPacket* ConstructPacketFromHandshakeMessage( 351 static QuicPacket* ConstructPacketFromHandshakeMessage(
352 QuicGuid guid, 352 QuicGuid guid,
353 const CryptoHandshakeMessage& message, 353 const CryptoHandshakeMessage& message,
354 bool should_include_version) { 354 bool should_include_version) {
355 CryptoFramer crypto_framer; 355 CryptoFramer crypto_framer;
356 scoped_ptr<QuicData> data(crypto_framer.ConstructHandshakeMessage(message)); 356 scoped_ptr<QuicData> data(crypto_framer.ConstructHandshakeMessage(message));
357 QuicFramer quic_framer(kQuicVersion1, QuicTime::Zero(), false); 357 QuicFramer quic_framer(QuicVersionMax(), QuicTime::Zero(), false);
358 358
359 QuicPacketHeader header; 359 QuicPacketHeader header;
360 header.public_header.guid = guid; 360 header.public_header.guid = guid;
361 header.public_header.reset_flag = false; 361 header.public_header.reset_flag = false;
362 header.public_header.version_flag = should_include_version; 362 header.public_header.version_flag = should_include_version;
363 header.packet_sequence_number = 1; 363 header.packet_sequence_number = 1;
364 header.entropy_flag = false; 364 header.entropy_flag = false;
365 header.entropy_hash = 0; 365 header.entropy_hash = 0;
366 header.fec_flag = false; 366 header.fec_flag = false;
367 header.fec_group = 0; 367 header.fec_group = 0;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 data.AppendToString(&data_); 418 data.AppendToString(&data_);
419 return true; 419 return true;
420 } 420 }
421 421
422 void TestDecompressorVisitor::OnDecompressionError() { 422 void TestDecompressorVisitor::OnDecompressionError() {
423 error_ = true; 423 error_ = true;
424 } 424 }
425 425
426 } // namespace test 426 } // namespace test
427 } // namespace net 427 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_test_utils.h ('k') | net/quic/test_tools/simple_quic_framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698