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

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

Issue 2323963002: Implement an event-based simulator for QuicConnection (Closed)
Patch Set: Adding missing files. Created 4 years, 3 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
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> 10 #include <stddef.h>
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 class QuicFlagSaver { 220 class QuicFlagSaver {
221 public: 221 public:
222 QuicFlagSaver(); 222 QuicFlagSaver();
223 ~QuicFlagSaver(); 223 ~QuicFlagSaver();
224 }; 224 };
225 225
226 // Simple random number generator used to compute random numbers suitable 226 // Simple random number generator used to compute random numbers suitable
227 // for pseudo-randomly dropping packets in tests. It works by computing 227 // for pseudo-randomly dropping packets in tests. It works by computing
228 // the sha1 hash of the current seed, and using the first 64 bits as 228 // the sha1 hash of the current seed, and using the first 64 bits as
229 // the next random number, and the next seed. 229 // the next random number, and the next seed.
230 class SimpleRandom { 230 class SimpleRandom : public QuicRandom {
231 public: 231 public:
232 SimpleRandom() : seed_(0) {} 232 SimpleRandom() : seed_(0) {}
233 ~SimpleRandom() override {}
233 234
234 // Returns a random number in the range [0, kuint64max]. 235 // Returns a random number in the range [0, kuint64max].
235 uint64_t RandUint64(); 236 uint64_t RandUint64() override;
237
238 void RandBytes(void* data, size_t len) override;
239 void Reseed(const void* additional_entropy, size_t len) override;
236 240
237 void set_seed(uint64_t seed) { seed_ = seed; } 241 void set_seed(uint64_t seed) { seed_ = seed; }
238 242
239 private: 243 private:
240 uint64_t seed_; 244 uint64_t seed_;
241 245
242 DISALLOW_COPY_AND_ASSIGN(SimpleRandom); 246 DISALLOW_COPY_AND_ASSIGN(SimpleRandom);
243 }; 247 };
244 248
245 class MockFramerVisitor : public QuicFramerVisitorInterface { 249 class MockFramerVisitor : public QuicFramerVisitorInterface {
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 TestQuicSpdyServerSession** server_session); 1028 TestQuicSpdyServerSession** server_session);
1025 1029
1026 // Helper to generate client side stream ids, generalizes 1030 // Helper to generate client side stream ids, generalizes
1027 // kClientDataStreamId1 etc. above. 1031 // kClientDataStreamId1 etc. above.
1028 QuicStreamId QuicClientDataStreamId(int i); 1032 QuicStreamId QuicClientDataStreamId(int i);
1029 1033
1030 } // namespace test 1034 } // namespace test
1031 } // namespace net 1035 } // namespace net
1032 1036
1033 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ 1037 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698