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

Unified Diff: base/test/statistics_delta_reader.h

Issue 120753002: Add a StatisticsDeltaReader class and use cases (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove SetUpTestCase in StatisticsDeltaReader unit tests. Created 6 years, 12 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: base/test/statistics_delta_reader.h
diff --git a/base/test/statistics_delta_reader.h b/base/test/statistics_delta_reader.h
new file mode 100644
index 0000000000000000000000000000000000000000..6405fc09537744198a504cf91d6cf61c57574799
--- /dev/null
+++ b/base/test/statistics_delta_reader.h
@@ -0,0 +1,41 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_TEST_STATISTICS_DELTA_READER_H_
+#define BASE_TEST_STATISTICS_DELTA_READER_H_
+
+#include <map>
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/metrics/histogram_samples.h"
+
+namespace base {
+
+// This class acts as a differential reader for histogram samples, enabling
+// tests to check that metrics were recorded as they should be.
+// Before using this class, StatisticsRecoder must be initialized.
+class StatisticsDeltaReader {
+ public:
+ StatisticsDeltaReader();
+ ~StatisticsDeltaReader();
+
+ // Returns the histogram data accumulated since this instance was created.
+ // Returns NULL if no samples are available.
+ scoped_ptr<HistogramSamples> GetHistogramSamplesSinceCreation(
+ const std::string& histogram_name);
+
+ private:
+ // Used to determine the histogram changes made during this instance's
+ // lifecycle. This isntance takes ownership of the samples, which are deleted
Ilya Sherman 2014/01/06 23:31:35 nit: "isntance" -> "instance"
lpromero 2014/01/07 10:20:02 Done.
+ // when the instance is destroyed.
+ std::map<std::string, HistogramSamples*> original_samples_;
+
+ DISALLOW_COPY_AND_ASSIGN(StatisticsDeltaReader);
+};
+
+} // namespace base
+
+#endif // BASE_TEST_STATISTICS_DELTA_READER_H_

Powered by Google App Engine
This is Rietveld 408576698