Chromium Code Reviews| 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 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 EXPECT_CALL(*channel_proxy_, RegisterExternalTransport(nullptr)) | 104 EXPECT_CALL(*channel_proxy_, RegisterExternalTransport(nullptr)) |
| 105 .Times(1); | 105 .Times(1); |
| 106 EXPECT_CALL(*channel_proxy_, DeRegisterExternalTransport()) | 106 EXPECT_CALL(*channel_proxy_, DeRegisterExternalTransport()) |
| 107 .Times(1); | 107 .Times(1); |
| 108 EXPECT_CALL(*channel_proxy_, SetRtcEventLog(testing::NotNull())) | 108 EXPECT_CALL(*channel_proxy_, SetRtcEventLog(testing::NotNull())) |
| 109 .Times(1); | 109 .Times(1); |
| 110 EXPECT_CALL(*channel_proxy_, SetRtcEventLog(testing::IsNull())) | 110 EXPECT_CALL(*channel_proxy_, SetRtcEventLog(testing::IsNull())) |
| 111 .Times(1); // Destructor resets the event log | 111 .Times(1); // Destructor resets the event log |
| 112 return channel_proxy_; | 112 return channel_proxy_; |
| 113 })); | 113 })); |
| 114 SetupMockForSetSendCodecs(); | |
| 114 stream_config_.voe_channel_id = kChannelId; | 115 stream_config_.voe_channel_id = kChannelId; |
| 115 stream_config_.rtp.ssrc = kSsrc; | 116 stream_config_.rtp.ssrc = kSsrc; |
| 116 stream_config_.rtp.nack.rtp_history_ms = 200; | 117 stream_config_.rtp.nack.rtp_history_ms = 200; |
| 117 stream_config_.rtp.c_name = kCName; | 118 stream_config_.rtp.c_name = kCName; |
| 118 stream_config_.rtp.extensions.push_back( | 119 stream_config_.rtp.extensions.push_back( |
| 119 RtpExtension(RtpExtension::kAudioLevelUri, kAudioLevelId)); | 120 RtpExtension(RtpExtension::kAudioLevelUri, kAudioLevelId)); |
| 120 stream_config_.rtp.extensions.push_back( | 121 stream_config_.rtp.extensions.push_back( |
| 121 RtpExtension(RtpExtension::kAbsSendTimeUri, kAbsSendTimeId)); | 122 RtpExtension(RtpExtension::kAbsSendTimeUri, kAbsSendTimeId)); |
| 122 stream_config_.rtp.extensions.push_back(RtpExtension( | 123 stream_config_.rtp.extensions.push_back(RtpExtension( |
| 123 RtpExtension::kTransportSequenceNumberUri, kTransportSequenceNumberId)); | 124 RtpExtension::kTransportSequenceNumberUri, kTransportSequenceNumberId)); |
| 124 } | 125 } |
| 125 | 126 |
| 126 AudioSendStream::Config& config() { return stream_config_; } | 127 AudioSendStream::Config& config() { return stream_config_; } |
| 127 rtc::scoped_refptr<AudioState> audio_state() { return audio_state_; } | 128 rtc::scoped_refptr<AudioState> audio_state() { return audio_state_; } |
| 128 MockVoEChannelProxy* channel_proxy() { return channel_proxy_; } | 129 MockVoEChannelProxy* channel_proxy() { return channel_proxy_; } |
| 129 CongestionController* congestion_controller() { | 130 CongestionController* congestion_controller() { |
| 130 return &congestion_controller_; | 131 return &congestion_controller_; |
| 131 } | 132 } |
| 132 BitrateAllocator* bitrate_allocator() { return &bitrate_allocator_; } | 133 BitrateAllocator* bitrate_allocator() { return &bitrate_allocator_; } |
| 133 rtc::TaskQueue* worker_queue() { return &worker_queue_; } | 134 rtc::TaskQueue* worker_queue() { return &worker_queue_; } |
| 134 RtcEventLog* event_log() { return &event_log_; } | 135 RtcEventLog* event_log() { return &event_log_; } |
| 135 | 136 |
| 137 void SetupMockForSetSendCodecs() { | |
| 138 EXPECT_CALL(voice_engine_, SetVADStatus(_, _, _, _)) | |
| 139 .WillRepeatedly(Return(0)); | |
| 140 EXPECT_CALL(voice_engine_, SetFECStatus(_, _)).WillRepeatedly(Return(0)); | |
| 141 EXPECT_CALL(voice_engine_, SetSendCodec(_, _)).WillRepeatedly(Return(0)); | |
| 142 EXPECT_CALL(voice_engine_, GetSendCodec(_, _)).WillOnce(Return(-1)); | |
|
the sun
2016/10/17 14:58:22
Doesn't this mean we'll get an error log line?
minyue-webrtc
2016/10/18 09:39:00
This is only for the first time when GetSendCodec
| |
| 143 } | |
| 144 | |
| 136 void SetupMockForSendTelephoneEvent() { | 145 void SetupMockForSendTelephoneEvent() { |
| 137 EXPECT_TRUE(channel_proxy_); | 146 EXPECT_TRUE(channel_proxy_); |
| 138 EXPECT_CALL(*channel_proxy_, | 147 EXPECT_CALL(*channel_proxy_, |
| 139 SetSendTelephoneEventPayloadType(kTelephoneEventPayloadType)) | 148 SetSendTelephoneEventPayloadType(kTelephoneEventPayloadType)) |
| 140 .WillOnce(Return(true)); | 149 .WillOnce(Return(true)); |
| 141 EXPECT_CALL(*channel_proxy_, | 150 EXPECT_CALL(*channel_proxy_, |
| 142 SendTelephoneEventOutband(kTelephoneEventCode, kTelephoneEventDuration)) | 151 SendTelephoneEventOutband(kTelephoneEventCode, kTelephoneEventDuration)) |
| 143 .WillOnce(Return(true)); | 152 .WillOnce(Return(true)); |
| 144 } | 153 } |
| 145 | 154 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 280 | 289 |
| 281 internal::AudioState* internal_audio_state = | 290 internal::AudioState* internal_audio_state = |
| 282 static_cast<internal::AudioState*>(helper.audio_state().get()); | 291 static_cast<internal::AudioState*>(helper.audio_state().get()); |
| 283 VoiceEngineObserver* voe_observer = | 292 VoiceEngineObserver* voe_observer = |
| 284 static_cast<VoiceEngineObserver*>(internal_audio_state); | 293 static_cast<VoiceEngineObserver*>(internal_audio_state); |
| 285 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_WARNING); | 294 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_WARNING); |
| 286 EXPECT_TRUE(send_stream.GetStats().typing_noise_detected); | 295 EXPECT_TRUE(send_stream.GetStats().typing_noise_detected); |
| 287 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_OFF_WARNING); | 296 voe_observer->CallbackOnError(-1, VE_TYPING_NOISE_OFF_WARNING); |
| 288 EXPECT_FALSE(send_stream.GetStats().typing_noise_detected); | 297 EXPECT_FALSE(send_stream.GetStats().typing_noise_detected); |
| 289 } | 298 } |
| 299 | |
| 300 // TODO(minyue): Add tests on logics involved in SetSendCodecs. | |
| 301 | |
| 290 } // namespace test | 302 } // namespace test |
| 291 } // namespace webrtc | 303 } // namespace webrtc |
| OLD | NEW |