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 <tuple> | 8 #include <tuple> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1583 } | 1583 } |
1584 } | 1584 } |
1585 }; | 1585 }; |
1586 | 1586 |
1587 template <> | 1587 template <> |
1588 struct FuzzTraits<ui::LatencyInfo> { | 1588 struct FuzzTraits<ui::LatencyInfo> { |
1589 static bool Fuzz(ui::LatencyInfo* p, Fuzzer* fuzzer) { | 1589 static bool Fuzz(ui::LatencyInfo* p, Fuzzer* fuzzer) { |
1590 // TODO(inferno): Add param traits for |latency_components|. | 1590 // TODO(inferno): Add param traits for |latency_components|. |
1591 int64_t trace_id = p->trace_id(); | 1591 int64_t trace_id = p->trace_id(); |
1592 bool terminated = p->terminated(); | 1592 bool terminated = p->terminated(); |
1593 uint32_t input_coordinates_size = static_cast<uint32_t>( | |
1594 RandInRange(ui::LatencyInfo::kMaxInputCoordinates + 1)); | |
1595 gfx::PointF input_coordinates[ui::LatencyInfo::kMaxInputCoordinates]; | |
1596 if (!FuzzParamArray( | |
1597 input_coordinates, input_coordinates_size, fuzzer)) | |
1598 return false; | |
1599 if (!FuzzParam(&trace_id, fuzzer)) | 1593 if (!FuzzParam(&trace_id, fuzzer)) |
1600 return false; | 1594 return false; |
1601 if (!FuzzParam(&terminated, fuzzer)) | 1595 if (!FuzzParam(&terminated, fuzzer)) |
1602 return false; | 1596 return false; |
1603 | 1597 |
1604 ui::LatencyInfo latency(trace_id, terminated); | 1598 ui::LatencyInfo latency(trace_id, terminated); |
1605 for (size_t i = 0; i < input_coordinates_size; i++) { | |
1606 latency.AddInputCoordinate(input_coordinates[i]); | |
1607 } | |
1608 *p = latency; | 1599 *p = latency; |
1609 | 1600 |
1610 return true; | 1601 return true; |
1611 } | 1602 } |
1612 }; | 1603 }; |
1613 | 1604 |
1614 template <> | 1605 template <> |
1615 struct FuzzTraits<url::Origin> { | 1606 struct FuzzTraits<url::Origin> { |
1616 static bool Fuzz(url::Origin* p, Fuzzer* fuzzer) { | 1607 static bool Fuzz(url::Origin* p, Fuzzer* fuzzer) { |
1617 std::string scheme = p->scheme(); | 1608 std::string scheme = p->scheme(); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1823 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h" | 1814 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h" |
1824 #undef IPC_MESSAGE_DECL | 1815 #undef IPC_MESSAGE_DECL |
1825 #define IPC_MESSAGE_DECL(name, ...) \ | 1816 #define IPC_MESSAGE_DECL(name, ...) \ |
1826 (*map)[static_cast<uint32_t>(name::ID)] = FuzzerHelper<name>::Fuzz; | 1817 (*map)[static_cast<uint32_t>(name::ID)] = FuzzerHelper<name>::Fuzz; |
1827 | 1818 |
1828 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map) { | 1819 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map) { |
1829 #include "tools/ipc_fuzzer/message_lib/all_messages.h" | 1820 #include "tools/ipc_fuzzer/message_lib/all_messages.h" |
1830 } | 1821 } |
1831 | 1822 |
1832 } // namespace ipc_fuzzer | 1823 } // namespace ipc_fuzzer |
OLD | NEW |