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

Side by Side Diff: webrtc/audio/audio_send_stream_unittest.cc

Issue 2454373002: Added an empty AudioTransportProxy to AudioState. (Closed)
Patch Set: No heap transport, WillOnce, comparison with constants. 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
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
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "webrtc/audio/audio_send_stream.h" 14 #include "webrtc/audio/audio_send_stream.h"
15 #include "webrtc/audio/audio_state.h" 15 #include "webrtc/audio/audio_state.h"
16 #include "webrtc/audio/conversion.h" 16 #include "webrtc/audio/conversion.h"
17 #include "webrtc/base/task_queue.h" 17 #include "webrtc/base/task_queue.h"
18 #include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h" 18 #include "webrtc/logging/rtc_event_log/mock/mock_rtc_event_log.h"
19 #include "webrtc/modules/audio_device/include/mock_audio_device.h"
19 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" 20 #include "webrtc/modules/congestion_controller/include/congestion_controller.h"
20 #include "webrtc/modules/congestion_controller/include/mock/mock_congestion_cont roller.h" 21 #include "webrtc/modules/congestion_controller/include/mock/mock_congestion_cont roller.h"
21 #include "webrtc/modules/pacing/paced_sender.h" 22 #include "webrtc/modules/pacing/paced_sender.h"
22 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra te_estimator.h" 23 #include "webrtc/modules/remote_bitrate_estimator/include/mock/mock_remote_bitra te_estimator.h"
23 #include "webrtc/test/gtest.h" 24 #include "webrtc/test/gtest.h"
24 #include "webrtc/test/mock_voe_channel_proxy.h" 25 #include "webrtc/test/mock_voe_channel_proxy.h"
25 #include "webrtc/test/mock_voice_engine.h" 26 #include "webrtc/test/mock_voice_engine.h"
26 27
27 namespace webrtc { 28 namespace webrtc {
28 namespace test { 29 namespace test {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 : simulated_clock_(123456), 63 : simulated_clock_(123456),
63 stream_config_(nullptr), 64 stream_config_(nullptr),
64 congestion_controller_(&simulated_clock_, 65 congestion_controller_(&simulated_clock_,
65 &bitrate_observer_, 66 &bitrate_observer_,
66 &remote_bitrate_observer_, 67 &remote_bitrate_observer_,
67 &event_log_), 68 &event_log_),
68 bitrate_allocator_(&limit_observer_), 69 bitrate_allocator_(&limit_observer_),
69 worker_queue_("ConfigHelper_worker_queue") { 70 worker_queue_("ConfigHelper_worker_queue") {
70 using testing::Invoke; 71 using testing::Invoke;
71 72
72 EXPECT_CALL(voice_engine_, 73 EXPECT_CALL(voice_engine_, RegisterVoiceEngineObserver(_))
73 RegisterVoiceEngineObserver(_)).WillOnce(Return(0)); 74 .WillOnce(Return(0));
74 EXPECT_CALL(voice_engine_, 75 EXPECT_CALL(voice_engine_, DeRegisterVoiceEngineObserver())
75 DeRegisterVoiceEngineObserver()).WillOnce(Return(0)); 76 .WillOnce(Return(0));
77 EXPECT_CALL(voice_engine_, audio_transport());
78 EXPECT_CALL(voice_engine_, audio_processing());
79 EXPECT_CALL(voice_engine_, audio_device_module())
80 .WillOnce(Return(&mock_audio_device_));
76 AudioState::Config config; 81 AudioState::Config config;
77 config.voice_engine = &voice_engine_; 82 config.voice_engine = &voice_engine_;
78 audio_state_ = AudioState::Create(config); 83 audio_state_ = AudioState::Create(config);
79 84
80 SetupDefaultChannelProxy(); 85 SetupDefaultChannelProxy();
81 86
82 EXPECT_CALL(voice_engine_, ChannelProxyFactory(kChannelId)) 87 EXPECT_CALL(voice_engine_, ChannelProxyFactory(kChannelId))
83 .WillOnce(Invoke([this](int channel_id) { 88 .WillOnce(Invoke([this](int channel_id) {
84 return channel_proxy_; 89 return channel_proxy_;
85 })); 90 }));
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 SetArgReferee<1>(kEchoReturnLossEnhancement), 193 SetArgReferee<1>(kEchoReturnLossEnhancement),
189 Return(0))); 194 Return(0)));
190 EXPECT_CALL(voice_engine_, GetEcDelayMetrics(_, _, _)) 195 EXPECT_CALL(voice_engine_, GetEcDelayMetrics(_, _, _))
191 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoDelayMedian), 196 .WillRepeatedly(DoAll(SetArgReferee<0>(kEchoDelayMedian),
192 SetArgReferee<1>(kEchoDelayStdDev), Return(0))); 197 SetArgReferee<1>(kEchoDelayStdDev), Return(0)));
193 } 198 }
194 199
195 private: 200 private:
196 SimulatedClock simulated_clock_; 201 SimulatedClock simulated_clock_;
197 testing::StrictMock<MockVoiceEngine> voice_engine_; 202 testing::StrictMock<MockVoiceEngine> voice_engine_;
203 MockAudioDeviceModule mock_audio_device_;
198 rtc::scoped_refptr<AudioState> audio_state_; 204 rtc::scoped_refptr<AudioState> audio_state_;
199 AudioSendStream::Config stream_config_; 205 AudioSendStream::Config stream_config_;
200 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; 206 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr;
201 testing::NiceMock<MockCongestionObserver> bitrate_observer_; 207 testing::NiceMock<MockCongestionObserver> bitrate_observer_;
202 testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_; 208 testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_;
203 CongestionController congestion_controller_; 209 CongestionController congestion_controller_;
204 MockRtcEventLog event_log_; 210 MockRtcEventLog event_log_;
205 testing::NiceMock<MockLimitObserver> limit_observer_; 211 testing::NiceMock<MockLimitObserver> limit_observer_;
206 BitrateAllocator bitrate_allocator_; 212 BitrateAllocator bitrate_allocator_;
207 // |worker_queue| is defined last to ensure all pending tasks are cancelled 213 // |worker_queue| is defined last to ensure all pending tasks are cancelled
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 EXPECT_CALL(*helper.voice_engine(), SetVADStatus(kChannelId, true, _, _)) 382 EXPECT_CALL(*helper.voice_engine(), SetVADStatus(kChannelId, true, _, _))
377 .WillOnce(Return(0)); 383 .WillOnce(Return(0));
378 internal::AudioSendStream send_stream( 384 internal::AudioSendStream send_stream(
379 stream_config, helper.audio_state(), helper.worker_queue(), 385 stream_config, helper.audio_state(), helper.worker_queue(),
380 helper.congestion_controller(), helper.bitrate_allocator(), 386 helper.congestion_controller(), helper.bitrate_allocator(),
381 helper.event_log()); 387 helper.event_log());
382 } 388 }
383 389
384 } // namespace test 390 } // namespace test
385 } // namespace webrtc 391 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698