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

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

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 years 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/test_tools/quic_test_packet_maker.h ('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 <stddef.h>
11 #include <stdint.h>
12
10 #include <string> 13 #include <string>
11 #include <vector> 14 #include <vector>
12 15
13 #include "base/basictypes.h" 16 #include "base/macros.h"
14 #include "base/strings/string_piece.h" 17 #include "base/strings/string_piece.h"
15 #include "net/quic/congestion_control/loss_detection_interface.h" 18 #include "net/quic/congestion_control/loss_detection_interface.h"
16 #include "net/quic/congestion_control/send_algorithm_interface.h" 19 #include "net/quic/congestion_control/send_algorithm_interface.h"
17 #include "net/quic/quic_client_session_base.h" 20 #include "net/quic/quic_client_session_base.h"
18 #include "net/quic/quic_connection.h" 21 #include "net/quic/quic_connection.h"
19 #include "net/quic/quic_framer.h" 22 #include "net/quic/quic_framer.h"
20 #include "net/quic/quic_protocol.h" 23 #include "net/quic/quic_protocol.h"
21 #include "net/quic/quic_sent_packet_manager.h" 24 #include "net/quic/quic_sent_packet_manager.h"
22 #include "net/quic/quic_session.h" 25 #include "net/quic/quic_session.h"
23 #include "net/quic/test_tools/mock_clock.h" 26 #include "net/quic/test_tools/mock_clock.h"
24 #include "net/quic/test_tools/mock_random.h" 27 #include "net/quic/test_tools/mock_random.h"
25 #include "net/spdy/spdy_framer.h" 28 #include "net/spdy/spdy_framer.h"
26 #include "net/tools/quic/quic_dispatcher.h" 29 #include "net/tools/quic/quic_dispatcher.h"
27 #include "net/tools/quic/quic_per_connection_packet_writer.h" 30 #include "net/tools/quic/quic_per_connection_packet_writer.h"
28 #include "net/tools/quic/quic_server_session.h" 31 #include "net/tools/quic/quic_server_session.h"
29 #include "net/tools/quic/test_tools/mock_quic_server_session_visitor.h" 32 #include "net/tools/quic/test_tools/mock_quic_server_session_visitor.h"
30 #include "testing/gmock/include/gmock/gmock.h" 33 #include "testing/gmock/include/gmock/gmock.h"
31 34
32 namespace net { 35 namespace net {
33 36
34 namespace test { 37 namespace test {
35 38
36 static const QuicConnectionId kTestConnectionId = 42; 39 static const QuicConnectionId kTestConnectionId = 42;
37 static const uint16 kTestPort = 123; 40 static const uint16_t kTestPort = 123;
38 static const uint32 kInitialStreamFlowControlWindowForTest = 41 static const uint32_t kInitialStreamFlowControlWindowForTest =
39 1024 * 1024; // 1 MB 42 1024 * 1024; // 1 MB
40 static const uint32 kInitialSessionFlowControlWindowForTest = 43 static const uint32_t kInitialSessionFlowControlWindowForTest =
41 1536 * 1024; // 1.5 MB 44 1536 * 1024; // 1.5 MB
42 // Data stream IDs start at 5: the crypto stream is 1, headers stream is 3. 45 // Data stream IDs start at 5: the crypto stream is 1, headers stream is 3.
43 static const QuicStreamId kClientDataStreamId1 = 5; 46 static const QuicStreamId kClientDataStreamId1 = 5;
44 static const QuicStreamId kClientDataStreamId2 = 7; 47 static const QuicStreamId kClientDataStreamId2 = 7;
45 static const QuicStreamId kClientDataStreamId3 = 9; 48 static const QuicStreamId kClientDataStreamId3 = 9;
46 49
47 // Returns the test peer IP address. 50 // Returns the test peer IP address.
48 IPAddressNumber TestPeerIPAddress(); 51 IPAddressNumber TestPeerIPAddress();
49 52
50 // Upper limit on versions we support. 53 // Upper limit on versions we support.
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 180
178 // Simple random number generator used to compute random numbers suitable 181 // Simple random number generator used to compute random numbers suitable
179 // for pseudo-randomly dropping packets in tests. It works by computing 182 // for pseudo-randomly dropping packets in tests. It works by computing
180 // the sha1 hash of the current seed, and using the first 64 bits as 183 // the sha1 hash of the current seed, and using the first 64 bits as
181 // the next random number, and the next seed. 184 // the next random number, and the next seed.
182 class SimpleRandom { 185 class SimpleRandom {
183 public: 186 public:
184 SimpleRandom() : seed_(0) {} 187 SimpleRandom() : seed_(0) {}
185 188
186 // Returns a random number in the range [0, kuint64max]. 189 // Returns a random number in the range [0, kuint64max].
187 uint64 RandUint64(); 190 uint64_t RandUint64();
188 191
189 void set_seed(uint64 seed) { seed_ = seed; } 192 void set_seed(uint64_t seed) { seed_ = seed; }
190 193
191 private: 194 private:
192 uint64 seed_; 195 uint64_t seed_;
193 196
194 DISALLOW_COPY_AND_ASSIGN(SimpleRandom); 197 DISALLOW_COPY_AND_ASSIGN(SimpleRandom);
195 }; 198 };
196 199
197 class MockFramerVisitor : public QuicFramerVisitorInterface { 200 class MockFramerVisitor : public QuicFramerVisitorInterface {
198 public: 201 public:
199 MockFramerVisitor(); 202 MockFramerVisitor();
200 ~MockFramerVisitor() override; 203 ~MockFramerVisitor() override;
201 204
202 MOCK_METHOD1(OnError, void(QuicFramer* framer)); 205 MOCK_METHOD1(OnError, void(QuicFramer* framer));
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 TestQuicSpdyServerSession** server_session); 801 TestQuicSpdyServerSession** server_session);
799 802
800 // Helper to generate client side stream ids, generalizes 803 // Helper to generate client side stream ids, generalizes
801 // kClientDataStreamId1 etc. above. 804 // kClientDataStreamId1 etc. above.
802 QuicStreamId QuicClientDataStreamId(int i); 805 QuicStreamId QuicClientDataStreamId(int i);
803 806
804 } // namespace test 807 } // namespace test
805 } // namespace net 808 } // namespace net
806 809
807 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ 810 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_test_packet_maker.h ('k') | net/quic/test_tools/quic_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698