| OLD | NEW |
| 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 Loading... |
| 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)) { |
| 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(¶ms->anchor, generator)) | 1000 if (!GenerateParam(¶ms->anchor, generator)) |
| 1001 return false; | 1001 return false; |
| 1002 if (!GenerateParam(¶ms->distances, generator)) | 1002 if (!GenerateParam(¶ms->distances, generator)) |
| 1003 return false; | 1003 return false; |
| 1004 if (!GenerateParam(¶ms->prevent_fling, generator)) | 1004 if (!GenerateParam(¶ms->prevent_fling, generator)) |
| 1005 return false; | 1005 return false; |
| 1006 if (!GenerateParam(¶ms->speed_in_pixels_s, generator)) | 1006 if (!GenerateParam(¶ms->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(¶ms->start_point, generator)) |
| 1016 return false; |
| 1017 if (!GenerateParam(¶ms->distances, generator)) |
| 1018 return false; |
| 1019 if (!GenerateParam(¶ms->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(¶ms->scale_factor, generator)) | 1027 if (!GenerateParam(¶ms->scale_factor, generator)) |
| 1015 return false; | 1028 return false; |
| 1016 if (!GenerateParam(¶ms->anchor, generator)) | 1029 if (!GenerateParam(¶ms->anchor, generator)) |
| 1017 return false; | 1030 return false; |
| 1018 if (!GenerateParam(¶ms->relative_pointer_speed_in_pixels_s, | 1031 if (!GenerateParam(¶ms->relative_pointer_speed_in_pixels_s, |
| 1019 generator)) | 1032 generator)) |
| 1020 return false; | 1033 return false; |
| (...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2064 return EXIT_FAILURE; | 2077 return EXIT_FAILURE; |
| 2065 | 2078 |
| 2066 return EXIT_SUCCESS; | 2079 return EXIT_SUCCESS; |
| 2067 } | 2080 } |
| 2068 | 2081 |
| 2069 } // namespace ipc_fuzzer | 2082 } // namespace ipc_fuzzer |
| 2070 | 2083 |
| 2071 int main(int argc, char** argv) { | 2084 int main(int argc, char** argv) { |
| 2072 return ipc_fuzzer::GenerateMain(argc, argv); | 2085 return ipc_fuzzer::GenerateMain(argc, argv); |
| 2073 } | 2086 } |
| OLD | NEW |