Commit 1aebb553 authored by Qiran Gong's avatar Qiran Gong Committed by Commit Bot

[IPC Fuzzer]Add traits for several enum types

Add viz::ResourceFormat to handle:
GpuChannelMsg_CreateSharedImage,
GpuChannelMsg_CreateSharedImageWithData.

Add net::EffectiveConnectionType to handle:
ViewMsg_UpdateWebPreferences.

Add printing::MarginType to handle:
PrintHostMsg_ScriptedPrint.

Change-Id: I8f0af98fd34384623f9d164fa4b1ebcaa35b6f0a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2243993
Commit-Queue: Martin Barbella <mbarbella@chromium.org>
Reviewed-by: default avatarMartin Barbella <mbarbella@chromium.org>
Cr-Commit-Position: refs/heads/master@{#778032}
parent e8fc50eb
...@@ -714,6 +714,15 @@ struct FuzzTraits<viz::FrameSinkId> { ...@@ -714,6 +714,15 @@ struct FuzzTraits<viz::FrameSinkId> {
} }
}; };
template <>
struct FuzzTraits<viz::ResourceFormat> {
static bool Fuzz(viz::ResourceFormat* p, Fuzzer* fuzzer) {
int format = RandInRange(viz::ResourceFormat::RESOURCE_FORMAT_MAX + 1);
*p = static_cast<viz::ResourceFormat>(format);
return true;
}
};
template <class A> template <class A>
struct FuzzTraits<cc::ListContainer<A>> { struct FuzzTraits<cc::ListContainer<A>> {
static bool Fuzz(cc::ListContainer<A>* p, Fuzzer* fuzzer) { static bool Fuzz(cc::ListContainer<A>* p, Fuzzer* fuzzer) {
...@@ -1449,6 +1458,16 @@ struct FuzzTraits<media::VideoPixelFormat> { ...@@ -1449,6 +1458,16 @@ struct FuzzTraits<media::VideoPixelFormat> {
} }
}; };
template <>
struct FuzzTraits<net::EffectiveConnectionType> {
static bool Fuzz(net::EffectiveConnectionType* p, Fuzzer* fuzzer) {
int type = RandInRange(
net::EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_LAST + 1);
*p = static_cast<net::EffectiveConnectionType>(type);
return true;
}
};
template <> template <>
struct FuzzTraits<net::LoadTimingInfo> { struct FuzzTraits<net::LoadTimingInfo> {
static bool Fuzz(net::LoadTimingInfo* p, Fuzzer* fuzzer) { static bool Fuzz(net::LoadTimingInfo* p, Fuzzer* fuzzer) {
...@@ -1692,6 +1711,15 @@ struct FuzzTraits<ppapi::SocketOptionData> { ...@@ -1692,6 +1711,15 @@ struct FuzzTraits<ppapi::SocketOptionData> {
} }
}; };
template <>
struct FuzzTraits<printing::MarginType> {
static bool Fuzz(printing::MarginType* p, Fuzzer* fuzzer) {
int type = RandInRange(printing::MarginType::MARGIN_TYPE_LAST + 1);
*p = static_cast<printing::MarginType>(type);
return true;
}
};
template <> template <>
struct FuzzTraits<SkBitmap> { struct FuzzTraits<SkBitmap> {
static bool Fuzz(SkBitmap* p, Fuzzer* fuzzer) { static bool Fuzz(SkBitmap* p, Fuzzer* fuzzer) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment