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

Side by Side Diff: tools/ipc_fuzzer/mutate/generate.cc

Issue 942133002: Adding synthetic touch/mouse drag [Part2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mousedrag
Patch Set: Addredded comments. Created 5 years, 10 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
« no previous file with comments | « content/renderer/gpu/gpu_benchmarking_extension.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iostream> 8 #include <iostream>
9 #include <ostream> 9 #include <ostream>
10 #include <set> 10 #include <set>
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 *p = content::PageState::CreateFromEncodedData(junk); 985 *p = content::PageState::CreateFromEncodedData(junk);
986 return true; 986 return true;
987 } 987 }
988 }; 988 };
989 989
990 template <> 990 template <>
991 struct GenerateTraits<content::SyntheticGesturePacket> { 991 struct GenerateTraits<content::SyntheticGesturePacket> {
992 static bool Generate(content::SyntheticGesturePacket* p, 992 static bool Generate(content::SyntheticGesturePacket* p,
993 Generator* generator) { 993 Generator* generator) {
994 scoped_ptr<content::SyntheticGestureParams> gesture_params; 994 scoped_ptr<content::SyntheticGestureParams> gesture_params;
995 switch (RandInRange(3)) { 995 switch (RandInRange(
996 content::SyntheticGestureParams::SYNTHETIC_GESTURE_TYPE_MAX)) {
dcheng 2015/02/27 15:48:39 Actually, doesn't this come out to 3, rather than
ssid 2015/03/02 11:57:01 Yes, thanks for pointing out. Changed.
996 case content::SyntheticGestureParams::GestureType:: 997 case content::SyntheticGestureParams::GestureType::
997 SMOOTH_SCROLL_GESTURE: { 998 SMOOTH_SCROLL_GESTURE: {
998 content::SyntheticSmoothScrollGestureParams* params = 999 content::SyntheticSmoothScrollGestureParams* params =
999 new content::SyntheticSmoothScrollGestureParams(); 1000 new content::SyntheticSmoothScrollGestureParams();
1000 if (!GenerateParam(&params->anchor, generator)) 1001 if (!GenerateParam(&params->anchor, generator))
1001 return false; 1002 return false;
1002 if (!GenerateParam(&params->distances, generator)) 1003 if (!GenerateParam(&params->distances, generator))
1003 return false; 1004 return false;
1004 if (!GenerateParam(&params->prevent_fling, generator)) 1005 if (!GenerateParam(&params->prevent_fling, generator))
1005 return false; 1006 return false;
1006 if (!GenerateParam(&params->speed_in_pixels_s, generator)) 1007 if (!GenerateParam(&params->speed_in_pixels_s, generator))
1007 return false; 1008 return false;
1008 gesture_params.reset(params); 1009 gesture_params.reset(params);
1009 break; 1010 break;
1010 } 1011 }
1012 case content::SyntheticGestureParams::GestureType::
1013 SMOOTH_MOUSE_DRAG_GESTURE: {
1014 content::SyntheticSmoothMouseDragGestureParams* params =
1015 new content::SyntheticSmoothMouseDragGestureParams();
1016 if (!GenerateParam(&params->start_point, generator))
1017 return false;
1018 if (!GenerateParam(&params->distances, generator))
1019 return false;
1020 if (!GenerateParam(&params->speed_in_pixels_s, generator))
1021 return false;
1022 gesture_params.reset(params);
1023 break;
1024 }
1011 case content::SyntheticGestureParams::GestureType::PINCH_GESTURE: { 1025 case content::SyntheticGestureParams::GestureType::PINCH_GESTURE: {
1012 content::SyntheticPinchGestureParams* params = 1026 content::SyntheticPinchGestureParams* params =
1013 new content::SyntheticPinchGestureParams(); 1027 new content::SyntheticPinchGestureParams();
1014 if (!GenerateParam(&params->scale_factor, generator)) 1028 if (!GenerateParam(&params->scale_factor, generator))
1015 return false; 1029 return false;
1016 if (!GenerateParam(&params->anchor, generator)) 1030 if (!GenerateParam(&params->anchor, generator))
1017 return false; 1031 return false;
1018 if (!GenerateParam(&params->relative_pointer_speed_in_pixels_s, 1032 if (!GenerateParam(&params->relative_pointer_speed_in_pixels_s,
1019 generator)) 1033 generator))
1020 return false; 1034 return false;
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
2089 return EXIT_FAILURE; 2103 return EXIT_FAILURE;
2090 2104
2091 return EXIT_SUCCESS; 2105 return EXIT_SUCCESS;
2092 } 2106 }
2093 2107
2094 } // namespace ipc_fuzzer 2108 } // namespace ipc_fuzzer
2095 2109
2096 int main(int argc, char** argv) { 2110 int main(int argc, char** argv) {
2097 return ipc_fuzzer::GenerateMain(argc, argv); 2111 return ipc_fuzzer::GenerateMain(argc, argv);
2098 } 2112 }
OLDNEW
« no previous file with comments | « content/renderer/gpu/gpu_benchmarking_extension.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698