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

Side by Side Diff: base/test/histogram_recorder.h

Issue 18337014: Add a HistogramRecorder class and use cases. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced. Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BASE_TEST_HISTOGRAM_RECORDER_H_
6 #define BASE_TEST_HISTOGRAM_RECORDER_H_
7
8 #include <map>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "base/metrics/histogram_samples.h"
12
13 namespace base {
14
15 // This class acts as a differential reader for histogram samples, enabling
16 // tests to check that metrics were sent as they should be.
17 class HistogramRecorder {
18 public:
19 HistogramRecorder();
20 virtual ~HistogramRecorder();
21
22 // Returns the histogram data accumulated since this instance was created.
23 // Returns NULL if no samples are available.
24 scoped_ptr<HistogramSamples> GetHistogramSamplesSinceCreation(
25 const std::string& histogram_name);
26
27 private:
28 // Used to determine the histogram changes made during this instance's
29 // lifecycle.
30 std::map<std::string, HistogramSamples*> original_samples_;
31 };
32
33 } // namespace base
34
35 #endif // BASE_TEST_HISTOGRAM_RECORDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698