summaryrefslogtreecommitdiffstats
path: root/net/quic/test_tools/mock_random.cc
diff options
context:
space:
mode:
authorwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-22 00:08:14 +0000
committerwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-22 00:08:14 +0000
commit9558c5d316474a6efcc9d91eaac2494ad45b2335 (patch)
tree9eba2118369f45e61ab483fb14d5ff00d9872238 /net/quic/test_tools/mock_random.cc
parent6a77ef2c9b299c6e39919cabda9600680ca024c5 (diff)
downloadchromium_src-9558c5d316474a6efcc9d91eaac2494ad45b2335.zip
chromium_src-9558c5d316474a6efcc9d91eaac2494ad45b2335.tar.gz
chromium_src-9558c5d316474a6efcc9d91eaac2494ad45b2335.tar.bz2
Add the GetRandomGenerator() method to QuicConnectionHelperInterface
so that the random number generator can be mocked in unit tests. Replace RandomUint64Callback with QuicRandom::RandUint64() in QuicStreamFactory. R=rch@chromium.org BUG=none TEST=net_unittests Review URL: https://codereview.chromium.org/11666015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@174478 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/quic/test_tools/mock_random.cc')
-rw-r--r--net/quic/test_tools/mock_random.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/net/quic/test_tools/mock_random.cc b/net/quic/test_tools/mock_random.cc
new file mode 100644
index 0000000..3b522ae
--- /dev/null
+++ b/net/quic/test_tools/mock_random.cc
@@ -0,0 +1,20 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/quic/test_tools/mock_random.h"
+
+namespace net {
+
+void MockRandom::RandBytes(void* data, size_t len) {
+ memset(data, 'r', len);
+}
+
+uint64 MockRandom::RandUint64() {
+ return 0xDEADBEEF;
+}
+
+void MockRandom::Reseed(const void* additional_entropy, size_t entropy_len) {
+}
+
+} // namespace net