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

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

Issue 1748403002: Move RtcEventLog object from inside VoiceEngine to Call. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: More fixes for bots. Created 4 years, 8 months 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 "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/call/mock/mock_rtc_event_log.h"
19 #include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller .h" 20 #include "webrtc/modules/bitrate_controller/include/mock/mock_bitrate_controller .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 {
(...skipping 19 matching lines...) Expand all
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 155
154 private: 156 private:
155 SimulatedClock simulated_clock_; 157 SimulatedClock simulated_clock_;
156 testing::StrictMock<MockVoiceEngine> voice_engine_; 158 testing::StrictMock<MockVoiceEngine> voice_engine_;
157 rtc::scoped_refptr<AudioState> audio_state_; 159 rtc::scoped_refptr<AudioState> audio_state_;
158 AudioSendStream::Config stream_config_; 160 AudioSendStream::Config stream_config_;
159 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr; 161 testing::StrictMock<MockVoEChannelProxy>* channel_proxy_ = nullptr;
160 testing::NiceMock<MockBitrateObserver> bitrate_observer_; 162 testing::NiceMock<MockBitrateObserver> bitrate_observer_;
161 testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_; 163 testing::NiceMock<MockRemoteBitrateObserver> remote_bitrate_observer_;
162 CongestionController congestion_controller_; 164 CongestionController congestion_controller_;
165 MockRtcEventLog event_log_;
163 }; 166 };
164 } // namespace 167 } // namespace
165 168
166 TEST(AudioSendStreamTest, ConfigToString) { 169 TEST(AudioSendStreamTest, ConfigToString) {
167 AudioSendStream::Config config(nullptr); 170 AudioSendStream::Config config(nullptr);
168 config.rtp.ssrc = kSsrc; 171 config.rtp.ssrc = kSsrc;
169 config.rtp.extensions.push_back( 172 config.rtp.extensions.push_back(
170 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeId)); 173 RtpExtension(RtpExtension::kAbsSendTime, kAbsSendTimeId));
171 config.rtp.c_name = kCName; 174 config.rtp.c_name = kCName;
172 config.voe_channel_id = kChannelId; 175 config.voe_channel_id = kChannelId;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 static_cast<internal::AudioState*>(helper.audio_state().get()); 237 static_cast<internal::AudioState*>(helper.audio_state().get());
235 VoiceEngineObserver* voe_observer = 238 VoiceEngineObserver* voe_observer =
236 static_cast<VoiceEngineObserver*>(internal_audio_state); 239 static_cast<VoiceEngineObserver*>(internal_audio_state);
237 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_WARNING); 240 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_WARNING);
238 EXPECT_TRUE(send_stream.GetStats().typing_noise_detected); 241 EXPECT_TRUE(send_stream.GetStats().typing_noise_detected);
239 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_OFF_WARNING); 242 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_OFF_WARNING);
240 EXPECT_FALSE(send_stream.GetStats().typing_noise_detected); 243 EXPECT_FALSE(send_stream.GetStats().typing_noise_detected);
241 } 244 }
242 } // namespace test 245 } // namespace test
243 } // namespace webrtc 246 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698