| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/diagnostics_test.h" | 5 #include "chrome/browser/diagnostics/diagnostics_test.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "chrome/common/chrome_constants.h" | 9 #include "chrome/common/chrome_constants.h" |
| 10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
| 11 | 11 |
| 12 namespace diagnostics { | 12 namespace diagnostics { |
| 13 | 13 |
| 14 DiagnosticsTest::DiagnosticsTest(const std::string& id, | 14 DiagnosticsTest::DiagnosticsTest(const std::string& id, |
| 15 const std::string& title) | 15 const std::string& title) |
| 16 : id_(id), | 16 : id_(id), |
| 17 title_(title), | 17 title_(title), |
| 18 outcome_code_(-1), | 18 outcome_code_(-1), |
| 19 result_(DiagnosticsModel::TEST_NOT_RUN) {} | 19 result_(DiagnosticsModel::TEST_NOT_RUN) {} |
| 20 | 20 |
| 21 DiagnosticsTest::~DiagnosticsTest() {} | 21 DiagnosticsTest::~DiagnosticsTest() {} |
| 22 | 22 |
| 23 bool DiagnosticsTest::Execute(DiagnosticsModel::Observer* observer, | 23 bool DiagnosticsTest::Execute(DiagnosticsModel::Observer* observer, |
| 24 DiagnosticsModel* model, | 24 DiagnosticsModel* model, |
| 25 size_t index) { | 25 size_t index) { |
| 26 start_time_ = base::Time::Now(); | 26 start_time_ = base::Time::Now(); |
| 27 result_ = DiagnosticsModel::TEST_RUNNING; | 27 result_ = DiagnosticsModel::TEST_RUNNING; |
| 28 bool keep_going = ExecuteImpl(observer); | 28 bool keep_going = ExecuteImpl(observer); |
| 29 if (observer) | 29 if (observer) |
| 30 observer->OnFinished(index, model); | 30 observer->OnTestFinished(index, model); |
| 31 return keep_going; | 31 return keep_going; |
| 32 } | 32 } |
| 33 | 33 |
| 34 bool DiagnosticsTest::Recover(DiagnosticsModel::Observer* observer, |
| 35 DiagnosticsModel* model, |
| 36 size_t index) { |
| 37 result_ = DiagnosticsModel::RECOVERY_RUNNING; |
| 38 bool keep_going = RecoveryImpl(observer); |
| 39 result_ = keep_going ? DiagnosticsModel::RECOVERY_OK |
| 40 : DiagnosticsModel::RECOVERY_FAIL_STOP; |
| 41 if (observer) |
| 42 observer->OnRecoveryFinished(index, model); |
| 43 return keep_going; |
| 44 } |
| 45 |
| 34 void DiagnosticsTest::RecordOutcome(int outcome_code, | 46 void DiagnosticsTest::RecordOutcome(int outcome_code, |
| 35 const std::string& additional_info, | 47 const std::string& additional_info, |
| 36 DiagnosticsModel::TestResult result) { | 48 DiagnosticsModel::TestResult result) { |
| 37 end_time_ = base::Time::Now(); | 49 end_time_ = base::Time::Now(); |
| 38 outcome_code_ = outcome_code; | 50 outcome_code_ = outcome_code; |
| 39 additional_info_ = additional_info; | 51 additional_info_ = additional_info; |
| 40 result_ = result; | 52 result_ = result; |
| 41 } | 53 } |
| 42 | 54 |
| 43 // static | 55 // static |
| (...skipping 15 matching lines...) Expand all Loading... |
| 59 int DiagnosticsTest::GetOutcomeCode() const { return outcome_code_; } | 71 int DiagnosticsTest::GetOutcomeCode() const { return outcome_code_; } |
| 60 | 72 |
| 61 std::string DiagnosticsTest::GetAdditionalInfo() const { | 73 std::string DiagnosticsTest::GetAdditionalInfo() const { |
| 62 return additional_info_; | 74 return additional_info_; |
| 63 } | 75 } |
| 64 | 76 |
| 65 base::Time DiagnosticsTest::GetStartTime() const { return start_time_; } | 77 base::Time DiagnosticsTest::GetStartTime() const { return start_time_; } |
| 66 | 78 |
| 67 base::Time DiagnosticsTest::GetEndTime() const { return end_time_; } | 79 base::Time DiagnosticsTest::GetEndTime() const { return end_time_; } |
| 68 | 80 |
| 81 bool DiagnosticsTest::RecoveryImpl(DiagnosticsModel::Observer* observer) { |
| 82 return true; |
| 83 }; |
| 84 |
| 85 |
| 69 } // namespace diagnostics | 86 } // namespace diagnostics |
| OLD | NEW |