Chromium Code Reviews| Index: chrome/browser/search/suggestions/blacklist_store_unittest.cc |
| diff --git a/chrome/browser/search/suggestions/blacklist_store_unittest.cc b/chrome/browser/search/suggestions/blacklist_store_unittest.cc |
| index b449ccf9a7c3588e2b27c14c50cdf8ef0a65aaab..878f89d9755a46ca4a3c77b0a389442158acb440 100644 |
| --- a/chrome/browser/search/suggestions/blacklist_store_unittest.cc |
| +++ b/chrome/browser/search/suggestions/blacklist_store_unittest.cc |
| @@ -8,10 +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 "chrome/browser/search/suggestions/proto/suggestions.pb.h" |
| +#include "chrome/test/base/chrome_histogram_tester.h" |
|
Ilya Sherman
2014/07/15 03:56:35
nit: Please include the //base class rather than t
Mike Lerman
2014/07/16 17:29:03
Done.
|
| #include "components/pref_registry/testing_pref_service_syncable.h" |
| #include "content/public/test/test_browser_thread_bundle.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| @@ -123,18 +121,16 @@ TEST(BlacklistStoreTest, GetFirstUrlFromBlacklist) { |
| } |
| TEST(BlacklistStoreLogTest, LogsBlacklistSize) { |
| + base::HistogramTester histogram_tester; |
| content::TestBrowserThreadBundle bundle; |
| - base::StatisticsDeltaReader statistics_delta_reader; |
| // Create a first store - blacklist is empty at this point. |
| TestingPrefServiceSyncable prefs; |
| BlacklistStore::RegisterProfilePrefs(prefs.registry()); |
| scoped_ptr<BlacklistStore> blacklist_store(new BlacklistStore(&prefs)); |
| - 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))); |
| @@ -142,11 +138,10 @@ TEST(BlacklistStoreLogTest, LogsBlacklistSize) { |
| // Create a new BlacklistStore and verify the counts. |
| blacklist_store.reset(new BlacklistStore(&prefs)); |
| - 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); |
|
Ilya Sherman
2014/07/15 03:56:35
Hmm, it's a bit unfortunate that both the second a
Mike Lerman
2014/07/16 17:29:03
Use Objective-C? I agree, this is ugly. Can't thin
Ilya Sherman
2014/07/16 18:44:46
Hmm, that's definitely an interesting thought, wor
Mike Lerman
2014/07/16 19:36:35
Acknowledged.
|
| } |
| } // namespace suggestions |