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

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

Issue 300623009: Fixes bugs in packet size computation in the creator and in the framer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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/tools/quic/test_tools/quic_test_utils.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/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 "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "net/quic/crypto/crypto_framer.h" 9 #include "net/quic/crypto/crypto_framer.h"
10 #include "net/quic/crypto/crypto_handshake.h" 10 #include "net/quic/crypto/crypto_handshake.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 QuicAckFrame MakeAckFrame(QuicPacketSequenceNumber largest_observed, 45 QuicAckFrame MakeAckFrame(QuicPacketSequenceNumber largest_observed,
46 QuicPacketSequenceNumber least_unacked) { 46 QuicPacketSequenceNumber least_unacked) {
47 QuicAckFrame ack; 47 QuicAckFrame ack;
48 ack.received_info.largest_observed = largest_observed; 48 ack.received_info.largest_observed = largest_observed;
49 ack.received_info.entropy_hash = 0; 49 ack.received_info.entropy_hash = 0;
50 ack.sent_info.least_unacked = least_unacked; 50 ack.sent_info.least_unacked = least_unacked;
51 ack.sent_info.entropy_hash = 0; 51 ack.sent_info.entropy_hash = 0;
52 return ack; 52 return ack;
53 } 53 }
54 54
55 QuicAckFrame MakeAckFrameWithNackRanges(
56 size_t num_nack_ranges, QuicPacketSequenceNumber least_unacked) {
57 QuicAckFrame ack = MakeAckFrame(2 * num_nack_ranges + least_unacked,
58 least_unacked);
59 // Add enough missing packets to get num_nack_ranges nack ranges.
60 for (QuicPacketSequenceNumber i = 1; i < 2 * num_nack_ranges; i += 2) {
61 ack.received_info.missing_packets.insert(least_unacked + i);
62 }
63 return ack;
64 }
65
55 MockFramerVisitor::MockFramerVisitor() { 66 MockFramerVisitor::MockFramerVisitor() {
56 // By default, we want to accept packets. 67 // By default, we want to accept packets.
57 ON_CALL(*this, OnProtocolVersionMismatch(_)) 68 ON_CALL(*this, OnProtocolVersionMismatch(_))
58 .WillByDefault(testing::Return(false)); 69 .WillByDefault(testing::Return(false));
59 70
60 // By default, we want to accept packets. 71 // By default, we want to accept packets.
61 ON_CALL(*this, OnUnauthenticatedHeader(_)) 72 ON_CALL(*this, OnUnauthenticatedHeader(_))
62 .WillByDefault(testing::Return(true)); 73 .WillByDefault(testing::Return(true));
63 74
64 ON_CALL(*this, OnUnauthenticatedPublicHeader(_)) 75 ON_CALL(*this, OnUnauthenticatedPublicHeader(_))
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 } 557 }
547 558
548 QuicVersionVector SupportedVersions(QuicVersion version) { 559 QuicVersionVector SupportedVersions(QuicVersion version) {
549 QuicVersionVector versions; 560 QuicVersionVector versions;
550 versions.push_back(version); 561 versions.push_back(version);
551 return versions; 562 return versions;
552 } 563 }
553 564
554 } // namespace test 565 } // namespace test
555 } // namespace net 566 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_test_utils.h ('k') | net/tools/quic/test_tools/quic_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698