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

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

Issue 990533002: Land Recent QUIC Changes until 03/06/2015. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | « net/quic/reliable_quic_stream.cc ('k') | net/quic/test_tools/quic_test_utils.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 // Common utilities for Quic tests 5 // Common utilities for Quic tests
6 6
7 #ifndef NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ 7 #ifndef NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_
8 #define NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ 8 #define NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_
9 9
10 #include <string> 10 #include <string>
(...skipping 16 matching lines...) Expand all
27 #include "net/spdy/spdy_framer.h" 27 #include "net/spdy/spdy_framer.h"
28 #include "testing/gmock/include/gmock/gmock.h" 28 #include "testing/gmock/include/gmock/gmock.h"
29 29
30 namespace net { 30 namespace net {
31 31
32 namespace test { 32 namespace test {
33 33
34 static const QuicConnectionId kTestConnectionId = 42; 34 static const QuicConnectionId kTestConnectionId = 42;
35 static const uint16 kTestPort = 123; 35 static const uint16 kTestPort = 123;
36 static const uint32 kInitialStreamFlowControlWindowForTest = 36 static const uint32 kInitialStreamFlowControlWindowForTest =
37 32 * 1024; // 32 KB 37 1024 * 1024; // 1 MB
38 static const uint32 kInitialSessionFlowControlWindowForTest = 38 static const uint32 kInitialSessionFlowControlWindowForTest =
39 64 * 1024; // 64 KB 39 1536 * 1024; // 1.5 MB
40
41 // Data stream IDs start at 5: the crypto stream is 1, headers stream is 3. 40 // Data stream IDs start at 5: the crypto stream is 1, headers stream is 3.
42 static const QuicStreamId kClientDataStreamId1 = 5; 41 static const QuicStreamId kClientDataStreamId1 = 5;
43 static const QuicStreamId kClientDataStreamId2 = 7; 42 static const QuicStreamId kClientDataStreamId2 = 7;
44 static const QuicStreamId kClientDataStreamId3 = 9; 43 static const QuicStreamId kClientDataStreamId3 = 9;
45 44
46 // Returns the test peer IP address. 45 // Returns the test peer IP address.
47 IPAddressNumber TestPeerIPAddress(); 46 IPAddressNumber TestPeerIPAddress();
48 47
49 // Upper limit on versions we support. 48 // Upper limit on versions we support.
50 QuicVersion QuicVersionMax(); 49 QuicVersion QuicVersionMax();
51 50
52 // Lower limit on versions we support. 51 // Lower limit on versions we support.
53 QuicVersion QuicVersionMin(); 52 QuicVersion QuicVersionMin();
54 53
55 // Returns an address for 127.0.0.1. 54 // Returns an address for 127.0.0.1.
56 IPAddressNumber Loopback4(); 55 IPAddressNumber Loopback4();
57 56
58 // Returns an address for ::1. 57 // Returns an address for ::1.
59 IPAddressNumber Loopback6(); 58 IPAddressNumber Loopback6();
60 59
61 void GenerateBody(std::string* body, int length); 60 void GenerateBody(std::string* body, int length);
62 61
63 // Create an encrypted packet for testing. 62 // Create an encrypted packet for testing.
64 QuicEncryptedPacket* ConstructEncryptedPacket( 63 QuicEncryptedPacket* ConstructEncryptedPacket(
65 QuicConnectionId connection_id, 64 QuicConnectionId connection_id,
66 bool version_flag, 65 bool version_flag,
67 bool reset_flag, 66 bool reset_flag,
68 QuicPacketSequenceNumber sequence_number, 67 QuicPacketSequenceNumber sequence_number,
68 const std::string& data,
69 QuicConnectionIdLength connection_id_length,
70 QuicSequenceNumberLength sequence_number_length);
71
72 // This form assumes |connection_id_length| == PACKET_8BYTE_CONNECTION_ID and
73 // |sequence_number_length| == PACKET_6BYTE_SEQUENCE_NUMBER.
74 QuicEncryptedPacket* ConstructEncryptedPacket(
75 QuicConnectionId connection_id,
76 bool version_flag,
77 bool reset_flag,
78 QuicPacketSequenceNumber sequence_number,
69 const std::string& data); 79 const std::string& data);
70 80
71 void CompareCharArraysWithHexError(const std::string& description, 81 void CompareCharArraysWithHexError(const std::string& description,
72 const char* actual, 82 const char* actual,
73 const int actual_len, 83 const int actual_len,
74 const char* expected, 84 const char* expected,
75 const int expected_len); 85 const int expected_len);
76 86
77 bool DecodeHexString(const base::StringPiece& hex, std::string* bytes); 87 bool DecodeHexString(const base::StringPiece& hex, std::string* bytes);
78 88
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 // clears the pointer to it to prevent use-after-free. 607 // clears the pointer to it to prevent use-after-free.
598 void Unregister(PerConnectionPacketWriter* writer); 608 void Unregister(PerConnectionPacketWriter* writer);
599 609
600 PerConnectionPacketWriter* current_writer_; 610 PerConnectionPacketWriter* current_writer_;
601 }; 611 };
602 612
603 } // namespace test 613 } // namespace test
604 } // namespace net 614 } // namespace net
605 615
606 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ 616 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « net/quic/reliable_quic_stream.cc ('k') | net/quic/test_tools/quic_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698