From e7e9c86c60b24fbd53aa567ba423531486447f65 Mon Sep 17 00:00:00 2001
From: "mlerman@chromium.org"
 <mlerman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Thu, 21 Aug 2014 22:00:38 +0000
Subject: Rework UMAHistogramHelper and StatisticsDeltaReader into
 [Chrome]HistogramTester.

Design Doc (Googlers Only):
https://docs.google.com/a/google.com/document/d/1RUY0BcxBppdkwFP3T8qbQmQStBRFGsLmuR4WuIXhiCA/edit

BUG=384011
TBR=timsteele@chromium.org

Review URL: https://codereview.chromium.org/379283002

Cr-Commit-Position: refs/heads/master@{#291207}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291207 0039d316-1c4b-4281-b951-d872f2087c98
---
 components/suggestions/blacklist_store_unittest.cc | 24 +++++++++-------------
 1 file changed, 10 insertions(+), 14 deletions(-)

(limited to 'components/suggestions')

diff --git a/components/suggestions/blacklist_store_unittest.cc b/components/suggestions/blacklist_store_unittest.cc
index 399875e..63d0611 100644
--- a/components/suggestions/blacklist_store_unittest.cc
+++ b/components/suggestions/blacklist_store_unittest.cc
@@ -8,9 +8,8 @@
 #include <string>
 
 #include "base/memory/scoped_ptr.h"
-#include "base/metrics/histogram_samples.h"
-#include "base/metrics/statistics_recorder.h"
-#include "base/test/statistics_delta_reader.h"
+
+#include "base/test/histogram_tester.h"
 #include "components/pref_registry/testing_pref_service_syncable.h"
 #include "components/suggestions/proto/suggestions.pb.h"
 #include "testing/gtest/include/gtest/gtest.h"
@@ -133,16 +132,14 @@ TEST_F(BlacklistStoreTest, GetFirstUrlFromBlacklist) {
 }
 
 TEST_F(BlacklistStoreTest, LogsBlacklistSize) {
-  base::StatisticsDeltaReader statistics_delta_reader;
+  base::HistogramTester histogram_tester;
 
   // Create a first store - blacklist is empty at this point.
   scoped_ptr<BlacklistStore> blacklist_store(
       new BlacklistStore(pref_service()));
-  scoped_ptr<base::HistogramSamples> samples(
-      statistics_delta_reader.GetHistogramSamplesSinceCreation(
-          "Suggestions.LocalBlacklistSize"));
-  EXPECT_EQ(1, samples->TotalCount());
-  EXPECT_EQ(1, samples->GetCount(0));
+
+  histogram_tester.ExpectTotalCount("Suggestions.LocalBlacklistSize", 1);
+  histogram_tester.ExpectUniqueSample("Suggestions.LocalBlacklistSize", 0, 1);
 
   // Add some content to the blacklist.
   EXPECT_TRUE(blacklist_store->BlacklistUrl(GURL(kTestUrlA)));
@@ -150,11 +147,10 @@ TEST_F(BlacklistStoreTest, LogsBlacklistSize) {
 
   // Create a new BlacklistStore and verify the counts.
   blacklist_store.reset(new BlacklistStore(pref_service()));
-  samples = statistics_delta_reader.GetHistogramSamplesSinceCreation(
-      "Suggestions.LocalBlacklistSize");
-  EXPECT_EQ(2, samples->TotalCount());
-  EXPECT_EQ(1, samples->GetCount(0));
-  EXPECT_EQ(1, samples->GetCount(2));
+
+  histogram_tester.ExpectTotalCount("Suggestions.LocalBlacklistSize", 2);
+  histogram_tester.ExpectBucketCount("Suggestions.LocalBlacklistSize", 0, 1);
+  histogram_tester.ExpectBucketCount("Suggestions.LocalBlacklistSize", 2, 1);
 }
 
 }  // namespace suggestions
-- 
cgit v1.1