OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |