| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_BASE_FUZZED_DATA_PROVIDER_H | 5 #ifndef NET_BASE_FUZZED_DATA_PROVIDER_H |
| 6 #define NET_BASE_FUZZED_DATA_PROVIDER_H | 6 #define NET_BASE_FUZZED_DATA_PROVIDER_H |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // |num_bits| must be less than 32. | 35 // |num_bits| must be less than 32. |
| 36 uint32_t ConsumeBits(size_t num_bits); | 36 uint32_t ConsumeBits(size_t num_bits); |
| 37 | 37 |
| 38 // Same as ConsumeBits(1), but returns a bool. | 38 // Same as ConsumeBits(1), but returns a bool. |
| 39 bool ConsumeBool(); | 39 bool ConsumeBool(); |
| 40 | 40 |
| 41 // Creates a value in the specified range, consuming only as much data is | 41 // Creates a value in the specified range, consuming only as much data is |
| 42 // needed. Value may not uniformly distributed in that range. | 42 // needed. Value may not uniformly distributed in that range. |
| 43 uint32_t ConsumeValueInRange(uint32_t min, uint32_t max); | 43 uint32_t ConsumeValueInRange(uint32_t min, uint32_t max); |
| 44 | 44 |
| 45 size_t ConsumeRemainingBytes(char* dest); |
| 46 |
| 47 size_t remaining_bytes() { return remaining_data_.length(); } |
| 48 |
| 45 private: | 49 private: |
| 46 base::StringPiece remaining_data_; | 50 base::StringPiece remaining_data_; |
| 47 | 51 |
| 48 DISALLOW_COPY_AND_ASSIGN(FuzzedDataProvider); | 52 DISALLOW_COPY_AND_ASSIGN(FuzzedDataProvider); |
| 49 }; | 53 }; |
| 50 | 54 |
| 51 } // namespace net | 55 } // namespace net |
| 52 | 56 |
| 53 #endif // NET_BASE_FUZZED_DATA_PROVIDER_H | 57 #endif // NET_BASE_FUZZED_DATA_PROVIDER_H |
| OLD | NEW |