• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_METRICS_H_
6 #define CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_METRICS_H_
7 
8 #include <string>
9 
10 namespace diagnostics {
11 
12 // Test IDs used to indicate in UMA stats which diagnostics fail, and also to
13 // look up string identifiers for tests. If you add an ID here, you will also
14 // need to add corresponding strings to several things in the .cc file.
15 enum DiagnosticsTestId {
16   DIAGNOSTICS_CONFLICTING_DLLS_TEST,
17   DIAGNOSTICS_DISK_SPACE_TEST,
18   DIAGNOSTICS_INSTALL_TYPE_TEST,
19   DIAGNOSTICS_JSON_BOOKMARKS_TEST,
20   DIAGNOSTICS_JSON_LOCAL_STATE_TEST,
21   DIAGNOSTICS_JSON_PREFERENCES_TEST,
22   DIAGNOSTICS_OPERATING_SYSTEM_TEST,
23   DIAGNOSTICS_PATH_DICTIONARIES_TEST,
24   DIAGNOSTICS_PATH_LOCAL_STATE_TEST,
25   DIAGNOSTICS_PATH_RESOURCES_TEST,
26   DIAGNOSTICS_PATH_USER_DATA_TEST,
27   DIAGNOSTICS_VERSION_TEST,
28   DIAGNOSTICS_SQLITE_INTEGRITY_APP_CACHE_TEST,
29   DIAGNOSTICS_SQLITE_INTEGRITY_ARCHIVED_HISTORY_TEST,
30   DIAGNOSTICS_SQLITE_INTEGRITY_COOKIE_TEST,
31   DIAGNOSTICS_SQLITE_INTEGRITY_DATABASE_TRACKER_TEST,
32   DIAGNOSTICS_SQLITE_INTEGRITY_HISTORY_TEST,
33   DIAGNOSTICS_SQLITE_INTEGRITY_NSS_CERT_TEST,
34   DIAGNOSTICS_SQLITE_INTEGRITY_NSS_KEY_TEST,
35   DIAGNOSTICS_SQLITE_INTEGRITY_THUMBNAILS_TEST,
36   DIAGNOSTICS_SQLITE_INTEGRITY_WEB_DATA_TEST,
37   // Add new entries immediately above this comment. Do not reorder or renumber
38   // the entries, as they are tied to historical enum values in the UMA stats.
39   // If you add an entry, you will need to also add an entry to kTestNameInfo,
40   // and to the TEST_CASES macro in the .cc.
41 
42   // This must always be last in the list.
43   DIAGNOSTICS_TEST_ID_COUNT
44 };
45 
46 // Enumeration of metrics for UMA recording of recovery runs.
47 enum RecoveryRunMetrics {
48   RECOVERY_NOT_RUN,
49   RECOVERY_CRASH_RUN,
50   RECOVERY_USER_RUN,
51   // Add new items above this line.
52   RECOVERY_RUN_METRICS_COUNT
53 };
54 
55 // Possible enum values for individual test metrics.
56 enum RunResultMetrics {
57   RESULT_NOT_RUN,
58   RESULT_SUCCESS,
59   RESULT_FAILURE,
60   RESULT_SKIPPED,
61   // Add new items above this line.
62   RESULT_COUNT
63 };
64 
65 // Returns the string identifier of a test |id|. It will only contain
66 // characters [A-Za-z0-9] with no spaces.
67 std::string GetTestName(DiagnosticsTestId id);
68 
69 // Returns the string description of a test |id|. This is not a localized
70 // string. It is only meant for developer consumption, because this function
71 // will be called before the localization services are initialized.
72 std::string GetTestDescription(DiagnosticsTestId id);
73 
74 // These record an UMA metric for the given test or recovery operation.
75 void RecordUMARecoveryResult(DiagnosticsTestId id, RunResultMetrics result);
76 void RecordUMATestResult(DiagnosticsTestId id, RunResultMetrics result);
77 
78 }  // namespace diagnostics
79 
80 #endif  // CHROME_BROWSER_DIAGNOSTICS_DIAGNOSTICS_METRICS_H_
81