1 /* 2 * Copyright (c) 2015 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 TEST_MOCK_VOE_CHANNEL_PROXY_H_ 12 #define TEST_MOCK_VOE_CHANNEL_PROXY_H_ 13 14 #include <string> 15 16 #include "modules/rtp_rtcp/source/rtp_packet_received.h" 17 #include "test/gmock.h" 18 #include "voice_engine/channel_proxy.h" 19 20 namespace webrtc { 21 namespace test { 22 23 class MockVoEChannelProxy : public voe::ChannelProxy { 24 public: 25 // GTest doesn't like move-only types, like std::unique_ptr SetEncoder(int payload_type,std::unique_ptr<AudioEncoder> encoder)26 bool SetEncoder(int payload_type, 27 std::unique_ptr<AudioEncoder> encoder) { 28 return SetEncoderForMock(payload_type, &encoder); 29 } 30 MOCK_METHOD2(SetEncoderForMock, 31 bool(int payload_type, 32 std::unique_ptr<AudioEncoder>* encoder)); 33 MOCK_METHOD1( 34 ModifyEncoder, 35 void(rtc::FunctionView<void(std::unique_ptr<AudioEncoder>*)> modifier)); 36 MOCK_METHOD1(SetRTCPStatus, void(bool enable)); 37 MOCK_METHOD1(SetLocalSSRC, void(uint32_t ssrc)); 38 MOCK_METHOD1(SetRTCP_CNAME, void(const std::string& c_name)); 39 MOCK_METHOD2(SetNACKStatus, void(bool enable, int max_packets)); 40 MOCK_METHOD2(SetSendAudioLevelIndicationStatus, void(bool enable, int id)); 41 MOCK_METHOD2(SetReceiveAudioLevelIndicationStatus, void(bool enable, int id)); 42 MOCK_METHOD1(EnableSendTransportSequenceNumber, void(int id)); 43 MOCK_METHOD1(EnableReceiveTransportSequenceNumber, void(int id)); 44 MOCK_METHOD2(RegisterSenderCongestionControlObjects, 45 void(RtpTransportControllerSendInterface* transport, 46 RtcpBandwidthObserver* bandwidth_observer)); 47 MOCK_METHOD1(RegisterReceiverCongestionControlObjects, 48 void(PacketRouter* packet_router)); 49 MOCK_METHOD0(ResetSenderCongestionControlObjects, void()); 50 MOCK_METHOD0(ResetReceiverCongestionControlObjects, void()); 51 MOCK_CONST_METHOD0(GetRTCPStatistics, CallStatistics()); 52 MOCK_CONST_METHOD0(GetRemoteRTCPReportBlocks, std::vector<ReportBlock>()); 53 MOCK_CONST_METHOD0(GetNetworkStatistics, NetworkStatistics()); 54 MOCK_CONST_METHOD0(GetDecodingCallStatistics, AudioDecodingCallStats()); 55 MOCK_CONST_METHOD0(GetANAStatistics, ANAStats()); 56 MOCK_CONST_METHOD0(GetSpeechOutputLevel, int()); 57 MOCK_CONST_METHOD0(GetSpeechOutputLevelFullRange, int()); 58 MOCK_CONST_METHOD0(GetTotalOutputEnergy, double()); 59 MOCK_CONST_METHOD0(GetTotalOutputDuration, double()); 60 MOCK_CONST_METHOD0(GetDelayEstimate, uint32_t()); 61 MOCK_METHOD2(SetSendTelephoneEventPayloadType, bool(int payload_type, 62 int payload_frequency)); 63 MOCK_METHOD2(SendTelephoneEventOutband, bool(int event, int duration_ms)); 64 MOCK_METHOD2(SetBitrate, void(int bitrate_bps, int64_t probing_interval_ms)); 65 // TODO(solenberg): Talk the compiler into accepting this mock method: 66 // MOCK_METHOD1(SetSink, void(std::unique_ptr<AudioSinkInterface> sink)); 67 MOCK_METHOD1(SetInputMute, void(bool muted)); 68 MOCK_METHOD1(RegisterTransport, void(Transport* transport)); 69 MOCK_METHOD1(OnRtpPacket, void(const RtpPacketReceived& packet)); 70 MOCK_METHOD2(ReceivedRTCPPacket, bool(const uint8_t* packet, size_t length)); 71 MOCK_CONST_METHOD0(GetAudioDecoderFactory, 72 const rtc::scoped_refptr<AudioDecoderFactory>&()); 73 MOCK_METHOD1(SetChannelOutputVolumeScaling, void(float scaling)); 74 MOCK_METHOD1(SetRtcEventLog, void(RtcEventLog* event_log)); 75 MOCK_METHOD1(SetRtcpRttStats, void(RtcpRttStats* rtcp_rtt_stats)); 76 MOCK_METHOD2(GetAudioFrameWithInfo, 77 AudioMixer::Source::AudioFrameInfo(int sample_rate_hz, 78 AudioFrame* audio_frame)); 79 MOCK_CONST_METHOD0(PreferredSampleRate, int()); 80 MOCK_METHOD1(SetTransportOverhead, void(int transport_overhead_per_packet)); 81 MOCK_METHOD1(AssociateSendChannel, 82 void(const ChannelProxy& send_channel_proxy)); 83 MOCK_METHOD0(DisassociateSendChannel, void()); 84 MOCK_CONST_METHOD2(GetRtpRtcp, void(RtpRtcp** rtp_rtcp, 85 RtpReceiver** rtp_receiver)); 86 MOCK_CONST_METHOD0(GetPlayoutTimestamp, uint32_t()); 87 MOCK_METHOD1(SetMinimumPlayoutDelay, void(int delay_ms)); 88 MOCK_CONST_METHOD1(GetRecCodec, bool(CodecInst* codec_inst)); 89 MOCK_METHOD1(SetReceiveCodecs, 90 void(const std::map<int, SdpAudioFormat>& codecs)); 91 MOCK_METHOD1(OnTwccBasedUplinkPacketLossRate, void(float packet_loss_rate)); 92 MOCK_METHOD1(OnRecoverableUplinkPacketLossRate, 93 void(float recoverable_packet_loss_rate)); 94 MOCK_CONST_METHOD0(GetSources, std::vector<RtpSource>()); 95 }; 96 } // namespace test 97 } // namespace webrtc 98 99 #endif // TEST_MOCK_VOE_CHANNEL_PROXY_H_ 100