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