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

Side by Side Diff: net/quic/quic_framer_test.cc

Issue 447103002: Remove unused version argument from QuicFramerTest's (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Fix_comment_in_QuicFramer_72558804
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | 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/quic/quic_framer.h" 5 #include "net/quic/quic_framer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 28 matching lines...) Expand all
39 const QuicPacketSequenceNumber kEpoch = GG_UINT64_C(1) << 48; 39 const QuicPacketSequenceNumber kEpoch = GG_UINT64_C(1) << 48;
40 const QuicPacketSequenceNumber kMask = kEpoch - 1; 40 const QuicPacketSequenceNumber kMask = kEpoch - 1;
41 41
42 // Index into the connection_id offset in the header. 42 // Index into the connection_id offset in the header.
43 const size_t kConnectionIdOffset = kPublicFlagsSize; 43 const size_t kConnectionIdOffset = kPublicFlagsSize;
44 // Index into the version string in the header. (if present). 44 // Index into the version string in the header. (if present).
45 const size_t kVersionOffset = kConnectionIdOffset + PACKET_8BYTE_CONNECTION_ID; 45 const size_t kVersionOffset = kConnectionIdOffset + PACKET_8BYTE_CONNECTION_ID;
46 46
47 // Size in bytes of the stream frame fields for an arbitrary StreamID and 47 // Size in bytes of the stream frame fields for an arbitrary StreamID and
48 // offset and the last frame in a packet. 48 // offset and the last frame in a packet.
49 size_t GetMinStreamFrameSize(QuicVersion version) { 49 size_t GetMinStreamFrameSize() {
50 return kQuicFrameTypeSize + kQuicMaxStreamIdSize + kQuicMaxStreamOffsetSize; 50 return kQuicFrameTypeSize + kQuicMaxStreamIdSize + kQuicMaxStreamOffsetSize;
51 } 51 }
52 52
53 // Index into the sequence number offset in the header. 53 // Index into the sequence number offset in the header.
54 size_t GetSequenceNumberOffset(QuicConnectionIdLength connection_id_length, 54 size_t GetSequenceNumberOffset(QuicConnectionIdLength connection_id_length,
55 bool include_version) { 55 bool include_version) {
56 return kConnectionIdOffset + connection_id_length + 56 return kConnectionIdOffset + connection_id_length +
57 (include_version ? kQuicVersionSize : 0); 57 (include_version ? kQuicVersionSize : 0);
58 } 58 }
59 59
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 // Checks if the supplied string matches data in the supplied StreamFrame. 454 // Checks if the supplied string matches data in the supplied StreamFrame.
455 void CheckStreamFrameData(string str, QuicStreamFrame* frame) { 455 void CheckStreamFrameData(string str, QuicStreamFrame* frame) {
456 scoped_ptr<string> frame_data(frame->GetDataAsString()); 456 scoped_ptr<string> frame_data(frame->GetDataAsString());
457 EXPECT_EQ(str, *frame_data); 457 EXPECT_EQ(str, *frame_data);
458 } 458 }
459 459
460 void CheckStreamFrameBoundaries(unsigned char* packet, 460 void CheckStreamFrameBoundaries(unsigned char* packet,
461 size_t stream_id_size, 461 size_t stream_id_size,
462 bool include_version) { 462 bool include_version) {
463 // Now test framing boundaries 463 // Now test framing boundaries
464 for (size_t i = kQuicFrameTypeSize; 464 for (size_t i = kQuicFrameTypeSize; i < GetMinStreamFrameSize(); ++i) {
465 i < GetMinStreamFrameSize(framer_.version()); ++i) {
466 string expected_error; 465 string expected_error;
467 if (i < kQuicFrameTypeSize + stream_id_size) { 466 if (i < kQuicFrameTypeSize + stream_id_size) {
468 expected_error = "Unable to read stream_id."; 467 expected_error = "Unable to read stream_id.";
469 } else if (i < kQuicFrameTypeSize + stream_id_size + 468 } else if (i < kQuicFrameTypeSize + stream_id_size +
470 kQuicMaxStreamOffsetSize) { 469 kQuicMaxStreamOffsetSize) {
471 expected_error = "Unable to read offset."; 470 expected_error = "Unable to read offset.";
472 } else { 471 } else {
473 expected_error = "Unable to read frame data."; 472 expected_error = "Unable to read frame data.";
474 } 473 }
475 CheckProcessingFails( 474 CheckProcessingFails(
(...skipping 3851 matching lines...) Expand 10 before | Expand all | Expand 10 after
4327 EXPECT_CALL(visitor, OnPacketComplete()); 4326 EXPECT_CALL(visitor, OnPacketComplete());
4328 EXPECT_CALL(visitor, OnUnauthenticatedPublicHeader(_)).WillOnce(Return(true)); 4327 EXPECT_CALL(visitor, OnUnauthenticatedPublicHeader(_)).WillOnce(Return(true));
4329 4328
4330 QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false); 4329 QuicEncryptedPacket encrypted(AsChars(packet), arraysize(packet), false);
4331 EXPECT_TRUE(framer_.ProcessPacket(encrypted)); 4330 EXPECT_TRUE(framer_.ProcessPacket(encrypted));
4332 EXPECT_EQ(QUIC_NO_ERROR, framer_.error()); 4331 EXPECT_EQ(QUIC_NO_ERROR, framer_.error());
4333 } 4332 }
4334 4333
4335 } // namespace test 4334 } // namespace test
4336 } // namespace net 4335 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698