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

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: Fixing nit. Created 5 years, 9 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 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(4)) {
dcheng 2015/02/26 17:56:51 This doesn't seem very future proof =)
ssid 2015/02/26 20:02:34 Changed.
996 case content::SyntheticGestureParams::GestureType:: 996 case content::SyntheticGestureParams::GestureType::
997 SMOOTH_SCROLL_GESTURE: { 997 SMOOTH_SCROLL_GESTURE: {
998 content::SyntheticSmoothScrollGestureParams* params = 998 content::SyntheticSmoothScrollGestureParams* params =
999 new content::SyntheticSmoothScrollGestureParams(); 999 new content::SyntheticSmoothScrollGestureParams();
1000 if (!GenerateParam(&params->anchor, generator)) 1000 if (!GenerateParam(&params->anchor, generator))
1001 return false; 1001 return false;
1002 if (!GenerateParam(&params->distances, generator)) 1002 if (!GenerateParam(&params->distances, generator))
1003 return false; 1003 return false;
1004 if (!GenerateParam(&params->prevent_fling, generator)) 1004 if (!GenerateParam(&params->prevent_fling, generator))
1005 return false; 1005 return false;
1006 if (!GenerateParam(&params->speed_in_pixels_s, generator)) 1006 if (!GenerateParam(&params->speed_in_pixels_s, generator))
1007 return false; 1007 return false;
1008 gesture_params.reset(params); 1008 gesture_params.reset(params);
1009 break; 1009 break;
1010 } 1010 }
1011 case content::SyntheticGestureParams::GestureType::
1012 SMOOTH_MOUSE_DRAG_GESTURE: {
1013 content::SyntheticSmoothMouseDragGestureParams* params =
1014 new content::SyntheticSmoothMouseDragGestureParams();
1015 if (!GenerateParam(&params->start_point, generator))
1016 return false;
1017 if (!GenerateParam(&params->distances, generator))
1018 return false;
1019 if (!GenerateParam(&params->speed_in_pixels_s, generator))
1020 return false;
1021 gesture_params.reset(params);
1022 break;
1023 }
1011 case content::SyntheticGestureParams::GestureType::PINCH_GESTURE: { 1024 case content::SyntheticGestureParams::GestureType::PINCH_GESTURE: {
1012 content::SyntheticPinchGestureParams* params = 1025 content::SyntheticPinchGestureParams* params =
1013 new content::SyntheticPinchGestureParams(); 1026 new content::SyntheticPinchGestureParams();
1014 if (!GenerateParam(&params->scale_factor, generator)) 1027 if (!GenerateParam(&params->scale_factor, generator))
1015 return false; 1028 return false;
1016 if (!GenerateParam(&params->anchor, generator)) 1029 if (!GenerateParam(&params->anchor, generator))
1017 return false; 1030 return false;
1018 if (!GenerateParam(&params->relative_pointer_speed_in_pixels_s, 1031 if (!GenerateParam(&params->relative_pointer_speed_in_pixels_s,
1019 generator)) 1032 generator))
1020 return false; 1033 return false;
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after
2089 return EXIT_FAILURE; 2102 return EXIT_FAILURE;
2090 2103
2091 return EXIT_SUCCESS; 2104 return EXIT_SUCCESS;
2092 } 2105 }
2093 2106
2094 } // namespace ipc_fuzzer 2107 } // namespace ipc_fuzzer
2095 2108
2096 int main(int argc, char** argv) { 2109 int main(int argc, char** argv) {
2097 return ipc_fuzzer::GenerateMain(argc, argv); 2110 return ipc_fuzzer::GenerateMain(argc, argv);
2098 } 2111 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698