| 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
|
|
|