OLD | NEW |
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 <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1757 return false; | 1757 return false; |
1758 } | 1758 } |
1759 } | 1759 } |
1760 } | 1760 } |
1761 }; | 1761 }; |
1762 | 1762 |
1763 template <> | 1763 template <> |
1764 struct FuzzTraits<ui::LatencyInfo> { | 1764 struct FuzzTraits<ui::LatencyInfo> { |
1765 static bool Fuzz(ui::LatencyInfo* p, Fuzzer* fuzzer) { | 1765 static bool Fuzz(ui::LatencyInfo* p, Fuzzer* fuzzer) { |
1766 // TODO(inferno): Add param traits for |latency_components|. | 1766 // TODO(inferno): Add param traits for |latency_components|. |
1767 p->input_coordinates_size = static_cast<uint32>( | 1767 int64 trace_id = p->trace_id(); |
| 1768 bool terminated = p->terminated(); |
| 1769 uint32 input_coordinates_size = static_cast<uint32>( |
1768 RandInRange(ui::LatencyInfo::kMaxInputCoordinates + 1)); | 1770 RandInRange(ui::LatencyInfo::kMaxInputCoordinates + 1)); |
| 1771 ui::LatencyInfo::InputCoordinate |
| 1772 input_coordinates[ui::LatencyInfo::kMaxInputCoordinates]; |
1769 if (!FuzzParamArray( | 1773 if (!FuzzParamArray( |
1770 &p->input_coordinates[0], p->input_coordinates_size, fuzzer)) | 1774 input_coordinates, input_coordinates_size, fuzzer)) |
1771 return false; | 1775 return false; |
1772 if (!FuzzParam(&p->trace_id, fuzzer)) | 1776 if (!FuzzParam(&trace_id, fuzzer)) |
1773 return false; | 1777 return false; |
1774 if (!FuzzParam(&p->terminated, fuzzer)) | 1778 if (!FuzzParam(&terminated, fuzzer)) |
1775 return false; | 1779 return false; |
| 1780 |
| 1781 ui::LatencyInfo latency(trace_id, terminated); |
| 1782 for (size_t i = 0; i < input_coordinates_size; i++) { |
| 1783 latency.AddInputCoordinate(input_coordinates[i]); |
| 1784 } |
| 1785 *p = latency; |
| 1786 |
1776 return true; | 1787 return true; |
1777 } | 1788 } |
1778 }; | 1789 }; |
1779 | 1790 |
1780 template <> | 1791 template <> |
1781 struct FuzzTraits<ui::LatencyInfo::InputCoordinate> { | 1792 struct FuzzTraits<ui::LatencyInfo::InputCoordinate> { |
1782 static bool Fuzz( | 1793 static bool Fuzz( |
1783 ui::LatencyInfo::InputCoordinate* p, Fuzzer* fuzzer) { | 1794 ui::LatencyInfo::InputCoordinate* p, Fuzzer* fuzzer) { |
1784 if (!FuzzParam(&p->x, fuzzer)) | 1795 if (!FuzzParam(&p->x, fuzzer)) |
1785 return false; | 1796 return false; |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2094 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h" | 2105 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h" |
2095 #undef IPC_MESSAGE_DECL | 2106 #undef IPC_MESSAGE_DECL |
2096 #define IPC_MESSAGE_DECL(kind, type, name, in, out, ilist, olist) \ | 2107 #define IPC_MESSAGE_DECL(kind, type, name, in, out, ilist, olist) \ |
2097 (*map)[static_cast<uint32>(name::ID)] = fuzzer_for_##name; | 2108 (*map)[static_cast<uint32>(name::ID)] = fuzzer_for_##name; |
2098 | 2109 |
2099 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map) { | 2110 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map) { |
2100 #include "tools/ipc_fuzzer/message_lib/all_messages.h" | 2111 #include "tools/ipc_fuzzer/message_lib/all_messages.h" |
2101 } | 2112 } |
2102 | 2113 |
2103 } // namespace ipc_fuzzer | 2114 } // namespace ipc_fuzzer |
OLD | NEW |