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