OLD | NEW |
---|---|
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 17 matching lines...) Expand all Loading... | |
28 // methods don't use any override declarations, and we want to avoid | 28 // methods don't use any override declarations, and we want to avoid |
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. |
the sun
2016/11/09 09:41:53
How about we do the same for ADM, APM and transpor
aleloi
2016/11/09 16:37:01
Acknowledged.
| |
39 // TODO(ossu): As long as AudioReceiveStream is implmented as a wrapper | 39 // TODO(ossu): As long as AudioReceiveStream is implmented 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; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 | 104 |
105 // VoEBase | 105 // VoEBase |
106 MOCK_METHOD1(RegisterVoiceEngineObserver, int(VoiceEngineObserver& observer)); | 106 MOCK_METHOD1(RegisterVoiceEngineObserver, int(VoiceEngineObserver& observer)); |
107 MOCK_METHOD0(DeRegisterVoiceEngineObserver, int()); | 107 MOCK_METHOD0(DeRegisterVoiceEngineObserver, int()); |
108 MOCK_METHOD3( | 108 MOCK_METHOD3( |
109 Init, | 109 Init, |
110 int(AudioDeviceModule* external_adm, | 110 int(AudioDeviceModule* external_adm, |
111 AudioProcessing* audioproc, | 111 AudioProcessing* audioproc, |
112 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory)); | 112 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory)); |
113 MOCK_METHOD0(audio_processing, AudioProcessing*()); | 113 MOCK_METHOD0(audio_processing, AudioProcessing*()); |
114 MOCK_METHOD0(audio_device_module, AudioDeviceModule*()); | |
114 MOCK_METHOD0(Terminate, int()); | 115 MOCK_METHOD0(Terminate, int()); |
115 MOCK_METHOD0(CreateChannel, int()); | 116 MOCK_METHOD0(CreateChannel, int()); |
116 MOCK_METHOD1(CreateChannel, int(const ChannelConfig& config)); | 117 MOCK_METHOD1(CreateChannel, int(const ChannelConfig& config)); |
117 MOCK_METHOD1(DeleteChannel, int(int channel)); | 118 MOCK_METHOD1(DeleteChannel, int(int channel)); |
118 MOCK_METHOD1(StartReceive, int(int channel)); | 119 MOCK_METHOD1(StartReceive, int(int channel)); |
119 MOCK_METHOD1(StopReceive, int(int channel)); | 120 MOCK_METHOD1(StopReceive, int(int channel)); |
120 MOCK_METHOD1(StartPlayout, int(int channel)); | 121 MOCK_METHOD1(StartPlayout, int(int channel)); |
121 MOCK_METHOD1(StopPlayout, int(int channel)); | 122 MOCK_METHOD1(StopPlayout, int(int channel)); |
122 MOCK_METHOD1(StartSend, int(int channel)); | 123 MOCK_METHOD1(StartSend, int(int channel)); |
123 MOCK_METHOD1(StopSend, int(int channel)); | 124 MOCK_METHOD1(StopSend, int(int channel)); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
328 // functor implementing the default version of ChannelProxyFactory, above. | 329 // functor implementing the default version of ChannelProxyFactory, above. |
329 // GMock creates an unfortunate copy of the functor, which would cause us to | 330 // GMock creates an unfortunate copy of the functor, which would cause us to |
330 // return a dangling reference. Fortunately, this should go away once | 331 // return a dangling reference. Fortunately, this should go away once |
331 // voe::Channel does. | 332 // voe::Channel does. |
332 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; | 333 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; |
333 }; | 334 }; |
334 } // namespace test | 335 } // namespace test |
335 } // namespace webrtc | 336 } // namespace webrtc |
336 | 337 |
337 #endif // WEBRTC_AUDIO_MOCK_VOICE_ENGINE_H_ | 338 #endif // WEBRTC_AUDIO_MOCK_VOICE_ENGINE_H_ |
OLD | NEW |