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( |
| 996 content::SyntheticGestureParams::SYNTHETIC_GESTURE_TYPE_MAX + 1)) { |
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(¶ms->anchor, generator)) | 1001 if (!GenerateParam(¶ms->anchor, generator)) |
1001 return false; | 1002 return false; |
1002 if (!GenerateParam(¶ms->distances, generator)) | 1003 if (!GenerateParam(¶ms->distances, generator)) |
1003 return false; | 1004 return false; |
1004 if (!GenerateParam(¶ms->prevent_fling, generator)) | 1005 if (!GenerateParam(¶ms->prevent_fling, generator)) |
1005 return false; | 1006 return false; |
1006 if (!GenerateParam(¶ms->speed_in_pixels_s, generator)) | 1007 if (!GenerateParam(¶ms->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(¶ms->start_point, generator)) |
| 1017 return false; |
| 1018 if (!GenerateParam(¶ms->distances, generator)) |
| 1019 return false; |
| 1020 if (!GenerateParam(¶ms->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(¶ms->scale_factor, generator)) | 1028 if (!GenerateParam(¶ms->scale_factor, generator)) |
1015 return false; | 1029 return false; |
1016 if (!GenerateParam(¶ms->anchor, generator)) | 1030 if (!GenerateParam(¶ms->anchor, generator)) |
1017 return false; | 1031 return false; |
1018 if (!GenerateParam(¶ms->relative_pointer_speed_in_pixels_s, | 1032 if (!GenerateParam(¶ms->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 Loading... |
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 } |
OLD | NEW |