| 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 #ifndef CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_TEST_H_ | 5 #ifndef CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_TEST_H_ |
| 6 #define CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_TEST_H_ | 6 #define CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_TEST_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "chrome/browser/diagnostics/diagnostics_model.h" | 9 #include "chrome/browser/diagnostics/diagnostics_model.h" |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // test is. | 32 // test is. |
| 33 DiagnosticsTest(const std::string& id, const std::string& title); | 33 DiagnosticsTest(const std::string& id, const std::string& title); |
| 34 | 34 |
| 35 virtual ~DiagnosticsTest(); | 35 virtual ~DiagnosticsTest(); |
| 36 | 36 |
| 37 // Runs the test. Returning false signals that no more tests should be run. | 37 // Runs the test. Returning false signals that no more tests should be run. |
| 38 // The actual outcome of the test should be set using the RecordXX functions. | 38 // The actual outcome of the test should be set using the RecordXX functions. |
| 39 bool Execute(DiagnosticsModel::Observer* observer, DiagnosticsModel* model, | 39 bool Execute(DiagnosticsModel::Observer* observer, DiagnosticsModel* model, |
| 40 size_t index); | 40 size_t index); |
| 41 | 41 |
| 42 // Runs any recovery steps for the test. Returning false signals that no more |
| 43 // recovery should be attempted. |
| 44 bool Recover(DiagnosticsModel::Observer* observer, DiagnosticsModel* model, |
| 45 size_t index); |
| 46 |
| 42 void RecordStopFailure(int outcome_code, const std::string& additional_info) { | 47 void RecordStopFailure(int outcome_code, const std::string& additional_info) { |
| 43 RecordOutcome( | 48 RecordOutcome( |
| 44 outcome_code, additional_info, DiagnosticsModel::TEST_FAIL_STOP); | 49 outcome_code, additional_info, DiagnosticsModel::TEST_FAIL_STOP); |
| 45 } | 50 } |
| 46 | 51 |
| 47 void RecordFailure(int outcome_code, const std::string& additional_info) { | 52 void RecordFailure(int outcome_code, const std::string& additional_info) { |
| 48 RecordOutcome( | 53 RecordOutcome( |
| 49 outcome_code, additional_info, DiagnosticsModel::TEST_FAIL_CONTINUE); | 54 outcome_code, additional_info, DiagnosticsModel::TEST_FAIL_CONTINUE); |
| 50 } | 55 } |
| 51 | 56 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 64 virtual std::string GetTitle() const OVERRIDE; | 69 virtual std::string GetTitle() const OVERRIDE; |
| 65 virtual DiagnosticsModel::TestResult GetResult() const OVERRIDE; | 70 virtual DiagnosticsModel::TestResult GetResult() const OVERRIDE; |
| 66 virtual std::string GetAdditionalInfo() const OVERRIDE; | 71 virtual std::string GetAdditionalInfo() const OVERRIDE; |
| 67 virtual int GetOutcomeCode() const OVERRIDE; | 72 virtual int GetOutcomeCode() const OVERRIDE; |
| 68 virtual base::Time GetStartTime() const OVERRIDE; | 73 virtual base::Time GetStartTime() const OVERRIDE; |
| 69 virtual base::Time GetEndTime() const OVERRIDE; | 74 virtual base::Time GetEndTime() const OVERRIDE; |
| 70 protected: | 75 protected: |
| 71 // Derived classes override this method do perform the actual test. | 76 // Derived classes override this method do perform the actual test. |
| 72 virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) = 0; | 77 virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) = 0; |
| 73 | 78 |
| 79 // Derived classes may override this method to perform a recovery, if recovery |
| 80 // makes sense for the diagnostics test. |
| 81 virtual bool RecoveryImpl(DiagnosticsModel::Observer* observer); |
| 82 |
| 74 const std::string id_; | 83 const std::string id_; |
| 75 const std::string title_; | 84 const std::string title_; |
| 76 std::string additional_info_; | 85 std::string additional_info_; |
| 77 int outcome_code_; | 86 int outcome_code_; |
| 78 DiagnosticsModel::TestResult result_; | 87 DiagnosticsModel::TestResult result_; |
| 79 base::Time start_time_; | 88 base::Time start_time_; |
| 80 base::Time end_time_; | 89 base::Time end_time_; |
| 81 }; | 90 }; |
| 82 | 91 |
| 83 } // namespace diagnostics | 92 } // namespace diagnostics |
| 84 #endif // CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_TEST_H_ | 93 #endif // CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_TEST_H_ |
| OLD | NEW |