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 12 matching lines...) Expand all Loading... |
23 // NOTE: This class inherits from VoiceEngineImpl so that its clients will be | 23 // NOTE: This class inherits from VoiceEngineImpl so that its clients will be |
24 // able to get the various interfaces as usual, via T::GetInterface(). | 24 // able to get the various interfaces as usual, via T::GetInterface(). |
25 class MockVoiceEngine : public VoiceEngineImpl { | 25 class MockVoiceEngine : public VoiceEngineImpl { |
26 public: | 26 public: |
27 // TODO(nisse): Valid overrides commented out, because the gmock | 27 // TODO(nisse): Valid overrides commented out, because the gmock |
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 : VoiceEngineImpl(new Config(), true), | 33 : decoder_factory_(decoder_factory) { |
34 decoder_factory_(decoder_factory) { | |
35 // Increase ref count so this object isn't automatically deleted whenever | 34 // Increase ref count so this object isn't automatically deleted whenever |
36 // interfaces are Release():d. | 35 // interfaces are Release():d. |
37 ++_ref_count; | 36 ++_ref_count; |
38 // 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 |
39 // will create a NiceMock of a voe::ChannelProxy. | 38 // will create a NiceMock of a voe::ChannelProxy. |
40 // TODO(ossu): As long as AudioReceiveStream is implmented as a wrapper | 39 // TODO(ossu): As long as AudioReceiveStream is implmented as a wrapper |
41 // around Channel, we need to make sure ChannelProxy returns the same | 40 // around Channel, we need to make sure ChannelProxy returns the same |
42 // decoder factory as the one passed in when creating an AudioReceiveStream. | 41 // decoder factory as the one passed in when creating an AudioReceiveStream. |
43 ON_CALL(*this, ChannelProxyFactory(testing::_)) | 42 ON_CALL(*this, ChannelProxyFactory(testing::_)) |
44 .WillByDefault(testing::Invoke([this](int channel_id) { | 43 .WillByDefault(testing::Invoke([this](int channel_id) { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 MOCK_METHOD1(RegisterVoiceEngineObserver, int(VoiceEngineObserver& observer)); | 115 MOCK_METHOD1(RegisterVoiceEngineObserver, int(VoiceEngineObserver& observer)); |
117 MOCK_METHOD0(DeRegisterVoiceEngineObserver, int()); | 116 MOCK_METHOD0(DeRegisterVoiceEngineObserver, int()); |
118 MOCK_METHOD3( | 117 MOCK_METHOD3( |
119 Init, | 118 Init, |
120 int(AudioDeviceModule* external_adm, | 119 int(AudioDeviceModule* external_adm, |
121 AudioProcessing* audioproc, | 120 AudioProcessing* audioproc, |
122 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory)); | 121 const rtc::scoped_refptr<AudioDecoderFactory>& decoder_factory)); |
123 MOCK_METHOD0(audio_processing, AudioProcessing*()); | 122 MOCK_METHOD0(audio_processing, AudioProcessing*()); |
124 MOCK_METHOD0(Terminate, int()); | 123 MOCK_METHOD0(Terminate, int()); |
125 MOCK_METHOD0(CreateChannel, int()); | 124 MOCK_METHOD0(CreateChannel, int()); |
126 MOCK_METHOD1(CreateChannel, int(const Config& config)); | 125 MOCK_METHOD1(CreateChannel, int(const ChannelConfig& config)); |
127 MOCK_METHOD1(DeleteChannel, int(int channel)); | 126 MOCK_METHOD1(DeleteChannel, int(int channel)); |
128 MOCK_METHOD1(StartReceive, int(int channel)); | 127 MOCK_METHOD1(StartReceive, int(int channel)); |
129 MOCK_METHOD1(StopReceive, int(int channel)); | 128 MOCK_METHOD1(StopReceive, int(int channel)); |
130 MOCK_METHOD1(StartPlayout, int(int channel)); | 129 MOCK_METHOD1(StartPlayout, int(int channel)); |
131 MOCK_METHOD1(StopPlayout, int(int channel)); | 130 MOCK_METHOD1(StopPlayout, int(int channel)); |
132 MOCK_METHOD1(StartSend, int(int channel)); | 131 MOCK_METHOD1(StartSend, int(int channel)); |
133 MOCK_METHOD1(StopSend, int(int channel)); | 132 MOCK_METHOD1(StopSend, int(int channel)); |
134 MOCK_METHOD1(GetVersion, int(char version[1024])); | 133 MOCK_METHOD1(GetVersion, int(char version[1024])); |
135 MOCK_METHOD0(LastError, int()); | 134 MOCK_METHOD0(LastError, int()); |
136 MOCK_METHOD0(audio_transport, AudioTransport*()); | 135 MOCK_METHOD0(audio_transport, AudioTransport*()); |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 // functor implementing the default version of ChannelProxyFactory, above. | 337 // functor implementing the default version of ChannelProxyFactory, above. |
339 // GMock creates an unfortunate copy of the functor, which would cause us to | 338 // GMock creates an unfortunate copy of the functor, which would cause us to |
340 // return a dangling reference. Fortunately, this should go away once | 339 // return a dangling reference. Fortunately, this should go away once |
341 // voe::Channel does. | 340 // voe::Channel does. |
342 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; | 341 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; |
343 }; | 342 }; |
344 } // namespace test | 343 } // namespace test |
345 } // namespace webrtc | 344 } // namespace webrtc |
346 | 345 |
347 #endif // WEBRTC_AUDIO_MOCK_VOICE_ENGINE_H_ | 346 #endif // WEBRTC_AUDIO_MOCK_VOICE_ENGINE_H_ |
OLD | NEW |