xref: /aosp_15_r20/external/webrtc/api/test/mock_dtmf_sender.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright 2022 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 API_TEST_MOCK_DTMF_SENDER_H_
12 #define API_TEST_MOCK_DTMF_SENDER_H_
13 
14 #include <string>
15 
16 #include "api/dtmf_sender_interface.h"
17 #include "test/gmock.h"
18 
19 namespace webrtc {
20 
21 class MockDtmfSenderObserver : public DtmfSenderObserverInterface {
22  public:
23   MOCK_METHOD(void,
24               OnToneChange,
25               (const std::string&, const std::string&),
26               (override));
27   MOCK_METHOD(void, OnToneChange, (const std::string&), (override));
28 };
29 
30 static_assert(!std::is_abstract_v<MockDtmfSenderObserver>, "");
31 
32 class MockDtmfSender : public DtmfSenderInterface {
33  public:
Create()34   static rtc::scoped_refptr<MockDtmfSender> Create() {
35     return rtc::make_ref_counted<MockDtmfSender>();
36   }
37 
38   MOCK_METHOD(void,
39               RegisterObserver,
40               (DtmfSenderObserverInterface * observer),
41               (override));
42   MOCK_METHOD(void, UnregisterObserver, (), (override));
43   MOCK_METHOD(bool, CanInsertDtmf, (), (override));
44   MOCK_METHOD(std::string, tones, (), (const override));
45   MOCK_METHOD(int, duration, (), (const override));
46   MOCK_METHOD(int, inter_tone_gap, (), (const override));
47 
48  protected:
49   MockDtmfSender() = default;
50 };
51 
52 static_assert(!std::is_abstract_v<rtc::RefCountedObject<MockDtmfSender>>, "");
53 
54 }  // namespace webrtc
55 
56 #endif  // API_TEST_MOCK_DTMF_SENDER_H_
57