OLD | NEW |
1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
8 | 8 |
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 class FilePath; | 12 class FilePath; |
13 | 13 |
14 // Represents a single diagnostic test and encapsulates the common | 14 // Represents a single diagnostic test and encapsulates the common |
15 // functionality across platforms as well. | 15 // functionality across platforms as well. |
16 // It also Implements the TestInfo interface providing the storage | 16 // It also Implements the TestInfo interface providing the storage |
17 // for the outcome of the test. | 17 // for the outcome of the test. |
18 // Specific tests need (minimally) only to: | 18 // Specific tests need (minimally) only to: |
19 // 1- override ExecuteImpl() to imnplement the test. | 19 // 1- override ExecuteImpl() to implement the test. |
20 // 2- call RecordStopFailure() or RecordFailure() or RecordSuccess() | 20 // 2- call RecordStopFailure() or RecordFailure() or RecordSuccess() |
21 // at the end of the test. | 21 // at the end of the test. |
22 // 3- Optionally call observer->OnProgress() if the test is long. | 22 // 3- Optionally call observer->OnProgress() if the test is long. |
23 // 4- Optionally call observer->OnSkipped() if the test cannot be run. | 23 // 4- Optionally call observer->OnSkipped() if the test cannot be run. |
24 class DiagnosticTest : public DiagnosticsModel::TestInfo { | 24 class DiagnosticTest : public DiagnosticsModel::TestInfo { |
25 public: | 25 public: |
26 // |title| is the human readable, localized string that says that | 26 // |title| is the human readable, localized string that says that |
27 // the objective of the test is. | 27 // the objective of the test is. |
28 explicit DiagnosticTest(const string16& title); | 28 explicit DiagnosticTest(const string16& title); |
29 | 29 |
(...skipping 21 matching lines...) Expand all Loading... |
51 void RecordSuccess(const string16& additional_info) { | 51 void RecordSuccess(const string16& additional_info) { |
52 RecordOutcome(additional_info, DiagnosticsModel::TEST_OK); | 52 RecordOutcome(additional_info, DiagnosticsModel::TEST_OK); |
53 } | 53 } |
54 | 54 |
55 void RecordOutcome(const string16& additional_info, | 55 void RecordOutcome(const string16& additional_info, |
56 DiagnosticsModel::TestResult result); | 56 DiagnosticsModel::TestResult result); |
57 | 57 |
58 static FilePath GetUserDefaultProfileDir(); | 58 static FilePath GetUserDefaultProfileDir(); |
59 | 59 |
60 protected: | 60 protected: |
61 // The id needs to be overriden by derived classes and must uniquely | 61 // The id needs to be overridden by derived classes and must uniquely |
62 // identify this test so other test can refer to it. | 62 // identify this test so other test can refer to it. |
63 virtual int GetId() = 0; | 63 virtual int GetId() = 0; |
64 // Derived classes override this method do perform the actual test. | 64 // Derived classes override this method do perform the actual test. |
65 virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) = 0; | 65 virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) = 0; |
66 | 66 |
67 string16 title_; | 67 string16 title_; |
68 string16 additional_info_; | 68 string16 additional_info_; |
69 DiagnosticsModel::TestResult result_; | 69 DiagnosticsModel::TestResult result_; |
70 }; | 70 }; |
71 | 71 |
72 #endif // CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_TEST_H_ | 72 #endif // CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_TEST_H_ |
OLD | NEW |