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

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

Issue 2862453002: Add metrics for certificate report uploads (Closed)
Patch Set: Rebase and address comments 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.h
diff --git a/chrome/browser/safe_browsing/certificate_reporting_service_test_utils.h b/chrome/browser/safe_browsing/certificate_reporting_service_test_utils.h
index 4ac99fa95fa06f513f5293006ee8b6e512ef54a5..7c4d979fd9405c8a0f6f5f3a0d06421ee94d325f 100644
--- a/chrome/browser/safe_browsing/certificate_reporting_service_test_utils.h
+++ b/chrome/browser/safe_browsing/certificate_reporting_service_test_utils.h
@@ -9,6 +9,7 @@
#include "base/macros.h"
#include "base/run_loop.h"
+#include "base/test/histogram_tester.h"
#include "base/threading/non_thread_safe.h"
#include "chrome/browser/safe_browsing/certificate_reporting_service.h"
#include "content/public/test/test_browser_thread.h"
@@ -240,6 +241,28 @@ class CertificateReportingServiceTestHelper {
DISALLOW_COPY_AND_ASSIGN(CertificateReportingServiceTestHelper);
};
+// Class to test reporting events histogram for CertificateReportingService.
+// We can't use a simple HistogramTester, as we need to wait until test teardown
+// to check the histogram contents. This ensures that all in-flight requests
+// are torn down by the time we check the histograms.
+class EventHistogramTester {
+ public:
+ EventHistogramTester();
+ ~EventHistogramTester();
+
+ void SetExpectedValues(int submitted,
+ int failed,
+ int successful,
+ int dropped);
+
+ private:
+ int submitted_ = 0;
+ int failed_ = 0;
+ int successful_ = 0;
+ int dropped_ = 0;
+ base::HistogramTester histogram_tester_;
+};
+
} // namespace certificate_reporting_test_utils
#endif // CHROME_BROWSER_SAFE_BROWSING_CERTIFICATE_REPORTING_SERVICE_TEST_UTILS_H_

Powered by Google App Engine
This is Rietveld 408576698