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

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

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.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..59355df980f082f30edf88420796deba57466e8c 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_;
estark 2017/05/05 16:21:13 initialize all to 0
meacer 2017/05/05 19:24:19 Done.
+ int failed_;
+ int successful_;
+ int dropped_;
+ 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