OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef FuzzedDataProvider_h | |
6 #define FuzzedDataProvider_h | |
7 | |
8 #include "base/test/fuzzed_data_provider.h" | |
9 #include "platform/PlatformExport.h" | |
10 #include "wtf/Noncopyable.h" | |
11 #include "wtf/text/CString.h" | |
12 | |
13 namespace blink { | |
14 | |
15 // This class simply wraps //base/test/fuzzed_data_provider and vends Blink frie ndly | |
eroman
2016/08/18 21:37:11
"frie" ?
Charlie Harrison
2016/08/19 18:58:17
Wrapped to 80 cols.
| |
16 // types. | |
17 class PLATFORM_EXPORT FuzzedDataProvider { | |
18 WTF_MAKE_NONCOPYABLE(FuzzedDataProvider); | |
19 | |
20 public: | |
21 FuzzedDataProvider(const uint8_t* bytes, size_t numBytes); | |
22 | |
23 // Returns a string with length between minBytes and maxBytes. If the | |
24 // length is greater than the length of the remaining data this is | |
25 // equivalent to ConsumeRemainingBytes(). | |
26 CString ConsumeBytesInRange(uint32_t minBytes, uint32_t maxBytes); | |
27 | |
28 // Returns a String containing all remaining bytes of the input data. | |
29 CString ConsumeRemainingBytes(); | |
30 | |
31 // Returns a bool, or false when no data remains. | |
32 bool ConsumeBool(); | |
33 | |
34 private: | |
35 base::FuzzedDataProvider m_provider; | |
36 }; | |
37 | |
38 } // namespace blink | |
39 | |
40 #endif // FuzzedDataProvider_h | |
OLD | NEW |