Index: webrtc/test/mock_voice_engine.h |
diff --git a/webrtc/test/mock_voice_engine.h b/webrtc/test/mock_voice_engine.h |
index 6b1f9cf31fabfa8976ffe922e774c4dbab336736..7655d3b8443f6253fb0d6b14d53dc671c9f4d68c 100644 |
--- a/webrtc/test/mock_voice_engine.h |
+++ b/webrtc/test/mock_voice_engine.h |
@@ -16,6 +16,7 @@ |
#include "webrtc/modules/audio_device/include/mock_audio_device.h" |
#include "webrtc/modules/audio_device/include/mock_audio_transport.h" |
#include "webrtc/modules/audio_processing/include/mock_audio_processing.h" |
+#include "webrtc/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h" |
#include "webrtc/test/gmock.h" |
#include "webrtc/test/mock_voe_channel_proxy.h" |
#include "webrtc/voice_engine/voice_engine_impl.h" |
@@ -57,6 +58,9 @@ class MockVoiceEngine : public VoiceEngineImpl { |
[](const std::map<int, SdpAudioFormat>& codecs) { |
EXPECT_THAT(codecs, testing::IsEmpty()); |
})); |
+ EXPECT_CALL(*proxy, GetRtpRtcp(testing::_, testing::_)) |
+ .WillRepeatedly( |
+ testing::SetArgPointee<0>(GetMockRtpRtcp(channel_id))); |
return proxy; |
})); |
@@ -74,6 +78,15 @@ class MockVoiceEngine : public VoiceEngineImpl { |
// trigger an assertion. |
--_ref_count; |
} |
+ |
+ // These need to be the same each call to channel_id and must not leak. |
+ MockRtpRtcp* GetMockRtpRtcp(int channel_id) { |
+ if (mock_rtp_rtcps_.find(channel_id) == mock_rtp_rtcps_.end()) { |
+ mock_rtp_rtcps_[channel_id].reset(new ::testing::NiceMock<MockRtpRtcp>); |
+ } |
+ return mock_rtp_rtcps_[channel_id].get(); |
+ } |
+ |
// Allows injecting a ChannelProxy factory. |
MOCK_METHOD1(ChannelProxyFactory, voe::ChannelProxy*(int channel_id)); |
@@ -241,6 +254,8 @@ class MockVoiceEngine : public VoiceEngineImpl { |
// voe::Channel does. |
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; |
+ std::map<int, std::unique_ptr<MockRtpRtcp>> mock_rtp_rtcps_; |
+ |
MockAudioDeviceModule mock_audio_device_; |
MockAudioProcessing mock_audio_processing_; |
MockAudioTransport mock_audio_transport_; |