• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef LOGGING_RTC_EVENT_LOG_FAKE_RTC_EVENT_LOG_H_
12 #define LOGGING_RTC_EVENT_LOG_FAKE_RTC_EVENT_LOG_H_
13 
14 #include <map>
15 #include <memory>
16 
17 #include "api/rtc_event_log/rtc_event.h"
18 #include "api/rtc_event_log/rtc_event_log.h"
19 #include "rtc_base/async_invoker.h"
20 #include "rtc_base/thread.h"
21 
22 namespace webrtc {
23 
24 class FakeRtcEventLog : public RtcEventLog {
25  public:
26   explicit FakeRtcEventLog(rtc::Thread* thread);
27   ~FakeRtcEventLog() override;
28   bool StartLogging(std::unique_ptr<RtcEventLogOutput> output,
29                     int64_t output_period_ms) override;
30   void StopLogging() override;
31   void Log(std::unique_ptr<RtcEvent> event) override;
GetEventCount(RtcEvent::Type event_type)32   int GetEventCount(RtcEvent::Type event_type) { return count_[event_type]; }
33 
34  private:
IncrementEventCount(RtcEvent::Type event_type)35   void IncrementEventCount(RtcEvent::Type event_type) { ++count_[event_type]; }
36   std::map<RtcEvent::Type, int> count_;
37   rtc::Thread* thread_;
38   rtc::AsyncInvoker invoker_;
39 };
40 
41 }  // namespace webrtc
42 
43 #endif  // LOGGING_RTC_EVENT_LOG_FAKE_RTC_EVENT_LOG_H_
44