Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(704)

Side by Side Diff: net/quic/test_tools/mock_random.h

Issue 1523333002: Cleanup: Put QUIC test-only MockRandom class in the gfe_quic::test namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@109790831
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | net/quic/test_tools/mock_random.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef NET_QUIC_TEST_TOOLS_MOCK_RANDOM_H_ 5 #ifndef NET_QUIC_TEST_TOOLS_MOCK_RANDOM_H_
6 #define NET_QUIC_TEST_TOOLS_MOCK_RANDOM_H_ 6 #define NET_QUIC_TEST_TOOLS_MOCK_RANDOM_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "net/quic/crypto/quic_random.h" 9 #include "net/quic/crypto/quic_random.h"
10 10
11 namespace net { 11 namespace net {
12 namespace test {
12 13
13 class MockRandom : public QuicRandom { 14 class MockRandom : public QuicRandom {
14 public: 15 public:
15 // Initializes base_ to 0xDEADBEEF. 16 // Initializes base_ to 0xDEADBEEF.
16 MockRandom(); 17 MockRandom();
17 explicit MockRandom(uint32 base); 18 explicit MockRandom(uint32 base);
18 19
19 // QuicRandom: 20 // QuicRandom:
20 // Fills the |data| buffer with a repeating byte, initially 'r'. 21 // Fills the |data| buffer with a repeating byte, initially 'r'.
21 void RandBytes(void* data, size_t len) override; 22 void RandBytes(void* data, size_t len) override;
22 // Returns base + the current increment. 23 // Returns base + the current increment.
23 uint64 RandUint64() override; 24 uint64 RandUint64() override;
24 // Does nothing. 25 // Does nothing.
25 void Reseed(const void* additional_entropy, size_t entropy_len) override; 26 void Reseed(const void* additional_entropy, size_t entropy_len) override;
26 27
27 // ChangeValue increments |increment_|. This causes the value returned by 28 // ChangeValue increments |increment_|. This causes the value returned by
28 // |RandUint64| and the byte that |RandBytes| fills with, to change. 29 // |RandUint64| and the byte that |RandBytes| fills with, to change.
29 void ChangeValue(); 30 void ChangeValue();
30 31
31 private: 32 private:
32 uint32 base_; 33 uint32 base_;
33 uint8 increment_; 34 uint8 increment_;
34 35
35 DISALLOW_COPY_AND_ASSIGN(MockRandom); 36 DISALLOW_COPY_AND_ASSIGN(MockRandom);
36 }; 37 };
37 38
39 } // namespace test
38 } // namespace net 40 } // namespace net
39 41
40 #endif // NET_QUIC_TEST_TOOLS_MOCK_RANDOM_H_ 42 #endif // NET_QUIC_TEST_TOOLS_MOCK_RANDOM_H_
OLDNEW
« no previous file with comments | « no previous file | net/quic/test_tools/mock_random.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698