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

Unified Diff: chrome/browser/extensions/api/metrics_private/metrics_apitest.cc

Issue 141393002: Return a NULL histogram pointer on construction error (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move some impl to cc Created 6 years, 11 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/extensions/api/metrics_private/metrics_apitest.cc
diff --git a/chrome/browser/extensions/api/metrics_private/metrics_apitest.cc b/chrome/browser/extensions/api/metrics_private/metrics_apitest.cc
index 86eb577a59196b81c93154eaf89706accf07d150..f6ae17112256cded895f22d2b5a50df9b5b33a04 100644
--- a/chrome/browser/extensions/api/metrics_private/metrics_apitest.cc
+++ b/chrome/browser/extensions/api/metrics_private/metrics_apitest.cc
@@ -33,16 +33,19 @@ struct RecordedHistogram {
int min;
int max;
size_t buckets;
+ int count;
} g_histograms[] = {
- {"test.h.1", base::HISTOGRAM, 1, 100, 50}, // custom
- {"test.h.2", base::LINEAR_HISTOGRAM, 1, 200, 50}, // custom
- {"test.h.3", base::LINEAR_HISTOGRAM, 1, 101, 102}, // percentage
- {"test.time", base::HISTOGRAM, 1, 10000, 50},
- {"test.medium.time", base::HISTOGRAM, 1, 180000, 50},
- {"test.long.time", base::HISTOGRAM, 1, 3600000, 50},
- {"test.count", base::HISTOGRAM, 1, 1000000, 50},
- {"test.medium.count", base::HISTOGRAM, 1, 10000, 50},
- {"test.small.count", base::HISTOGRAM, 1, 100, 50},
+ {"test.h.1", base::HISTOGRAM, 1, 100, 50, 1}, // custom
+ {"test.h.2", base::LINEAR_HISTOGRAM, 1, 200, 50, 1}, // custom
+ {"test.h.3", base::LINEAR_HISTOGRAM, 1, 101, 102, 2}, // percentage
+ {"test.time", base::HISTOGRAM, 1, 10000, 50, 1},
+ {"test.medium.time", base::HISTOGRAM, 1, 180000, 50, 1},
+ {"test.long.time", base::HISTOGRAM, 1, 3600000, 50, 1},
+ {"test.count", base::HISTOGRAM, 1, 1000000, 50, 1},
+ {"test.medium.count", base::HISTOGRAM, 1, 10000, 50, 1},
+ {"test.small.count", base::HISTOGRAM, 1, 100, 50, 1},
+ {"test.bucketchange.linear", base::LINEAR_HISTOGRAM, 1, 100, 10, 2},
Alexei Svitkine (slow) 2014/01/17 15:40:13 Can you also add tests for this to histogram_unitt
elijahtaylor1 2014/01/17 20:04:16 Done.
+ {"test.bucketchange.log", base::HISTOGRAM, 1, 100, 10, 2},
};
// This class observes and collects user action notifications that are sent
@@ -116,6 +119,10 @@ void ValidateHistograms(const RecordedHistogram* recorded,
EXPECT_EQ(r.type, histogram->GetHistogramType());
EXPECT_TRUE(
histogram->HasConstructionArguments(r.min, r.max, r.buckets));
+ scoped_ptr<base::HistogramSamples> snapshot =
+ histogram->SnapshotSamples();
+ base::HistogramBase::Count sample_count = snapshot->TotalCount();
+ EXPECT_EQ(sample_count, r.count);
break;
}
}

Powered by Google App Engine
This is Rietveld 408576698