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

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: rebase, git cl format 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 86eb577a59196b81c93154eaf89706accf07d150..f910a35279edd9860388eae837e309b56e313b30 100644
--- a/chrome/browser/extensions/api/metrics_private/metrics_apitest.cc
+++ b/chrome/browser/extensions/api/metrics_private/metrics_apitest.cc
@@ -33,17 +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},
+ {"test.bucketchange.log", base::HISTOGRAM, 1, 100, 10, 2}, };
// This class observes and collects user action notifications that are sent
// by the tests, so that they can be examined afterwards for correctness.
@@ -116,6 +118,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;
}
}
« no previous file with comments | « base/metrics/histogram_unittest.cc ('k') | chrome/browser/extensions/api/metrics_private/metrics_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698