Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: chrome/browser/diagnostics/diagnostics_test.cc

Issue 2886933003: Use stricter type checking in UMA_HISTOGRAM_ENUMERATION (Closed)
Patch Set: simplify type checking Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 } 52 }
53 53
54 void DiagnosticsTest::RecordOutcome(int outcome_code, 54 void DiagnosticsTest::RecordOutcome(int outcome_code,
55 const std::string& additional_info, 55 const std::string& additional_info,
56 DiagnosticsModel::TestResult result) { 56 DiagnosticsModel::TestResult result) {
57 end_time_ = base::Time::Now(); 57 end_time_ = base::Time::Now();
58 outcome_code_ = outcome_code; 58 outcome_code_ = outcome_code;
59 additional_info_ = additional_info; 59 additional_info_ = additional_info;
60 result_ = result; 60 result_ = result;
61 #if defined(OS_CHROMEOS) // Only collecting UMA stats on ChromeOS 61 #if defined(OS_CHROMEOS) // Only collecting UMA stats on ChromeOS
62 DiagnosticsTestId id = static_cast<DiagnosticsTestId>(GetId());
62 if (result_ == DiagnosticsModel::TEST_OK) { 63 if (result_ == DiagnosticsModel::TEST_OK) {
63 // Record individual test success. 64 // Record individual test success.
64 RecordUMATestResult(static_cast<DiagnosticsTestId>(GetId()), 65 RecordUMATestResult(id, RESULT_SUCCESS);
65 RESULT_SUCCESS);
66 } else if (result_ == DiagnosticsModel::TEST_FAIL_CONTINUE || 66 } else if (result_ == DiagnosticsModel::TEST_FAIL_CONTINUE ||
67 result_ == DiagnosticsModel::TEST_FAIL_STOP) { 67 result_ == DiagnosticsModel::TEST_FAIL_STOP) {
68 // Record test failure in summary histogram. 68 // Record test failure in summary histogram.
69 UMA_HISTOGRAM_ENUMERATION( 69 UMA_HISTOGRAM_ENUMERATION("Diagnostics.TestFailures", id,
70 "Diagnostics.TestFailures", GetId(), DIAGNOSTICS_TEST_ID_COUNT); 70 DIAGNOSTICS_TEST_ID_COUNT);
71 // Record individual test failure. 71 // Record individual test failure.
72 RecordUMATestResult(static_cast<DiagnosticsTestId>(GetId()), 72 RecordUMATestResult(id, RESULT_FAILURE);
73 RESULT_FAILURE);
74 } 73 }
75 #endif 74 #endif
76 } 75 }
77 76
78 // static 77 // static
79 base::FilePath DiagnosticsTest::GetUserDefaultProfileDir() { 78 base::FilePath DiagnosticsTest::GetUserDefaultProfileDir() {
80 base::FilePath path; 79 base::FilePath path;
81 if (!PathService::Get(chrome::DIR_USER_DATA, &path)) 80 if (!PathService::Get(chrome::DIR_USER_DATA, &path))
82 return base::FilePath(); 81 return base::FilePath();
83 return path.AppendASCII(chrome::kInitialProfile); 82 return path.AppendASCII(chrome::kInitialProfile);
(...skipping 19 matching lines...) Expand all
103 102
104 base::Time DiagnosticsTest::GetStartTime() const { return start_time_; } 103 base::Time DiagnosticsTest::GetStartTime() const { return start_time_; }
105 104
106 base::Time DiagnosticsTest::GetEndTime() const { return end_time_; } 105 base::Time DiagnosticsTest::GetEndTime() const { return end_time_; }
107 106
108 bool DiagnosticsTest::RecoveryImpl(DiagnosticsModel::Observer* observer) { 107 bool DiagnosticsTest::RecoveryImpl(DiagnosticsModel::Observer* observer) {
109 return true; 108 return true;
110 } 109 }
111 110
112 } // namespace diagnostics 111 } // namespace diagnostics
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/policy/upload_job_impl.cc ('k') | chrome/browser/engagement/important_sites_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698