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

Unified Diff: third_party/WebKit/Source/platform/testing/FuzzedDataProvider.h

Issue 2731643002: Fuzzer for TextCodecs (Closed)
Patch Set: fuzzer overload Created 3 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/testing/FuzzedDataProvider.h
diff --git a/third_party/WebKit/Source/platform/testing/FuzzedDataProvider.h b/third_party/WebKit/Source/platform/testing/FuzzedDataProvider.h
index aadeed8d2815638ae3394371d05330a62baef6d7..9449ec7a70b79d13330e11722ce862a9948288fa 100644
--- a/third_party/WebKit/Source/platform/testing/FuzzedDataProvider.h
+++ b/third_party/WebKit/Source/platform/testing/FuzzedDataProvider.h
@@ -7,6 +7,7 @@
#include "base/test/fuzzed_data_provider.h"
#include "wtf/Noncopyable.h"
+#include "wtf/Vector.h"
#include "wtf/text/CString.h"
namespace blink {
@@ -30,6 +31,11 @@ class FuzzedDataProvider {
// Returns a bool, or false when no data remains.
bool ConsumeBool();
+ template <typename Type>
+ Type PickValueInVector(const Vector<Type>& vec) {
+ return vec[m_provider.ConsumeUint32InRange(0, vec.size() - 1)];
+ }
+
private:
base::FuzzedDataProvider m_provider;
};

Powered by Google App Engine
This is Rietveld 408576698