diff options
author | mlerman@chromium.org <mlerman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-21 22:00:38 +0000 |
---|---|---|
committer | mlerman@chromium.org <mlerman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-21 22:02:32 +0000 |
commit | e7e9c86c60b24fbd53aa567ba423531486447f65 (patch) | |
tree | 65b96425ea8667953e2794ae38a9a2b157786bd4 /components/suggestions | |
parent | 46ad8a9eca18c09dea5055b30f6552331e13de59 (diff) | |
download | chromium_src-e7e9c86c60b24fbd53aa567ba423531486447f65.zip chromium_src-e7e9c86c60b24fbd53aa567ba423531486447f65.tar.gz chromium_src-e7e9c86c60b24fbd53aa567ba423531486447f65.tar.bz2 |
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
Diffstat (limited to 'components/suggestions')
-rw-r--r-- | components/suggestions/blacklist_store_unittest.cc | 24 |
1 files changed, 10 insertions, 14 deletions
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 |