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

Side by Side Diff: net/tools/dns_fuzz_stub/dns_fuzz_stub.cc

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « net/tools/crl_set_dump/crl_set_dump.cc ('k') | net/tools/gdig/gdig.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <sstream> 6 #include <sstream>
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 return (num >= 0) && (num <= kuint16max); 46 return (num >= 0) && (num <= kuint16max);
47 } 47 }
48 48
49 bool ReadTestCase(const char* filename, 49 bool ReadTestCase(const char* filename,
50 uint16* id, std::string* qname, uint16* qtype, 50 uint16* id, std::string* qname, uint16* qtype,
51 std::vector<char>* resp_buf, 51 std::vector<char>* resp_buf,
52 bool* crash_test) { 52 bool* crash_test) {
53 base::FilePath filepath = base::FilePath::FromUTF8Unsafe(filename); 53 base::FilePath filepath = base::FilePath::FromUTF8Unsafe(filename);
54 54
55 std::string json; 55 std::string json;
56 if (!file_util::ReadFileToString(filepath, &json)) { 56 if (!base::ReadFileToString(filepath, &json)) {
57 LOG(ERROR) << filename << ": couldn't read file."; 57 LOG(ERROR) << filename << ": couldn't read file.";
58 return false; 58 return false;
59 } 59 }
60 60
61 scoped_ptr<Value> value(base::JSONReader::Read(json)); 61 scoped_ptr<Value> value(base::JSONReader::Read(json));
62 if (!value.get()) { 62 if (!value.get()) {
63 LOG(ERROR) << filename << ": couldn't parse JSON."; 63 LOG(ERROR) << filename << ": couldn't parse JSON.";
64 return false; 64 return false;
65 } 65 }
66 66
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 if (!ReadAndRunTestCase(argv[i])) 206 if (!ReadAndRunTestCase(argv[i]))
207 ret = 2; 207 ret = 2;
208 208
209 // Cluster-Fuzz likes "#EOF" as the last line of output to help distinguish 209 // Cluster-Fuzz likes "#EOF" as the last line of output to help distinguish
210 // successful runs from crashes. 210 // successful runs from crashes.
211 printf("#EOF\n"); 211 printf("#EOF\n");
212 212
213 return ret; 213 return ret;
214 } 214 }
215 215
OLDNEW
« no previous file with comments | « net/tools/crl_set_dump/crl_set_dump.cc ('k') | net/tools/gdig/gdig.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698