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

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

Issue 2664753002: Remove base::StringValue (Closed)
Patch Set: Rebase Created 3 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/gn/desc_builder.cc ('k') | tools/json_schema_compiler/cc_generator.py » ('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 <tuple> 8 #include <tuple>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 double tmp; 523 double tmp;
524 p->GetDouble(index, &tmp); 524 p->GetDouble(index, &tmp);
525 fuzzer->FuzzDouble(&tmp); 525 fuzzer->FuzzDouble(&tmp);
526 p->Set(index, new base::Value(tmp)); 526 p->Set(index, new base::Value(tmp));
527 break; 527 break;
528 } 528 }
529 case base::Value::Type::STRING: { 529 case base::Value::Type::STRING: {
530 std::string tmp; 530 std::string tmp;
531 p->GetString(index, &tmp); 531 p->GetString(index, &tmp);
532 fuzzer->FuzzString(&tmp); 532 fuzzer->FuzzString(&tmp);
533 p->Set(index, new base::StringValue(tmp)); 533 p->Set(index, new base::Value(tmp));
534 break; 534 break;
535 } 535 }
536 case base::Value::Type::BINARY: { 536 case base::Value::Type::BINARY: {
537 char tmp[200]; 537 char tmp[200];
538 size_t bin_length = RandInRange(sizeof(tmp)); 538 size_t bin_length = RandInRange(sizeof(tmp));
539 fuzzer->FuzzData(tmp, bin_length); 539 fuzzer->FuzzData(tmp, bin_length);
540 p->Set(index, 540 p->Set(index,
541 base::BinaryValue::CreateWithCopiedBuffer(tmp, bin_length)); 541 base::BinaryValue::CreateWithCopiedBuffer(tmp, bin_length));
542 break; 542 break;
543 } 543 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 } 592 }
593 case base::Value::Type::DOUBLE: { 593 case base::Value::Type::DOUBLE: {
594 double tmp; 594 double tmp;
595 fuzzer->FuzzDouble(&tmp); 595 fuzzer->FuzzDouble(&tmp);
596 p->SetWithoutPathExpansion(property, new base::Value(tmp)); 596 p->SetWithoutPathExpansion(property, new base::Value(tmp));
597 break; 597 break;
598 } 598 }
599 case base::Value::Type::STRING: { 599 case base::Value::Type::STRING: {
600 std::string tmp; 600 std::string tmp;
601 fuzzer->FuzzString(&tmp); 601 fuzzer->FuzzString(&tmp);
602 p->SetWithoutPathExpansion(property, new base::StringValue(tmp)); 602 p->SetWithoutPathExpansion(property, new base::Value(tmp));
603 break; 603 break;
604 } 604 }
605 case base::Value::Type::BINARY: { 605 case base::Value::Type::BINARY: {
606 char tmp[200]; 606 char tmp[200];
607 size_t bin_length = RandInRange(sizeof(tmp)); 607 size_t bin_length = RandInRange(sizeof(tmp));
608 fuzzer->FuzzData(tmp, bin_length); 608 fuzzer->FuzzData(tmp, bin_length);
609 p->SetWithoutPathExpansion( 609 p->SetWithoutPathExpansion(
610 property, 610 property,
611 base::BinaryValue::CreateWithCopiedBuffer(tmp, bin_length)); 611 base::BinaryValue::CreateWithCopiedBuffer(tmp, bin_length));
612 break; 612 break;
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1823 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h" 1823 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h"
1824 #undef IPC_MESSAGE_DECL 1824 #undef IPC_MESSAGE_DECL
1825 #define IPC_MESSAGE_DECL(name, ...) \ 1825 #define IPC_MESSAGE_DECL(name, ...) \
1826 (*map)[static_cast<uint32_t>(name::ID)] = FuzzerHelper<name>::Fuzz; 1826 (*map)[static_cast<uint32_t>(name::ID)] = FuzzerHelper<name>::Fuzz;
1827 1827
1828 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map) { 1828 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map) {
1829 #include "tools/ipc_fuzzer/message_lib/all_messages.h" 1829 #include "tools/ipc_fuzzer/message_lib/all_messages.h"
1830 } 1830 }
1831 1831
1832 } // namespace ipc_fuzzer 1832 } // namespace ipc_fuzzer
OLDNEW
« no previous file with comments | « tools/gn/desc_builder.cc ('k') | tools/json_schema_compiler/cc_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698