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

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

Issue 2250263003: Move FuzzedDataProvider to //base and expose to blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ... also remove PLATFORM_EXPORT Created 4 years, 4 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
« no previous file with comments | « third_party/WebKit/Source/platform/testing/FuzzedDataProvider.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/testing/FuzzedDataProvider.cpp
diff --git a/third_party/WebKit/Source/platform/testing/FuzzedDataProvider.cpp b/third_party/WebKit/Source/platform/testing/FuzzedDataProvider.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..88e9e0f5fecb649016650ebac37c65632b61083c
--- /dev/null
+++ b/third_party/WebKit/Source/platform/testing/FuzzedDataProvider.cpp
@@ -0,0 +1,32 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "platform/testing/FuzzedDataProvider.h"
+
+namespace blink {
+
+FuzzedDataProvider::FuzzedDataProvider(const uint8_t* bytes, size_t numBytes)
+ : m_provider(bytes, numBytes)
+{
+}
+
+CString FuzzedDataProvider::ConsumeBytesInRange(uint32_t minBytes, uint32_t maxBytes)
+{
+ size_t numBytes = static_cast<size_t>(m_provider.ConsumeUint32InRange(minBytes, maxBytes));
+ base::StringPiece bytes = m_provider.ConsumeBytes(numBytes);
+ return CString(bytes.data(), bytes.length());
+}
+
+CString FuzzedDataProvider::ConsumeRemainingBytes()
+{
+ base::StringPiece bytes = m_provider.ConsumeRemainingBytes();
+ return CString(bytes.data(), bytes.length());
+}
+
+bool FuzzedDataProvider::ConsumeBool()
+{
+ return m_provider.ConsumeBool();
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/platform/testing/FuzzedDataProvider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698