| 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 "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "chrome/browser/diagnostics/diagnostics_model.h" | 10 #include "chrome/browser/diagnostics/diagnostics_model.h" |
| 11 | 11 |
| 12 namespace base { |
| 12 class FilePath; | 13 class FilePath; |
| 14 } |
| 13 | 15 |
| 14 // Represents a single diagnostic test and encapsulates the common | 16 // Represents a single diagnostic test and encapsulates the common |
| 15 // functionality across platforms as well. | 17 // functionality across platforms as well. |
| 16 // It also Implements the TestInfo interface providing the storage | 18 // It also Implements the TestInfo interface providing the storage |
| 17 // for the outcome of the test. | 19 // for the outcome of the test. |
| 18 // Specific tests need (minimally) only to: | 20 // Specific tests need (minimally) only to: |
| 19 // 1- override ExecuteImpl() to implement the test. | 21 // 1- override ExecuteImpl() to implement the test. |
| 20 // 2- call RecordStopFailure() or RecordFailure() or RecordSuccess() | 22 // 2- call RecordStopFailure() or RecordFailure() or RecordSuccess() |
| 21 // at the end of the test. | 23 // at the end of the test. |
| 22 // 3- Optionally call observer->OnProgress() if the test is long. | 24 // 3- Optionally call observer->OnProgress() if the test is long. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 48 RecordOutcome(additional_info, DiagnosticsModel::TEST_FAIL_CONTINUE); | 50 RecordOutcome(additional_info, DiagnosticsModel::TEST_FAIL_CONTINUE); |
| 49 } | 51 } |
| 50 | 52 |
| 51 void RecordSuccess(const string16& additional_info) { | 53 void RecordSuccess(const string16& additional_info) { |
| 52 RecordOutcome(additional_info, DiagnosticsModel::TEST_OK); | 54 RecordOutcome(additional_info, DiagnosticsModel::TEST_OK); |
| 53 } | 55 } |
| 54 | 56 |
| 55 void RecordOutcome(const string16& additional_info, | 57 void RecordOutcome(const string16& additional_info, |
| 56 DiagnosticsModel::TestResult result); | 58 DiagnosticsModel::TestResult result); |
| 57 | 59 |
| 58 static FilePath GetUserDefaultProfileDir(); | 60 static base::FilePath GetUserDefaultProfileDir(); |
| 59 | 61 |
| 60 protected: | 62 protected: |
| 61 // The id needs to be overridden by derived classes and must uniquely | 63 // The id needs to be overridden by derived classes and must uniquely |
| 62 // identify this test so other test can refer to it. | 64 // identify this test so other test can refer to it. |
| 63 virtual int GetId() = 0; | 65 virtual int GetId() = 0; |
| 64 // Derived classes override this method do perform the actual test. | 66 // Derived classes override this method do perform the actual test. |
| 65 virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) = 0; | 67 virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) = 0; |
| 66 | 68 |
| 67 string16 title_; | 69 string16 title_; |
| 68 string16 additional_info_; | 70 string16 additional_info_; |
| 69 DiagnosticsModel::TestResult result_; | 71 DiagnosticsModel::TestResult result_; |
| 70 }; | 72 }; |
| 71 | 73 |
| 72 #endif // CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_TEST_H_ | 74 #endif // CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_TEST_H_ |
| OLD | NEW |