QUICHE team | a6ef0a6 | 2019-03-07 20:34:33 -0500 | [diff] [blame] | 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. |
| 4 | |
| 5 | #include "net/third_party/quiche/src/quic/test_tools/mock_random.h" |
| 6 | |
| 7 | #include <string.h> |
| 8 | |
| 9 | namespace quic { |
| 10 | namespace test { |
| 11 | |
| 12 | MockRandom::MockRandom() : base_(0xDEADBEEF), increment_(0) {} |
| 13 | |
| 14 | MockRandom::MockRandom(uint32_t base) : base_(base), increment_(0) {} |
| 15 | |
| 16 | void MockRandom::RandBytes(void* data, size_t len) { |
| 17 | memset(data, increment_ + static_cast<uint8_t>('r'), len); |
| 18 | } |
| 19 | |
| 20 | uint64_t MockRandom::RandUint64() { |
| 21 | return base_ + increment_; |
| 22 | } |
| 23 | |
| 24 | void MockRandom::ChangeValue() { |
| 25 | increment_++; |
| 26 | } |
| 27 | |
| 28 | } // namespace test |
| 29 | } // namespace quic |