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

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

Issue 213433003: Add Sparse Histogram Support to metricsPrivate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Typo Created 6 years, 9 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 f910a35279edd9860388eae837e309b56e313b30..8f7ec4b4bb715348af69e3d4068e61f423ea496f 100644
--- a/chrome/browser/extensions/api/metrics_private/metrics_apitest.cc
+++ b/chrome/browser/extensions/api/metrics_private/metrics_apitest.cc
@@ -38,6 +38,8 @@ struct RecordedHistogram {
{"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.sparse.1", base::SPARSE_HISTOGRAM, 0, 0, 0, 1},
+ {"test.sparse.2", base::SPARSE_HISTOGRAM, 0, 0, 0, 2},
Ilya Sherman 2014/03/26 22:02:03 Where are you testing which bucket was emitted to?
robliao 2014/03/26 22:30:50 Can't really do this as there's no way to get the
Ilya Sherman 2014/03/26 22:44:14 You're already extracting a HistogramSamples objec
{"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},
@@ -116,8 +118,13 @@ void ValidateHistograms(const RecordedHistogram* recorded,
if (r.name == histogram->histogram_name()) {
EXPECT_EQ(r.type, histogram->GetHistogramType());
- EXPECT_TRUE(
- histogram->HasConstructionArguments(r.min, r.max, r.buckets));
+ if (r.type == base::SPARSE_HISTOGRAM) {
+ EXPECT_FALSE(
+ histogram->HasConstructionArguments(r.min, r.max, r.buckets));
+ } else {
+ EXPECT_TRUE(
+ histogram->HasConstructionArguments(r.min, r.max, r.buckets));
+ }
not at google - send to devlin 2014/03/26 20:39:45 you could EXPECT_EQ(r.type == base::HISTOGRAM,
robliao 2014/03/26 21:15:43 While true, that seems to be a bit too cute for re
not at google - send to devlin 2014/03/26 21:19:35 ok. I don't think it's overly cute actually. Is th
scoped_ptr<base::HistogramSamples> snapshot =
histogram->SnapshotSamples();
base::HistogramBase::Count sample_count = snapshot->TotalCount();

Powered by Google App Engine
This is Rietveld 408576698