OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "talk/app/webrtc/peerconnectioninterface.h" | 34 #include "talk/app/webrtc/peerconnectioninterface.h" |
35 #include "webrtc/base/thread_checker.h" | 35 #include "webrtc/base/thread_checker.h" |
36 | 36 |
37 namespace webrtc { | 37 namespace webrtc { |
38 | 38 |
39 class FakeMetricsObserver : public MetricsObserverInterface { | 39 class FakeMetricsObserver : public MetricsObserverInterface { |
40 public: | 40 public: |
41 FakeMetricsObserver(); | 41 FakeMetricsObserver(); |
42 void Reset(); | 42 void Reset(); |
43 | 43 |
44 void IncrementCounter(PeerConnectionMetricsCounter type) override; | 44 void IncrementEnumCounter(PeerConnectionEnumCounterType, |
| 45 int counter, |
| 46 int counter_max) override; |
45 void AddHistogramSample(PeerConnectionMetricsName type, | 47 void AddHistogramSample(PeerConnectionMetricsName type, |
46 int value) override; | 48 int value) override; |
47 void AddHistogramSample(PeerConnectionMetricsName type, | 49 void AddHistogramSample(PeerConnectionMetricsName type, |
48 const std::string& value) override; | 50 const std::string& value) override; |
49 | 51 |
50 // Accessors to be used by the tests. | 52 // Accessors to be used by the tests. |
51 int GetCounter(PeerConnectionMetricsCounter type) const; | 53 int GetEnumCounter(PeerConnectionEnumCounterType type, int counter) const; |
52 int GetIntHistogramSample(PeerConnectionMetricsName type) const; | 54 int GetIntHistogramSample(PeerConnectionMetricsName type) const; |
53 const std::string& GetStringHistogramSample( | 55 const std::string& GetStringHistogramSample( |
54 PeerConnectionMetricsName type) const; | 56 PeerConnectionMetricsName type) const; |
55 | 57 |
56 protected: | 58 protected: |
57 ~FakeMetricsObserver() {} | 59 ~FakeMetricsObserver() {} |
58 | 60 |
59 private: | 61 private: |
60 rtc::ThreadChecker thread_checker_; | 62 rtc::ThreadChecker thread_checker_; |
61 int counters_[kPeerConnectionMetricsCounter_Max]; | 63 // This is a 2 dimension array. The first index is the enum counter type. The |
62 int int_histogram_samples_[kPeerConnectionMetricsCounter_Max]; | 64 // 2nd index is the counter of that particular enum counter type. |
| 65 std::vector<std::vector<int>> counters_; |
| 66 int int_histogram_samples_[kPeerConnectionMetricsName_Max]; |
63 std::string string_histogram_samples_[kPeerConnectionMetricsName_Max]; | 67 std::string string_histogram_samples_[kPeerConnectionMetricsName_Max]; |
64 }; | 68 }; |
65 | 69 |
66 } // namespace webrtc | 70 } // namespace webrtc |
67 | 71 |
68 #endif // TALK_APP_WEBRTC_FAKEMETRICSOBSERVER_H_ | 72 #endif // TALK_APP_WEBRTC_FAKEMETRICSOBSERVER_H_ |
OLD | NEW |