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

Side by Side Diff: tools/ipc_fuzzer/fuzzer/fuzzer.cc

Issue 2048673002: Revert of Replace ui::LatencyInfo::InputCoordinate with gfx::PointF (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <iostream> 5 #include <iostream>
6 #include <set> 6 #include <set>
7 #include <string> 7 #include <string>
8 #include <tuple> 8 #include <tuple>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after
1786 }; 1786 };
1787 1787
1788 template <> 1788 template <>
1789 struct FuzzTraits<ui::LatencyInfo> { 1789 struct FuzzTraits<ui::LatencyInfo> {
1790 static bool Fuzz(ui::LatencyInfo* p, Fuzzer* fuzzer) { 1790 static bool Fuzz(ui::LatencyInfo* p, Fuzzer* fuzzer) {
1791 // TODO(inferno): Add param traits for |latency_components|. 1791 // TODO(inferno): Add param traits for |latency_components|.
1792 int64_t trace_id = p->trace_id(); 1792 int64_t trace_id = p->trace_id();
1793 bool terminated = p->terminated(); 1793 bool terminated = p->terminated();
1794 uint32_t input_coordinates_size = static_cast<uint32_t>( 1794 uint32_t input_coordinates_size = static_cast<uint32_t>(
1795 RandInRange(ui::LatencyInfo::kMaxInputCoordinates + 1)); 1795 RandInRange(ui::LatencyInfo::kMaxInputCoordinates + 1));
1796 gfx::PointF input_coordinates[ui::LatencyInfo::kMaxInputCoordinates]; 1796 ui::LatencyInfo::InputCoordinate
1797 input_coordinates[ui::LatencyInfo::kMaxInputCoordinates];
1797 if (!FuzzParamArray( 1798 if (!FuzzParamArray(
1798 input_coordinates, input_coordinates_size, fuzzer)) 1799 input_coordinates, input_coordinates_size, fuzzer))
1799 return false; 1800 return false;
1800 if (!FuzzParam(&trace_id, fuzzer)) 1801 if (!FuzzParam(&trace_id, fuzzer))
1801 return false; 1802 return false;
1802 if (!FuzzParam(&terminated, fuzzer)) 1803 if (!FuzzParam(&terminated, fuzzer))
1803 return false; 1804 return false;
1804 1805
1805 ui::LatencyInfo latency(trace_id, terminated); 1806 ui::LatencyInfo latency(trace_id, terminated);
1806 for (size_t i = 0; i < input_coordinates_size; i++) { 1807 for (size_t i = 0; i < input_coordinates_size; i++) {
1807 latency.AddInputCoordinate(input_coordinates[i]); 1808 latency.AddInputCoordinate(input_coordinates[i]);
1808 } 1809 }
1809 *p = latency; 1810 *p = latency;
1810 1811
1811 return true; 1812 return true;
1812 } 1813 }
1813 }; 1814 };
1815
1816 template <>
1817 struct FuzzTraits<ui::LatencyInfo::InputCoordinate> {
1818 static bool Fuzz(
1819 ui::LatencyInfo::InputCoordinate* p, Fuzzer* fuzzer) {
1820 if (!FuzzParam(&p->x, fuzzer))
1821 return false;
1822 if (!FuzzParam(&p->y, fuzzer))
1823 return false;
1824 return true;
1825 }
1826 };
1814 1827
1815 template <> 1828 template <>
1816 struct FuzzTraits<url::Origin> { 1829 struct FuzzTraits<url::Origin> {
1817 static bool Fuzz(url::Origin* p, Fuzzer* fuzzer) { 1830 static bool Fuzz(url::Origin* p, Fuzzer* fuzzer) {
1818 std::string scheme = p->scheme(); 1831 std::string scheme = p->scheme();
1819 std::string host = p->host(); 1832 std::string host = p->host();
1820 uint16_t port = p->port(); 1833 uint16_t port = p->port();
1821 if (!FuzzParam(&scheme, fuzzer)) 1834 if (!FuzzParam(&scheme, fuzzer))
1822 return false; 1835 return false;
1823 if (!FuzzParam(&host, fuzzer)) 1836 if (!FuzzParam(&host, fuzzer))
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
2024 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h" 2037 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h"
2025 #undef IPC_MESSAGE_DECL 2038 #undef IPC_MESSAGE_DECL
2026 #define IPC_MESSAGE_DECL(name, ...) \ 2039 #define IPC_MESSAGE_DECL(name, ...) \
2027 (*map)[static_cast<uint32_t>(name::ID)] = FuzzerHelper<name>::Fuzz; 2040 (*map)[static_cast<uint32_t>(name::ID)] = FuzzerHelper<name>::Fuzz;
2028 2041
2029 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map) { 2042 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map) {
2030 #include "tools/ipc_fuzzer/message_lib/all_messages.h" 2043 #include "tools/ipc_fuzzer/message_lib/all_messages.h"
2031 } 2044 }
2032 2045
2033 } // namespace ipc_fuzzer 2046 } // namespace ipc_fuzzer
OLDNEW
« no previous file with comments | « content/browser/renderer_host/input/render_widget_host_latency_tracker_unittest.cc ('k') | ui/events/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698