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

Side by Side Diff: tools/ipc_fuzzer/fuzzer/mutator.cc

Issue 1025483002: Restructure the ipc_fuzzer directory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move more files around 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
« no previous file with comments | « tools/ipc_fuzzer/fuzzer/mutator.h ('k') | tools/ipc_fuzzer/fuzzer/rand_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « tools/ipc_fuzzer/fuzzer/mutator.h ('k') | tools/ipc_fuzzer/fuzzer/rand_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698