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