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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
| 9 #include <memory> |
9 #include <sstream> | 10 #include <sstream> |
10 #include <string> | 11 #include <string> |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
14 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
15 #include "base/json/json_reader.h" | 16 #include "base/json/json_reader.h" |
16 #include "base/memory/scoped_ptr.h" | |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
18 #include "base/values.h" | 18 #include "base/values.h" |
19 #include "net/base/address_list.h" | 19 #include "net/base/address_list.h" |
20 #include "net/base/io_buffer.h" | 20 #include "net/base/io_buffer.h" |
21 #include "net/base/ip_endpoint.h" | 21 #include "net/base/ip_endpoint.h" |
22 #include "net/dns/dns_protocol.h" | 22 #include "net/dns/dns_protocol.h" |
23 #include "net/dns/dns_query.h" | 23 #include "net/dns/dns_query.h" |
24 #include "net/dns/dns_response.h" | 24 #include "net/dns/dns_response.h" |
25 #include "net/dns/dns_util.h" | 25 #include "net/dns/dns_util.h" |
26 | 26 |
(...skipping 28 matching lines...) Expand all Loading... |
55 std::vector<char>* resp_buf, | 55 std::vector<char>* resp_buf, |
56 bool* crash_test) { | 56 bool* crash_test) { |
57 base::FilePath filepath = base::FilePath::FromUTF8Unsafe(filename); | 57 base::FilePath filepath = base::FilePath::FromUTF8Unsafe(filename); |
58 | 58 |
59 std::string json; | 59 std::string json; |
60 if (!base::ReadFileToString(filepath, &json)) { | 60 if (!base::ReadFileToString(filepath, &json)) { |
61 LOG(ERROR) << filename << ": couldn't read file."; | 61 LOG(ERROR) << filename << ": couldn't read file."; |
62 return false; | 62 return false; |
63 } | 63 } |
64 | 64 |
65 scoped_ptr<base::Value> value = base::JSONReader::Read(json); | 65 std::unique_ptr<base::Value> value = base::JSONReader::Read(json); |
66 if (!value.get()) { | 66 if (!value.get()) { |
67 LOG(ERROR) << filename << ": couldn't parse JSON."; | 67 LOG(ERROR) << filename << ": couldn't parse JSON."; |
68 return false; | 68 return false; |
69 } | 69 } |
70 | 70 |
71 base::DictionaryValue* dict; | 71 base::DictionaryValue* dict; |
72 if (!value->GetAsDictionary(&dict)) { | 72 if (!value->GetAsDictionary(&dict)) { |
73 LOG(ERROR) << filename << ": test case is not a dictionary."; | 73 LOG(ERROR) << filename << ": test case is not a dictionary."; |
74 return false; | 74 return false; |
75 } | 75 } |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 if (!ReadAndRunTestCase(argv[i])) | 212 if (!ReadAndRunTestCase(argv[i])) |
213 ret = 2; | 213 ret = 2; |
214 | 214 |
215 // Cluster-Fuzz likes "#EOF" as the last line of output to help distinguish | 215 // Cluster-Fuzz likes "#EOF" as the last line of output to help distinguish |
216 // successful runs from crashes. | 216 // successful runs from crashes. |
217 printf("#EOF\n"); | 217 printf("#EOF\n"); |
218 | 218 |
219 return ret; | 219 return ret; |
220 } | 220 } |
221 | 221 |
OLD | NEW |