OLD | NEW |
---|---|
(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( | |
Nico
2013/07/15 17:38:27
nit: I'd give a function that allocates the return
lpromero
2013/07/17 13:40:48
I see what you mean, especially with Cocoa guideli
| |
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_ | |
OLD | NEW |