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 |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "webrtc/audio/audio_receive_stream.h" | 14 #include "webrtc/audio/audio_receive_stream.h" |
15 #include "webrtc/audio/conversion.h" | 15 #include "webrtc/audio/conversion.h" |
16 #include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h" | 16 #include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h" |
17 #include "webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h" | 17 #include "webrtc/modules/audio_coding/codecs/mock/mock_audio_decoder_factory.h" |
18 #include "webrtc/modules/audio_device/include/mock_audio_device.h" | |
18 #include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller .h" | 19 #include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller .h" |
19 #include "webrtc/modules/congestion_controller/include/mock/mock_congestion_cont roller.h" | 20 #include "webrtc/modules/congestion_controller/include/mock/mock_congestion_cont roller.h" |
20 #include "webrtc/modules/pacing/packet_router.h" | 21 #include "webrtc/modules/pacing/packet_router.h" |
21 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra te_estimator.h" | 22 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra te_estimator.h" |
22 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" | 23 #include "webrtc/modules/rtp_rtcp/source/byte_io.h" |
23 #include "webrtc/system_wrappers/include/clock.h" | 24 #include "webrtc/system_wrappers/include/clock.h" |
24 #include "webrtc/test/gtest.h" | 25 #include "webrtc/test/gtest.h" |
25 #include "webrtc/test/mock_voe_channel_proxy.h" | 26 #include "webrtc/test/mock_voe_channel_proxy.h" |
26 #include "webrtc/test/mock_voice_engine.h" | 27 #include "webrtc/test/mock_voice_engine.h" |
27 | 28 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 struct ConfigHelper { | 68 struct ConfigHelper { |
68 ConfigHelper() | 69 ConfigHelper() |
69 : simulated_clock_(123456), | 70 : simulated_clock_(123456), |
70 decoder_factory_(new rtc::RefCountedObject<MockAudioDecoderFactory>), | 71 decoder_factory_(new rtc::RefCountedObject<MockAudioDecoderFactory>), |
71 congestion_controller_(&simulated_clock_, | 72 congestion_controller_(&simulated_clock_, |
72 &bitrate_observer_, | 73 &bitrate_observer_, |
73 &remote_bitrate_observer_, | 74 &remote_bitrate_observer_, |
74 &event_log_) { | 75 &event_log_) { |
75 using testing::Invoke; | 76 using testing::Invoke; |
76 | 77 |
77 EXPECT_CALL(voice_engine_, | 78 EXPECT_CALL(voice_engine_, RegisterVoiceEngineObserver(_)) |
78 RegisterVoiceEngineObserver(_)).WillOnce(Return(0)); | 79 .WillOnce(Return(0)); |
79 EXPECT_CALL(voice_engine_, | 80 EXPECT_CALL(voice_engine_, DeRegisterVoiceEngineObserver()) |
80 DeRegisterVoiceEngineObserver()).WillOnce(Return(0)); | 81 .WillOnce(Return(0)); |
82 EXPECT_CALL(voice_engine_, audio_transport()); | |
ossu
2016/11/03 14:02:04
Don't these require actions, i.e. WillOnce(Return(
aleloi
2016/11/08 11:46:41
I think the default action (which is Return(nullpt
| |
83 EXPECT_CALL(voice_engine_, audio_processing()); | |
84 EXPECT_CALL(voice_engine_, audio_device_module()); | |
85 ON_CALL(voice_engine_, audio_device_module()) | |
86 .WillByDefault(Return(&mock_audio_device_)); | |
81 AudioState::Config config; | 87 AudioState::Config config; |
82 config.voice_engine = &voice_engine_; | 88 config.voice_engine = &voice_engine_; |
83 audio_state_ = AudioState::Create(config); | 89 audio_state_ = AudioState::Create(config); |
84 | 90 |
85 EXPECT_CALL(voice_engine_, ChannelProxyFactory(kChannelId)) | 91 EXPECT_CALL(voice_engine_, ChannelProxyFactory(kChannelId)) |
86 .WillOnce(Invoke([this](int channel_id) { | 92 .WillOnce(Invoke([this](int channel_id) { |
87 EXPECT_FALSE(channel_proxy_); | 93 EXPECT_FALSE(channel_proxy_); |
88 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>(); | 94 channel_proxy_ = new testing::StrictMock<MockVoEChannelProxy>(); |
89 EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kLocalSsrc)).Times(1); | 95 EXPECT_CALL(*channel_proxy_, SetLocalSSRC(kLocalSsrc)).Times(1); |
90 EXPECT_CALL(*channel_proxy_, SetNACKStatus(true, 15)).Times(1); | 96 EXPECT_CALL(*channel_proxy_, SetNACKStatus(true, 15)).Times(1); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 private: | 176 private: |
171 SimulatedClock simulated_clock_; | 177 SimulatedClock simulated_clock_; |
172 PacketRouter packet_router_; | 178 PacketRouter packet_router_; |
173 testing::NiceMock<MockCongestionObserver> bitrate_observer_; | 179 testing::NiceMock<MockCongestionObserver> bitrate_observer_; |
174 testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_; | 180 testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_; |
175 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; | 181 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; |
176 MockCongestionController congestion_controller_; | 182 MockCongestionController congestion_controller_; |
177 MockRemoteBitrateEstimator remote_bitrate_estimator_; | 183 MockRemoteBitrateEstimator remote_bitrate_estimator_; |
178 MockRtcEventLog event_log_; | 184 MockRtcEventLog event_log_; |
179 testing::StrictMock<MockVoiceEngine> voice_engine_; | 185 testing::StrictMock<MockVoiceEngine> voice_engine_; |
186 testing::NiceMock<webrtc::test::MockAudioDeviceModule> mock_audio_device_; | |
ossu
2016/11/03 14:02:04
What's so nice about it!? :)
Why not just use an u
aleloi
2016/11/08 11:46:41
Probably an ordinary mock make sense here, because
| |
180 rtc::scoped_refptr<AudioState> audio_state_; | 187 rtc::scoped_refptr<AudioState> audio_state_; |
181 AudioReceiveStream::Config stream_config_; | 188 AudioReceiveStream::Config stream_config_; |
182 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; | 189 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; |
183 }; | 190 }; |
184 | 191 |
185 void BuildOneByteExtension(std::vector<uint8_t>::iterator it, | 192 void BuildOneByteExtension(std::vector<uint8_t>::iterator it, |
186 int id, | 193 int id, |
187 uint32_t extension_value, | 194 uint32_t extension_value, |
188 size_t value_length) { | 195 size_t value_length) { |
189 const uint16_t kRtpOneByteHeaderExtensionId = 0xBEDE; | 196 const uint16_t kRtpOneByteHeaderExtensionId = 0xBEDE; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
356 ConfigHelper helper; | 363 ConfigHelper helper; |
357 internal::AudioReceiveStream recv_stream( | 364 internal::AudioReceiveStream recv_stream( |
358 helper.congestion_controller(), helper.config(), helper.audio_state(), | 365 helper.congestion_controller(), helper.config(), helper.audio_state(), |
359 helper.event_log()); | 366 helper.event_log()); |
360 EXPECT_CALL(*helper.channel_proxy(), | 367 EXPECT_CALL(*helper.channel_proxy(), |
361 SetChannelOutputVolumeScaling(FloatEq(0.765f))); | 368 SetChannelOutputVolumeScaling(FloatEq(0.765f))); |
362 recv_stream.SetGain(0.765f); | 369 recv_stream.SetGain(0.765f); |
363 } | 370 } |
364 } // namespace test | 371 } // namespace test |
365 } // namespace webrtc | 372 } // namespace webrtc |
OLD | NEW |