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 "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/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 class ConflictingDllsTest : public DiagnosticsTest { | 48 class ConflictingDllsTest : public DiagnosticsTest { |
49 public: | 49 public: |
50 ConflictingDllsTest() | 50 ConflictingDllsTest() |
51 : DiagnosticsTest(DIAGNOSTICS_CONFLICTING_DLLS_TEST) {} | 51 : DiagnosticsTest(DIAGNOSTICS_CONFLICTING_DLLS_TEST) {} |
52 | 52 |
53 virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) OVERRIDE { | 53 virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) OVERRIDE { |
54 #if defined(OS_WIN) | 54 #if defined(OS_WIN) |
55 EnumerateModulesModel* model = EnumerateModulesModel::GetInstance(); | 55 EnumerateModulesModel* model = EnumerateModulesModel::GetInstance(); |
56 model->set_limited_mode(true); | 56 model->set_limited_mode(true); |
57 model->ScanNow(); | 57 model->ScanNow(); |
58 scoped_ptr<ListValue> list(model->GetModuleList()); | 58 scoped_ptr<base::ListValue> list(model->GetModuleList()); |
59 if (!model->confirmed_bad_modules_detected() && | 59 if (!model->confirmed_bad_modules_detected() && |
60 !model->suspected_bad_modules_detected()) { | 60 !model->suspected_bad_modules_detected()) { |
61 RecordSuccess("No conflicting modules found"); | 61 RecordSuccess("No conflicting modules found"); |
62 return true; | 62 return true; |
63 } | 63 } |
64 | 64 |
65 std::string failures = "Possibly conflicting modules:"; | 65 std::string failures = "Possibly conflicting modules:"; |
66 DictionaryValue* dictionary; | 66 base::DictionaryValue* dictionary; |
67 for (size_t i = 0; i < list->GetSize(); ++i) { | 67 for (size_t i = 0; i < list->GetSize(); ++i) { |
68 if (!list->GetDictionary(i, &dictionary)) | 68 if (!list->GetDictionary(i, &dictionary)) |
69 RecordFailure(DIAG_RECON_DICTIONARY_LOOKUP_FAILED, | 69 RecordFailure(DIAG_RECON_DICTIONARY_LOOKUP_FAILED, |
70 "Dictionary lookup failed"); | 70 "Dictionary lookup failed"); |
71 int status; | 71 int status; |
72 std::string location; | 72 std::string location; |
73 std::string name; | 73 std::string name; |
74 if (!dictionary->GetInteger("status", &status)) | 74 if (!dictionary->GetInteger("status", &status)) |
75 RecordFailure(DIAG_RECON_NO_STATUS_FIELD, "No 'status' field found"); | 75 RecordFailure(DIAG_RECON_NO_STATUS_FIELD, "No 'status' field found"); |
76 if (status < ModuleEnumerator::SUSPECTED_BAD) | 76 if (status < ModuleEnumerator::SUSPECTED_BAD) |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 std::string json_data; | 205 std::string json_data; |
206 if (!base::ReadFileToString(path_, &json_data)) { | 206 if (!base::ReadFileToString(path_, &json_data)) { |
207 RecordFailure(DIAG_RECON_UNABLE_TO_OPEN_FILE, | 207 RecordFailure(DIAG_RECON_UNABLE_TO_OPEN_FILE, |
208 "Could not open file. Possibly locked by another process"); | 208 "Could not open file. Possibly locked by another process"); |
209 return true; | 209 return true; |
210 } | 210 } |
211 | 211 |
212 JSONStringValueSerializer json(json_data); | 212 JSONStringValueSerializer json(json_data); |
213 int error_code = base::JSONReader::JSON_NO_ERROR; | 213 int error_code = base::JSONReader::JSON_NO_ERROR; |
214 std::string error_message; | 214 std::string error_message; |
215 scoped_ptr<Value> json_root(json.Deserialize(&error_code, &error_message)); | 215 scoped_ptr<base::Value> json_root( |
| 216 json.Deserialize(&error_code, &error_message)); |
216 if (base::JSONReader::JSON_NO_ERROR != error_code) { | 217 if (base::JSONReader::JSON_NO_ERROR != error_code) { |
217 if (error_message.empty()) { | 218 if (error_message.empty()) { |
218 error_message = "Parse error " + base::IntToString(error_code); | 219 error_message = "Parse error " + base::IntToString(error_code); |
219 } | 220 } |
220 RecordFailure(DIAG_RECON_PARSE_ERROR, error_message); | 221 RecordFailure(DIAG_RECON_PARSE_ERROR, error_message); |
221 return true; | 222 return true; |
222 } | 223 } |
223 | 224 |
224 RecordSuccess("File parsed OK"); | 225 RecordSuccess("File parsed OK"); |
225 return true; | 226 return true; |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 | 430 |
430 DiagnosticsTest* MakeResourcesFileTest() { | 431 DiagnosticsTest* MakeResourcesFileTest() { |
431 return new PathTest(kPathsToTest[2]); | 432 return new PathTest(kPathsToTest[2]); |
432 } | 433 } |
433 | 434 |
434 DiagnosticsTest* MakeUserDirTest() { return new PathTest(kPathsToTest[3]); } | 435 DiagnosticsTest* MakeUserDirTest() { return new PathTest(kPathsToTest[3]); } |
435 | 436 |
436 DiagnosticsTest* MakeVersionTest() { return new VersionTest(); } | 437 DiagnosticsTest* MakeVersionTest() { return new VersionTest(); } |
437 | 438 |
438 } // namespace diagnostics | 439 } // namespace diagnostics |
OLD | NEW |