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

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

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

Powered by Google App Engine
This is Rietveld 408576698