Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: webrtc/test/mock_voice_engine.h

Issue 1459083007: Open backdoor in VoiceEngineImpl to get at the actual voe::Channel objects from an ID. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: presubmit complaints Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/test/mock_voe_channel_proxy.h ('k') | webrtc/test/webrtc_test_common.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
« no previous file with comments | « webrtc/test/mock_voe_channel_proxy.h ('k') | webrtc/test/webrtc_test_common.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698