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

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

Issue 330163003: First version of a QUIC SendAlgorithmSimulator which is designed to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase with trunk 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
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 *name_ = value_; 115 *name_ = value_;
116 } 116 }
117 117
118 private: 118 private:
119 SaveType* name_; 119 SaveType* name_;
120 SaveType value_; 120 SaveType value_;
121 121
122 DISALLOW_COPY_AND_ASSIGN(ValueRestore); 122 DISALLOW_COPY_AND_ASSIGN(ValueRestore);
123 }; 123 };
124 124
125 // Simple random number generator used to compute random numbers suitable
126 // for pseudo-randomly dropping packets in tests. It works by computing
127 // the sha1 hash of the current seed, and using the first 64 bits as
128 // the next random number, and the next seed.
129 class SimpleRandom {
130 public:
131 SimpleRandom() : seed_(0) {}
132
133 // Returns a random number in the range [0, kuint64max].
134 uint64 RandUint64();
135
136 void set_seed(uint64 seed) { seed_ = seed; }
137
138 private:
139 uint64 seed_;
140
141 DISALLOW_COPY_AND_ASSIGN(SimpleRandom);
142 };
143
125 class MockFramerVisitor : public QuicFramerVisitorInterface { 144 class MockFramerVisitor : public QuicFramerVisitorInterface {
126 public: 145 public:
127 MockFramerVisitor(); 146 MockFramerVisitor();
128 virtual ~MockFramerVisitor(); 147 virtual ~MockFramerVisitor();
129 148
130 MOCK_METHOD1(OnError, void(QuicFramer* framer)); 149 MOCK_METHOD1(OnError, void(QuicFramer* framer));
131 // The constructor sets this up to return false by default. 150 // The constructor sets this up to return false by default.
132 MOCK_METHOD1(OnProtocolVersionMismatch, bool(QuicVersion version)); 151 MOCK_METHOD1(OnProtocolVersionMismatch, bool(QuicVersion version));
133 MOCK_METHOD0(OnPacket, void()); 152 MOCK_METHOD0(OnPacket, void());
134 MOCK_METHOD1(OnPublicResetPacket, void(const QuicPublicResetPacket& header)); 153 MOCK_METHOD1(OnPublicResetPacket, void(const QuicPublicResetPacket& header));
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 virtual ~MockAckNotifierDelegate(); 520 virtual ~MockAckNotifierDelegate();
502 521
503 private: 522 private:
504 DISALLOW_COPY_AND_ASSIGN(MockAckNotifierDelegate); 523 DISALLOW_COPY_AND_ASSIGN(MockAckNotifierDelegate);
505 }; 524 };
506 525
507 } // namespace test 526 } // namespace test
508 } // namespace net 527 } // namespace net
509 528
510 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_ 529 #endif // NET_QUIC_TEST_TOOLS_QUIC_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « net/quic/congestion_control/send_algorithm_simulator.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