blob: e8229c07357ac1f53a7194d9b3e4debeba868199 [file] [log] [blame]
QUICHE teama6ef0a62019-03-07 20:34:33 -05001// 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.
4
5#ifndef QUICHE_QUIC_TEST_TOOLS_MOCK_RANDOM_H_
6#define QUICHE_QUIC_TEST_TOOLS_MOCK_RANDOM_H_
7
8#include "base/macros.h"
9#include "net/third_party/quiche/src/quic/core/crypto/quic_random.h"
10
11namespace quic {
12namespace test {
13
14class MockRandom : public QuicRandom {
15 public:
16 // Initializes base_ to 0xDEADBEEF.
17 MockRandom();
18 explicit MockRandom(uint32_t base);
19 MockRandom(const MockRandom&) = delete;
20 MockRandom& operator=(const MockRandom&) = delete;
21
22 // QuicRandom:
23 // Fills the |data| buffer with a repeating byte, initially 'r'.
24 void RandBytes(void* data, size_t len) override;
25 // Returns base + the current increment.
26 uint64_t RandUint64() override;
27
28 // ChangeValue increments |increment_|. This causes the value returned by
29 // |RandUint64| and the byte that |RandBytes| fills with, to change.
30 void ChangeValue();
31
32 private:
33 uint32_t base_;
34 uint8_t increment_;
35};
36
37} // namespace test
38} // namespace quic
39
40#endif // QUICHE_QUIC_TEST_TOOLS_MOCK_RANDOM_H_