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 "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 #include "webrtc/audio/audio_send_stream.h" | 16 #include "webrtc/audio/audio_send_stream.h" |
17 #include "webrtc/audio/audio_state.h" | 17 #include "webrtc/audio/audio_state.h" |
18 #include "webrtc/audio/conversion.h" | 18 #include "webrtc/audio/conversion.h" |
19 #include "webrtc/modules/congestion_controller/include/mock/mock_congestion_cont
roller.h" | 19 #include "webrtc/modules/congestion_controller/include/mock/mock_congestion_cont
roller.h" |
20 #include "webrtc/call/mock/mock_rtc_event_log.h" | |
21 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" | 20 #include "webrtc/modules/congestion_controller/include/congestion_controller.h" |
22 #include "webrtc/modules/pacing/paced_sender.h" | 21 #include "webrtc/modules/pacing/paced_sender.h" |
23 #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" |
24 #include "webrtc/test/mock_voe_channel_proxy.h" | 23 #include "webrtc/test/mock_voe_channel_proxy.h" |
25 #include "webrtc/test/mock_voice_engine.h" | 24 #include "webrtc/test/mock_voice_engine.h" |
26 | 25 |
27 namespace webrtc { | 26 namespace webrtc { |
28 namespace test { | 27 namespace test { |
29 namespace { | 28 namespace { |
30 | 29 |
(...skipping 18 matching lines...) Expand all Loading... |
49 const int kTelephoneEventPayloadType = 123; | 48 const int kTelephoneEventPayloadType = 123; |
50 const int kTelephoneEventCode = 45; | 49 const int kTelephoneEventCode = 45; |
51 const int kTelephoneEventDuration = 6789; | 50 const int kTelephoneEventDuration = 6789; |
52 | 51 |
53 struct ConfigHelper { | 52 struct ConfigHelper { |
54 ConfigHelper() | 53 ConfigHelper() |
55 : simulated_clock_(123456), | 54 : simulated_clock_(123456), |
56 stream_config_(nullptr), | 55 stream_config_(nullptr), |
57 congestion_controller_(&simulated_clock_, | 56 congestion_controller_(&simulated_clock_, |
58 &bitrate_observer_, | 57 &bitrate_observer_, |
59 &remote_bitrate_observer_, | 58 &remote_bitrate_observer_) { |
60 &event_log_) { | |
61 using testing::Invoke; | 59 using testing::Invoke; |
62 using testing::StrEq; | 60 using testing::StrEq; |
63 | 61 |
64 EXPECT_CALL(voice_engine_, | 62 EXPECT_CALL(voice_engine_, |
65 RegisterVoiceEngineObserver(_)).WillOnce(Return(0)); | 63 RegisterVoiceEngineObserver(_)).WillOnce(Return(0)); |
66 EXPECT_CALL(voice_engine_, | 64 EXPECT_CALL(voice_engine_, |
67 DeRegisterVoiceEngineObserver()).WillOnce(Return(0)); | 65 DeRegisterVoiceEngineObserver()).WillOnce(Return(0)); |
68 AudioState::Config config; | 66 AudioState::Config config; |
69 config.voice_engine = &voice_engine_; | 67 config.voice_engine = &voice_engine_; |
70 audio_state_ = AudioState::Create(config); | 68 audio_state_ = AudioState::Create(config); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 160 |
163 private: | 161 private: |
164 SimulatedClock simulated_clock_; | 162 SimulatedClock simulated_clock_; |
165 testing::StrictMock<MockVoiceEngine> voice_engine_; | 163 testing::StrictMock<MockVoiceEngine> voice_engine_; |
166 rtc::scoped_refptr<AudioState> audio_state_; | 164 rtc::scoped_refptr<AudioState> audio_state_; |
167 AudioSendStream::Config stream_config_; | 165 AudioSendStream::Config stream_config_; |
168 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; | 166 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; |
169 testing::NiceMock<MockCongestionObserver> bitrate_observer_; | 167 testing::NiceMock<MockCongestionObserver> bitrate_observer_; |
170 testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_; | 168 testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_; |
171 CongestionController congestion_controller_; | 169 CongestionController congestion_controller_; |
172 MockRtcEventLog event_log_; | |
173 }; | 170 }; |
174 } // namespace | 171 } // namespace |
175 | 172 |
176 TEST(AudioSendStreamTest, ConfigToString) { | 173 TEST(AudioSendStreamTest, ConfigToString) { |
177 AudioSendStream::Config config(nullptr); | 174 AudioSendStream::Config config(nullptr); |
178 config.rtp.ssrc = kSsrc; | 175 config.rtp.ssrc = kSsrc; |
179 config.rtp.extensions.push_back( | 176 config.rtp.extensions.push_back( |
180 RtpExtension(RtpExtension::kAbsSendTimeUri, kAbsSendTimeId)); | 177 RtpExtension(RtpExtension::kAbsSendTimeUri, kAbsSendTimeId)); |
181 config.rtp.c_name = kCName; | 178 config.rtp.c_name = kCName; |
182 config.voe_channel_id = kChannelId; | 179 config.voe_channel_id = kChannelId; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 static_cast<internal::AudioState*>(helper.audio_state().get()); | 248 static_cast<internal::AudioState*>(helper.audio_state().get()); |
252 VoiceEngineObserver* voe_observer = | 249 VoiceEngineObserver* voe_observer = |
253 static_cast<VoiceEngineObserver*>(internal_audio_state); | 250 static_cast<VoiceEngineObserver*>(internal_audio_state); |
254 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_WARNING); | 251 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_WARNING); |
255 EXPECT_TRUE(send_stream.GetStats().typing_noise_detected); | 252 EXPECT_TRUE(send_stream.GetStats().typing_noise_detected); |
256 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_OFF_WARNING); | 253 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_OFF_WARNING); |
257 EXPECT_FALSE(send_stream.GetStats().typing_noise_detected); | 254 EXPECT_FALSE(send_stream.GetStats().typing_noise_detected); |
258 } | 255 } |
259 } // namespace test | 256 } // namespace test |
260 } // namespace webrtc | 257 } // namespace webrtc |
OLD | NEW |