From cc7dec210cd2a325e65eaab44e4569846de72862 Mon Sep 17 00:00:00 2001 From: "kaiwang@chromium.org" Date: Fri, 1 Mar 2013 03:53:25 +0000 Subject: Connect SparseHistogram with the rest of stats system With this CL, SparseHistogram is usable with SparseHistogram::FactoryGet. Next step is to implement a Histogram like macro and implement WriteHTMLGraph and WriteAscii to have a nice output. BUG=139612 Review URL: https://chromiumcodereview.appspot.com/12207058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185451 0039d316-1c4b-4281-b951-d872f2087c98 --- base/metrics/histogram_unittest.cc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'base/metrics/histogram_unittest.cc') diff --git a/base/metrics/histogram_unittest.cc b/base/metrics/histogram_unittest.cc index 27c0faf..b5081b6 100644 --- a/base/metrics/histogram_unittest.cc +++ b/base/metrics/histogram_unittest.cc @@ -315,21 +315,21 @@ TEST_F(HistogramTest, CorruptSampleCounts) { histogram->Add(40); scoped_ptr snapshot = histogram->SnapshotSampleVector(); - EXPECT_EQ(Histogram::NO_INCONSISTENCIES, + EXPECT_EQ(HistogramBase::NO_INCONSISTENCIES, histogram->FindCorruption(*snapshot)); EXPECT_EQ(2, snapshot->redundant_count()); EXPECT_EQ(2, snapshot->TotalCount()); snapshot->counts_[3] += 100; // Sample count won't match redundant count. - EXPECT_EQ(Histogram::COUNT_LOW_ERROR, + EXPECT_EQ(HistogramBase::COUNT_LOW_ERROR, histogram->FindCorruption(*snapshot)); snapshot->counts_[2] -= 200; - EXPECT_EQ(Histogram::COUNT_HIGH_ERROR, + EXPECT_EQ(HistogramBase::COUNT_HIGH_ERROR, histogram->FindCorruption(*snapshot)); // But we can't spot a corruption if it is compensated for. snapshot->counts_[1] += 100; - EXPECT_EQ(Histogram::NO_INCONSISTENCIES, + EXPECT_EQ(HistogramBase::NO_INCONSISTENCIES, histogram->FindCorruption(*snapshot)); } @@ -338,7 +338,7 @@ TEST_F(HistogramTest, CorruptBucketBounds) { Histogram::FactoryGet("Histogram", 1, 64, 8, HistogramBase::kNoFlags)); scoped_ptr snapshot = histogram->SnapshotSampleVector(); - EXPECT_EQ(Histogram::NO_INCONSISTENCIES, + EXPECT_EQ(HistogramBase::NO_INCONSISTENCIES, histogram->FindCorruption(*snapshot)); BucketRanges* bucket_ranges = @@ -346,8 +346,9 @@ TEST_F(HistogramTest, CorruptBucketBounds) { HistogramBase::Sample tmp = bucket_ranges->range(1); bucket_ranges->set_range(1, bucket_ranges->range(2)); bucket_ranges->set_range(2, tmp); - EXPECT_EQ(Histogram::BUCKET_ORDER_ERROR | Histogram::RANGE_CHECKSUM_ERROR, - histogram->FindCorruption(*snapshot)); + EXPECT_EQ( + HistogramBase::BUCKET_ORDER_ERROR | HistogramBase::RANGE_CHECKSUM_ERROR, + histogram->FindCorruption(*snapshot)); bucket_ranges->set_range(2, bucket_ranges->range(1)); bucket_ranges->set_range(1, tmp); @@ -355,11 +356,11 @@ TEST_F(HistogramTest, CorruptBucketBounds) { // Show that two simple changes don't offset each other bucket_ranges->set_range(3, bucket_ranges->range(3) + 1); - EXPECT_EQ(Histogram::RANGE_CHECKSUM_ERROR, + EXPECT_EQ(HistogramBase::RANGE_CHECKSUM_ERROR, histogram->FindCorruption(*snapshot)); bucket_ranges->set_range(4, bucket_ranges->range(4) - 1); - EXPECT_EQ(Histogram::RANGE_CHECKSUM_ERROR, + EXPECT_EQ(HistogramBase::RANGE_CHECKSUM_ERROR, histogram->FindCorruption(*snapshot)); // Repair histogram so that destructor won't DCHECK(). -- cgit v1.1