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

Side by Side Diff: webrtc/test/mock_voice_engine.h

Issue 2461523002: Remove usage of VoEBase::AssociateSendChannel() from WVoMC. (Closed)
Patch Set: rebase Created 4 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 unified diff | Download patch
« no previous file with comments | « webrtc/test/mock_voe_channel_proxy.h ('k') | webrtc/voice_engine/channel.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 18 matching lines...) Expand all
29 // warnings from -Winconsistent-missing-override. See 29 // warnings from -Winconsistent-missing-override. See
30 // http://crbug.com/428099. 30 // http://crbug.com/428099.
31 MockVoiceEngine( 31 MockVoiceEngine(
32 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory = nullptr) 32 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory = nullptr)
33 : decoder_factory_(decoder_factory) { 33 : decoder_factory_(decoder_factory) {
34 // Increase ref count so this object isn't automatically deleted whenever 34 // Increase ref count so this object isn't automatically deleted whenever
35 // interfaces are Release():d. 35 // interfaces are Release():d.
36 ++_ref_count; 36 ++_ref_count;
37 // We add this default behavior to make the mock easier to use in tests. It 37 // We add this default behavior to make the mock easier to use in tests. It
38 // will create a NiceMock of a voe::ChannelProxy. 38 // will create a NiceMock of a voe::ChannelProxy.
39 // TODO(ossu): As long as AudioReceiveStream is implmented as a wrapper 39 // TODO(ossu): As long as AudioReceiveStream is implemented as a wrapper
40 // around Channel, we need to make sure ChannelProxy returns the same 40 // around Channel, we need to make sure ChannelProxy returns the same
41 // decoder factory as the one passed in when creating an AudioReceiveStream. 41 // decoder factory as the one passed in when creating an AudioReceiveStream.
42 ON_CALL(*this, ChannelProxyFactory(testing::_)) 42 ON_CALL(*this, ChannelProxyFactory(testing::_))
43 .WillByDefault(testing::Invoke([this](int channel_id) { 43 .WillByDefault(testing::Invoke([this](int channel_id) {
44 auto* proxy = 44 auto* proxy =
45 new testing::NiceMock<webrtc::test::MockVoEChannelProxy>(); 45 new testing::NiceMock<webrtc::test::MockVoEChannelProxy>();
46 EXPECT_CALL(*proxy, GetAudioDecoderFactory()) 46 EXPECT_CALL(*proxy, GetAudioDecoderFactory())
47 .WillRepeatedly(testing::ReturnRef(decoder_factory_)); 47 .WillRepeatedly(testing::ReturnRef(decoder_factory_));
48 return proxy; 48 return proxy;
49 })); 49 }));
50 } 50 }
51 ~MockVoiceEngine() /* override */ { 51 virtual ~MockVoiceEngine() /* override */ {
52 // Decrease ref count before base class d-tor is called; otherwise it will 52 // Decrease ref count before base class d-tor is called; otherwise it will
53 // trigger an assertion. 53 // trigger an assertion.
54 --_ref_count; 54 --_ref_count;
55 } 55 }
56 // Allows injecting a ChannelProxy factory. 56 // Allows injecting a ChannelProxy factory.
57 MOCK_METHOD1(ChannelProxyFactory, voe::ChannelProxy*(int channel_id)); 57 MOCK_METHOD1(ChannelProxyFactory, voe::ChannelProxy*(int channel_id));
58 58
59 // VoiceEngineImpl 59 // VoiceEngineImpl
60 std::unique_ptr<voe::ChannelProxy> GetChannelProxy( 60 virtual std::unique_ptr<voe::ChannelProxy> GetChannelProxy(
61 int channel_id) /* override */ { 61 int channel_id) /* override */ {
62 return std::unique_ptr<voe::ChannelProxy>(ChannelProxyFactory(channel_id)); 62 return std::unique_ptr<voe::ChannelProxy>(ChannelProxyFactory(channel_id));
63 } 63 }
64 64
65 // VoEAudioProcessing 65 // VoEAudioProcessing
66 MOCK_METHOD2(SetNsStatus, int(bool enable, NsModes mode)); 66 MOCK_METHOD2(SetNsStatus, int(bool enable, NsModes mode));
67 MOCK_METHOD2(GetNsStatus, int(bool& enabled, NsModes& mode)); 67 MOCK_METHOD2(GetNsStatus, int(bool& enabled, NsModes& mode));
68 MOCK_METHOD2(SetAgcStatus, int(bool enable, AgcModes mode)); 68 MOCK_METHOD2(SetAgcStatus, int(bool enable, AgcModes mode));
69 MOCK_METHOD2(GetAgcStatus, int(bool& enabled, AgcModes& mode)); 69 MOCK_METHOD2(GetAgcStatus, int(bool& enabled, AgcModes& mode));
70 MOCK_METHOD1(SetAgcConfig, int(AgcConfig config)); 70 MOCK_METHOD1(SetAgcConfig, int(AgcConfig config));
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 // functor implementing the default version of ChannelProxyFactory, above. 328 // functor implementing the default version of ChannelProxyFactory, above.
329 // GMock creates an unfortunate copy of the functor, which would cause us to 329 // GMock creates an unfortunate copy of the functor, which would cause us to
330 // return a dangling reference. Fortunately, this should go away once 330 // return a dangling reference. Fortunately, this should go away once
331 // voe::Channel does. 331 // voe::Channel does.
332 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; 332 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_;
333 }; 333 };
334 } // namespace test 334 } // namespace test
335 } // namespace webrtc 335 } // namespace webrtc
336 336
337 #endif // WEBRTC_AUDIO_MOCK_VOICE_ENGINE_H_ 337 #endif // WEBRTC_AUDIO_MOCK_VOICE_ENGINE_H_
OLDNEW
« no previous file with comments | « webrtc/test/mock_voe_channel_proxy.h ('k') | webrtc/voice_engine/channel.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698