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

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

Issue 1869503004: Convert //tools to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, change iwyu fixes for converted directories to include <memory> Created 4 years, 8 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/imagediff/image_diff.cc ('k') | tools/ipc_fuzzer/message_replay/replay_process.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 <iostream> 5 #include <iostream>
6 #include <set> 6 #include <set>
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 if (!fuzzer->ShouldGenerate()) { 778 if (!fuzzer->ShouldGenerate()) {
779 for (size_t i = 0; i < p->size(); ++i) { 779 for (size_t i = 0; i < p->size(); ++i) {
780 if (!FuzzParam(p->at(i).get(), fuzzer)) 780 if (!FuzzParam(p->at(i).get(), fuzzer))
781 return false; 781 return false;
782 } 782 }
783 return true; 783 return true;
784 } 784 }
785 785
786 size_t count = RandElementCount(); 786 size_t count = RandElementCount();
787 for (size_t i = 0; i < count; ++i) { 787 for (size_t i = 0; i < count; ++i) {
788 scoped_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create(); 788 std::unique_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create();
789 if (!FuzzParam(render_pass.get(), fuzzer)) 789 if (!FuzzParam(render_pass.get(), fuzzer))
790 return false; 790 return false;
791 p->push_back(std::move(render_pass)); 791 p->push_back(std::move(render_pass));
792 } 792 }
793 return true; 793 return true;
794 } 794 }
795 }; 795 };
796 796
797 template <> 797 template <>
798 struct FuzzTraits<content::IndexedDBKey> { 798 struct FuzzTraits<content::IndexedDBKey> {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 }; 921 };
922 922
923 template <> 923 template <>
924 struct FuzzTraits<content::SyntheticGesturePacket> { 924 struct FuzzTraits<content::SyntheticGesturePacket> {
925 static bool Fuzz(content::SyntheticGesturePacket* p, 925 static bool Fuzz(content::SyntheticGesturePacket* p,
926 Fuzzer* fuzzer) { 926 Fuzzer* fuzzer) {
927 // TODO(mbarbella): Support mutation. 927 // TODO(mbarbella): Support mutation.
928 if (!fuzzer->ShouldGenerate()) 928 if (!fuzzer->ShouldGenerate())
929 return true; 929 return true;
930 930
931 scoped_ptr<content::SyntheticGestureParams> gesture_params; 931 std::unique_ptr<content::SyntheticGestureParams> gesture_params;
932 switch (RandInRange( 932 switch (RandInRange(
933 content::SyntheticGestureParams::SYNTHETIC_GESTURE_TYPE_MAX + 1)) { 933 content::SyntheticGestureParams::SYNTHETIC_GESTURE_TYPE_MAX + 1)) {
934 case content::SyntheticGestureParams::GestureType:: 934 case content::SyntheticGestureParams::GestureType::
935 SMOOTH_SCROLL_GESTURE: { 935 SMOOTH_SCROLL_GESTURE: {
936 content::SyntheticSmoothScrollGestureParams* params = 936 content::SyntheticSmoothScrollGestureParams* params =
937 new content::SyntheticSmoothScrollGestureParams(); 937 new content::SyntheticSmoothScrollGestureParams();
938 if (!FuzzParam(&params->anchor, fuzzer)) 938 if (!FuzzParam(&params->anchor, fuzzer))
939 return false; 939 return false;
940 if (!FuzzParam(&params->distances, fuzzer)) 940 if (!FuzzParam(&params->distances, fuzzer))
941 return false; 941 return false;
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after
2042 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h" 2042 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h"
2043 #undef IPC_MESSAGE_DECL 2043 #undef IPC_MESSAGE_DECL
2044 #define IPC_MESSAGE_DECL(name, ...) \ 2044 #define IPC_MESSAGE_DECL(name, ...) \
2045 (*map)[static_cast<uint32_t>(name::ID)] = FuzzerHelper<name>::Fuzz; 2045 (*map)[static_cast<uint32_t>(name::ID)] = FuzzerHelper<name>::Fuzz;
2046 2046
2047 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map) { 2047 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map) {
2048 #include "tools/ipc_fuzzer/message_lib/all_messages.h" 2048 #include "tools/ipc_fuzzer/message_lib/all_messages.h"
2049 } 2049 }
2050 2050
2051 } // namespace ipc_fuzzer 2051 } // namespace ipc_fuzzer
OLDNEW
« no previous file with comments | « tools/imagediff/image_diff.cc ('k') | tools/ipc_fuzzer/message_replay/replay_process.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698