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

Unified Diff: net/quic/test_tools/quic_test_utils.cc

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 side-by-side diff with in-line comments
Download patch
Index: net/quic/test_tools/quic_test_utils.cc
diff --git a/net/quic/test_tools/quic_test_utils.cc b/net/quic/test_tools/quic_test_utils.cc
index 1514f2d28df230b3172c9e548d0ac19b704b78d8..6353f47d8600a39f39cc62b298ed4265b9d05b44 100644
--- a/net/quic/test_tools/quic_test_utils.cc
+++ b/net/quic/test_tools/quic_test_utils.cc
@@ -117,6 +117,22 @@ uint64_t SimpleRandom::RandUint64() {
return seed_;
}
+void SimpleRandom::RandBytes(void* data, size_t len) {
+ uint8_t* real_data = static_cast<uint8_t*>(data);
+ for (size_t offset = 0; offset < len; offset++) {
+ real_data[offset] = RandUint64() & 0xff;
+ }
+}
+
+void SimpleRandom::Reseed(const void* additional_entropy, size_t len) {
+ const uint8_t* real_entropy = static_cast<const uint8_t*>(additional_entropy);
+ for (size_t offset = 0; offset < len; offset++) {
+ // Note: this is not actually a well-established way to incorporate new
+ // entropy, but good enough for tests.
+ seed_ *= real_entropy[len];
+ }
+}
+
MockFramerVisitor::MockFramerVisitor() {
// By default, we want to accept packets.
ON_CALL(*this, OnProtocolVersionMismatch(_))
« net/quic/core/congestion_control/simulation/actor.h ('K') | « net/quic/test_tools/quic_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698