OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/quic/test_tools/mock_random.h" | 5 #include "net/quic/test_tools/mock_random.h" |
6 | 6 |
| 7 #include <string.h> |
| 8 |
7 namespace net { | 9 namespace net { |
8 namespace test { | 10 namespace test { |
9 | 11 |
10 MockRandom::MockRandom() : base_(0xDEADBEEF), increment_(0) {} | 12 MockRandom::MockRandom() : base_(0xDEADBEEF), increment_(0) {} |
11 | 13 |
12 MockRandom::MockRandom(uint32_t base) : base_(base), increment_(0) {} | 14 MockRandom::MockRandom(uint32_t base) : base_(base), increment_(0) {} |
13 | 15 |
14 void MockRandom::RandBytes(void* data, size_t len) { | 16 void MockRandom::RandBytes(void* data, size_t len) { |
15 memset(data, 'r' + increment_, len); | 17 memset(data, 'r' + increment_, len); |
16 } | 18 } |
17 | 19 |
18 uint64_t MockRandom::RandUint64() { | 20 uint64_t MockRandom::RandUint64() { |
19 return base_ + increment_; | 21 return base_ + increment_; |
20 } | 22 } |
21 | 23 |
22 void MockRandom::Reseed(const void* additional_entropy, size_t entropy_len) {} | 24 void MockRandom::Reseed(const void* additional_entropy, size_t entropy_len) {} |
23 | 25 |
24 void MockRandom::ChangeValue() { | 26 void MockRandom::ChangeValue() { |
25 increment_++; | 27 increment_++; |
26 } | 28 } |
27 | 29 |
28 } // namespace test | 30 } // namespace test |
29 } // namespace net | 31 } // namespace net |
OLD | NEW |