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

Unified Diff: chrome/browser/safe_browsing/certificate_reporting_service_test_utils.cc

Issue 2862453002: Add metrics for certificate report uploads (Closed)
Patch Set: histograms.xml Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/certificate_reporting_service_test_utils.cc
diff --git a/chrome/browser/safe_browsing/certificate_reporting_service_test_utils.cc b/chrome/browser/safe_browsing/certificate_reporting_service_test_utils.cc
index f3c9d4c81f42d958541279ff02823d3c0c1454ca..be457569892b5c15b870c1a14ac68dd2b461de8d 100644
--- a/chrome/browser/safe_browsing/certificate_reporting_service_test_utils.cc
+++ b/chrome/browser/safe_browsing/certificate_reporting_service_test_utils.cc
@@ -443,4 +443,42 @@ void CertificateReportingServiceTestHelper::ExpectNoRequests(
}
}
+EventHistogramTester::EventHistogramTester() {}
+
+EventHistogramTester::~EventHistogramTester() {
+ if (submitted_) {
estark 2017/05/05 16:21:13 Do you need these conditionals? Seems like the buc
meacer 2017/05/05 19:24:19 Unfortunately yes, base::HistogramTester complains
+ histogram_tester_.ExpectBucketCount(
+ CertificateReportingService::kReportEventHistogram,
+ CertificateReportingService::REPORT_SUBMITTED, submitted_);
+ }
+ if (failed_) {
+ histogram_tester_.ExpectBucketCount(
+ CertificateReportingService::kReportEventHistogram,
+ CertificateReportingService::REPORT_FAILED, failed_);
+ }
+ if (successful_) {
+ histogram_tester_.ExpectBucketCount(
+ CertificateReportingService::kReportEventHistogram,
+ CertificateReportingService::REPORT_SUCCESSFUL, successful_);
+ }
+ if (dropped_) {
+ histogram_tester_.ExpectBucketCount(
+ CertificateReportingService::kReportEventHistogram,
+ CertificateReportingService::REPORT_DROPPED_OR_IGNORED, dropped_);
+ }
+ histogram_tester_.ExpectTotalCount(
+ CertificateReportingService::kReportEventHistogram,
+ submitted_ + failed_ + successful_ + dropped_);
+}
+
+void EventHistogramTester::SetExpectedValues(int submitted,
+ int failed,
+ int successful,
+ int dropped) {
+ submitted_ = submitted;
+ failed_ = failed;
+ successful_ = successful;
+ dropped_ = dropped;
+}
+
} // namespace certificate_reporting_test_utils

Powered by Google App Engine
This is Rietveld 408576698