OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/diagnostics/recon_diagnostics.h" | 5 #include "chrome/browser/diagnostics/recon_diagnostics.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/file_version_info.h" | 10 #include "base/file_version_info.h" |
11 #include "base/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/string_number_conversions.h" |
13 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
14 #include "base/sys_info.h" | 15 #include "base/sys_info.h" |
15 #include "base/path_service.h" | 16 #include "base/path_service.h" |
16 #include "chrome/browser/diagnostics/diagnostics_test.h" | 17 #include "chrome/browser/diagnostics/diagnostics_test.h" |
17 #include "chrome/browser/platform_util.h" | 18 #include "chrome/browser/platform_util.h" |
18 #include "chrome/common/chrome_paths.h" | 19 #include "chrome/common/chrome_paths.h" |
19 #include "chrome/common/chrome_version_info.h" | 20 #include "chrome/common/chrome_version_info.h" |
20 #include "chrome/common/json_value_serializer.h" | 21 #include "chrome/common/json_value_serializer.h" |
21 | 22 |
22 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 "Could not open file. Possibly locked by other process")); | 289 "Could not open file. Possibly locked by other process")); |
289 return true; | 290 return true; |
290 } | 291 } |
291 | 292 |
292 JSONStringValueSerializer json(json_data); | 293 JSONStringValueSerializer json(json_data); |
293 int error_code = base::JSONReader::JSON_NO_ERROR; | 294 int error_code = base::JSONReader::JSON_NO_ERROR; |
294 std::string error_message; | 295 std::string error_message; |
295 scoped_ptr<Value> json_root(json.Deserialize(&error_code, &error_message)); | 296 scoped_ptr<Value> json_root(json.Deserialize(&error_code, &error_message)); |
296 if (base::JSONReader::JSON_NO_ERROR != error_code) { | 297 if (base::JSONReader::JSON_NO_ERROR != error_code) { |
297 if (error_message.empty()) { | 298 if (error_message.empty()) { |
298 error_message = "Parse error " + IntToString(error_code); | 299 error_message = "Parse error " + base::IntToString(error_code); |
299 } | 300 } |
300 RecordFailure(UTF8ToUTF16(error_message)); | 301 RecordFailure(UTF8ToUTF16(error_message)); |
301 return true; | 302 return true; |
302 } | 303 } |
303 | 304 |
304 RecordSuccess(ASCIIToUTF16("File parsed OK")); | 305 RecordSuccess(ASCIIToUTF16("File parsed OK")); |
305 return true; | 306 return true; |
306 } | 307 } |
307 | 308 |
308 private: | 309 private: |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 path = path.Append(chrome::kBookmarksFileName); | 357 path = path.Append(chrome::kBookmarksFileName); |
357 return new JSONTest(path, ASCIIToUTF16("BookMarks JSON"), 2 * kOneMeg); | 358 return new JSONTest(path, ASCIIToUTF16("BookMarks JSON"), 2 * kOneMeg); |
358 } | 359 } |
359 | 360 |
360 DiagnosticTest* MakeLocalStateTest() { | 361 DiagnosticTest* MakeLocalStateTest() { |
361 FilePath path; | 362 FilePath path; |
362 PathService::Get(chrome::DIR_USER_DATA, &path); | 363 PathService::Get(chrome::DIR_USER_DATA, &path); |
363 path = path.Append(chrome::kLocalStateFilename); | 364 path = path.Append(chrome::kLocalStateFilename); |
364 return new JSONTest(path, ASCIIToUTF16("Local State JSON"), 50 * kOneKilo); | 365 return new JSONTest(path, ASCIIToUTF16("Local State JSON"), 50 * kOneKilo); |
365 } | 366 } |
OLD | NEW |