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

Unified Diff: base/test/histogram_tester.h

Issue 1190423006: base/test/histogram_tester.h: Add a way to query a whole family of related (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self review fixes Created 5 years, 6 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
« no previous file with comments | « no previous file | base/test/histogram_tester.cc » ('j') | base/test/histogram_tester.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/histogram_tester.h
diff --git a/base/test/histogram_tester.h b/base/test/histogram_tester.h
index 96317f98d2d33283ed09a8d3e69487312af1dd38..8178abb5806d77c6811d23d790aca2aa8216fd0a 100644
--- a/base/test/histogram_tester.h
+++ b/base/test/histogram_tester.h
@@ -47,6 +47,25 @@ class HistogramTester {
void ExpectTotalCount(const std::string& name,
base::HistogramBase::Count count) const;
+ // Finds histograms whose names start with |query|, and return a text
Ilya Sherman 2015/06/23 00:57:40 nit: "return" -> "returns"
+ // representation of any new samples added since the creation of this object.
+ // Histograms that are unchanged are omitted from the result. The return value
+ // consists of lines of the form:
+ //
+ // - "My.Statistic.Name[2]=5" (for linear, boolean, and enum histograms)
+ // - "My.Statistic.Name=5" (for other kinds of histograms)
+ //
+ // In the above example, 2 is the bucket min and 5 is the count. For nonlinear
+ // histograms, only the total across all buckets is shown, under the
+ // assumption that the inputs to nonlinear histograms -- sizes and times,
+ // commonly -- may be hard for a test to predict.
+ //
+ // This is useful for cases where the code under test is choosing among a
+ // family of related histograms and incrementing one of them. Typically you
+ // should pass the result of this function directly to EXPECT_EQ, which does a
+ // good job of formatting human-readable diffs of multi-line strings.
Ilya Sherman 2015/06/23 00:57:40 nit: You should probably mention somewhere that th
+ std::string GetTotalCountsForQuery(const std::string& query) const;
+
// Access a modified HistogramSamples containing only what has been logged
// to the histogram since the creation of this object.
scoped_ptr<HistogramSamples> GetHistogramSamplesSinceCreation(
« no previous file with comments | « no previous file | base/test/histogram_tester.cc » ('j') | base/test/histogram_tester.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698