Index: webrtc/test/mock_voice_engine.h |
diff --git a/webrtc/test/mock_voice_engine.h b/webrtc/test/mock_voice_engine.h |
index dead2260a37625e8a55eeebd468e0d0dc8c20844..28a75f806398645bea70c838b93580675cb35219 100644 |
--- a/webrtc/test/mock_voice_engine.h |
+++ b/webrtc/test/mock_voice_engine.h |
@@ -12,6 +12,7 @@ |
#define WEBRTC_AUDIO_MOCK_VOICE_ENGINE_H_ |
#include "testing/gmock/include/gmock/gmock.h" |
+#include "webrtc/test/mock_voe_channel_proxy.h" |
#include "webrtc/voice_engine/voice_engine_impl.h" |
namespace webrtc { |
@@ -25,12 +26,26 @@ class MockVoiceEngine : public VoiceEngineImpl { |
// Increase ref count so this object isn't automatically deleted whenever |
// interfaces are Release():d. |
++_ref_count; |
+ // We add this default behavior to make the mock easier to use in tests. It |
+ // will create a NiceMock of a voe::ChannelProxy. |
+ ON_CALL(*this, ChannelProxyFactory(testing::_)) |
+ .WillByDefault( |
+ testing::Invoke([](int channel_id) { |
+ return new testing::NiceMock<MockVoEChannelProxy>(); |
+ })); |
} |
~MockVoiceEngine() override { |
// Decrease ref count before base class d-tor is called; otherwise it will |
// trigger an assertion. |
--_ref_count; |
} |
+ // Allows injecting a ChannelProxy factory. |
+ MOCK_METHOD1(ChannelProxyFactory, voe::ChannelProxy*(int channel_id)); |
+ |
+ // VoiceEngineImpl |
+ rtc::scoped_ptr<voe::ChannelProxy> GetChannelProxy(int channel_id) override { |
+ return rtc::scoped_ptr<voe::ChannelProxy>(ChannelProxyFactory(channel_id)); |
+ } |
// VoEAudioProcessing |
MOCK_METHOD2(SetNsStatus, int(bool enable, NsModes mode)); |