Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / net / quic / test_tools / mock_random.h
blob53b24b74eeb52a5701c2b98210d36547a9722d02
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
3 // found in the LICENSE file.
5 #ifndef NET_QUIC_TEST_TOOLS_MOCK_RANDOM_H_
6 #define NET_QUIC_TEST_TOOLS_MOCK_RANDOM_H_
8 #include "base/compiler_specific.h"
9 #include "net/quic/crypto/quic_random.h"
11 namespace net {
13 class MockRandom : public QuicRandom {
14 public:
15 // Initializes base_ to 0xDEADBEEF.
16 MockRandom();
17 explicit MockRandom(uint32 base);
19 // QuicRandom:
20 // Fills the |data| buffer with a repeating byte, initially 'r'.
21 virtual void RandBytes(void* data, size_t len) OVERRIDE;
22 // Returns base + the current increment.
23 virtual uint64 RandUint64() OVERRIDE;
24 // Does nothing.
25 virtual void Reseed(const void* additional_entropy,
26 size_t entropy_len) OVERRIDE;
28 // ChangeValue increments |increment_|. This causes the value returned by
29 // |RandUint64| and the byte that |RandBytes| fills with, to change.
30 void ChangeValue();
32 private:
33 uint32 base_;
34 uint8 increment_;
36 DISALLOW_COPY_AND_ASSIGN(MockRandom);
39 } // namespace net
41 #endif // NET_QUIC_TEST_TOOLS_MOCK_RANDOM_H_