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

Unified Diff: chrome/browser/chromeos/external_metrics_unittest.cc

Issue 379283002: Rework UMAHistogramHelper and StatisticsDeltaReader into [Chrome]HistogramTester. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 4 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/chromeos/external_metrics_unittest.cc
diff --git a/chrome/browser/chromeos/external_metrics_unittest.cc b/chrome/browser/chromeos/external_metrics_unittest.cc
index 47faa0739899e03f9192671a1173871a2ea6e98d..0dd69e416de9c323cd189ac2406d7ef0fb2fd16e 100644
--- a/chrome/browser/chromeos/external_metrics_unittest.cc
+++ b/chrome/browser/chromeos/external_metrics_unittest.cc
@@ -6,8 +6,8 @@
#include "base/files/scoped_temp_dir.h"
#include "base/memory/scoped_ptr.h"
#include "base/metrics/statistics_recorder.h"
+#include "base/test/histogram_tester.h"
#include "chrome/browser/chromeos/external_metrics.h"
-#include "chrome/test/base/uma_histogram_helper.h"
#include "components/metrics/serialization/metric_sample.h"
#include "components/metrics/serialization/serialization_utils.h"
#include "content/public/test/test_browser_thread_bundle.h"
@@ -20,8 +20,6 @@ class ExternalMetricsTest : public testing::Test {
ASSERT_TRUE(dir_.CreateUniqueTempDir());
external_metrics_ = ExternalMetrics::CreateForTesting(
dir_.path().Append("testfile").value());
-
- base::StatisticsRecorder::Initialize();
}
base::ScopedTempDir dir_;
@@ -37,6 +35,8 @@ TEST_F(ExternalMetricsTest, HandleMissingFile) {
}
TEST_F(ExternalMetricsTest, CanReceiveHistogram) {
+ base::HistogramTester histogram_tester;
+
scoped_ptr<metrics::MetricSample> hist =
metrics::MetricSample::HistogramSample("foo", 2, 1, 100, 10);
@@ -45,12 +45,12 @@ TEST_F(ExternalMetricsTest, CanReceiveHistogram) {
EXPECT_EQ(1, external_metrics_->CollectEvents());
- UMAHistogramHelper helper;
- helper.Fetch();
- helper.ExpectTotalCount("foo", 1);
+ histogram_tester.ExpectTotalCount("foo", 1);
}
TEST_F(ExternalMetricsTest, IncorrectHistogramsAreDiscarded) {
+ base::HistogramTester histogram_tester;
+
// Malformed histogram (min > max).
scoped_ptr<metrics::MetricSample> hist =
metrics::MetricSample::HistogramSample("bar", 30, 200, 20, 10);
@@ -60,9 +60,7 @@ TEST_F(ExternalMetricsTest, IncorrectHistogramsAreDiscarded) {
external_metrics_->CollectEvents();
- UMAHistogramHelper helper;
- helper.Fetch();
- helper.ExpectTotalCount("bar", 0);
+ histogram_tester.ExpectTotalCount("bar", 0);
}
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698