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

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: rebase 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
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..45e65be86d4ed72d4bc43a28688f9384e8166b06 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,6 +26,11 @@ 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 return a NiceMock of a voe::ChannelProxy.
+ ON_CALL(*this, GetChannelProxy(testing::_))
+ .WillByDefault(
+ testing::Invoke(this, &MockVoiceEngine::CreateChannelProxy));
kwiberg-webrtc 2015/11/25 10:44:59 Lambda here too?
the sun 2015/11/25 12:28:01 Done.
}
~MockVoiceEngine() override {
// Decrease ref count before base class d-tor is called; otherwise it will
@@ -32,6 +38,9 @@ class MockVoiceEngine : public VoiceEngineImpl {
--_ref_count;
}
+ // VoiceEngineImpl
+ MOCK_METHOD1(GetChannelProxy, voe::ChannelProxy*(int channel_id));
+
// VoEAudioProcessing
MOCK_METHOD2(SetNsStatus, int(bool enable, NsModes mode));
MOCK_METHOD2(GetNsStatus, int(bool& enabled, NsModes& mode));
@@ -315,6 +324,11 @@ class MockVoiceEngine : public VoiceEngineImpl {
MOCK_METHOD2(GetChannelOutputVolumeScaling, int(int channel, float& scaling));
MOCK_METHOD3(SetOutputVolumePan, int(int channel, float left, float right));
MOCK_METHOD3(GetOutputVolumePan, int(int channel, float& left, float& right));
+
+ private:
+ voe::ChannelProxy* CreateChannelProxy(int channel_id) {
+ return new testing::NiceMock<MockVoEChannelProxy>();
+ }
};
} // namespace test
} // namespace webrtc

Powered by Google App Engine
This is Rietveld 408576698