| OLD | NEW |
| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "tools/ipc_fuzzer/mutate/mutator.h" | 11 #include "tools/ipc_fuzzer/fuzzer/mutator.h" |
| 12 #include "tools/ipc_fuzzer/mutate/rand_util.h" | 12 #include "tools/ipc_fuzzer/fuzzer/rand_util.h" |
| 13 | 13 |
| 14 namespace ipc_fuzzer { | 14 namespace ipc_fuzzer { |
| 15 | 15 |
| 16 template <typename T> | 16 template <typename T> |
| 17 void FuzzIntegralType(T* value, unsigned int frequency) { | 17 void FuzzIntegralType(T* value, unsigned int frequency) { |
| 18 if (RandEvent(frequency)) { | 18 if (RandEvent(frequency)) { |
| 19 switch (RandInRange(4)) { | 19 switch (RandInRange(4)) { |
| 20 case 0: (*value) = 0; break; | 20 case 0: (*value) = 0; break; |
| 21 case 1: (*value)--; break; | 21 case 1: (*value)--; break; |
| 22 case 2: (*value)++; break; | 22 case 2: (*value)++; break; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 FuzzData(static_cast<char*>(data), data_len); | 112 FuzzData(static_cast<char*>(data), data_len); |
| 113 } | 113 } |
| 114 | 114 |
| 115 bool Mutator::ShouldGenerate() { | 115 bool Mutator::ShouldGenerate() { |
| 116 // TODO(mbarbella): With a low probability, allow something to be fully | 116 // TODO(mbarbella): With a low probability, allow something to be fully |
| 117 // rewritten while mutating instead of always changing the existing value. | 117 // rewritten while mutating instead of always changing the existing value. |
| 118 return false; | 118 return false; |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace ipc_fuzzer | 121 } // namespace ipc_fuzzer |
| OLD | NEW |