Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 #ifndef WEBRTC_TEST_CALL_TEST_H_ | 10 #ifndef WEBRTC_TEST_CALL_TEST_H_ |
| 11 #define WEBRTC_TEST_CALL_TEST_H_ | 11 #define WEBRTC_TEST_CALL_TEST_H_ |
| 12 | 12 |
| 13 #include <memory> | 13 #include <memory> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "webrtc/call/call.h" | 16 #include "webrtc/call/call.h" |
| 17 #include "webrtc/call/rtp_transport_controller_send.h" | 17 #include "webrtc/call/rtp_transport_controller_send.h" |
| 18 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" | 18 #include "webrtc/logging/rtc_event_log/rtc_event_log.h" |
| 19 #include "webrtc/test/encoder_settings.h" | 19 #include "webrtc/test/encoder_settings.h" |
| 20 #include "webrtc/test/fake_audio_device.h" | 20 #include "webrtc/test/fake_audio_device.h" |
| 21 #include "webrtc/test/fake_decoder.h" | 21 #include "webrtc/test/fake_decoder.h" |
| 22 #include "webrtc/test/fake_encoder.h" | 22 #include "webrtc/test/fake_encoder.h" |
| 23 #include "webrtc/test/fake_videorenderer.h" | 23 #include "webrtc/test/fake_videorenderer.h" |
| 24 #include "webrtc/test/frame_generator_capturer.h" | 24 #include "webrtc/test/frame_generator_capturer.h" |
| 25 #include "webrtc/test/rtp_rtcp_observer.h" | 25 #include "webrtc/test/rtp_rtcp_observer.h" |
| 26 #include "webrtc/test/single_threaded_task_queue.h" | |
| 26 | 27 |
| 27 namespace webrtc { | 28 namespace webrtc { |
| 28 | 29 |
| 29 class VoEBase; | 30 class VoEBase; |
| 30 | 31 |
| 31 namespace test { | 32 namespace test { |
| 32 | 33 |
| 33 class BaseTest; | 34 class BaseTest; |
| 34 | 35 |
| 35 class CallTest : public ::testing::Test { | 36 class CallTest : public ::testing::Test { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 void DestroyVoiceEngines(); | 156 void DestroyVoiceEngines(); |
| 156 | 157 |
| 157 VoiceEngineState voe_send_; | 158 VoiceEngineState voe_send_; |
| 158 VoiceEngineState voe_recv_; | 159 VoiceEngineState voe_recv_; |
| 159 rtc::scoped_refptr<AudioProcessing> apm_send_; | 160 rtc::scoped_refptr<AudioProcessing> apm_send_; |
| 160 rtc::scoped_refptr<AudioProcessing> apm_recv_; | 161 rtc::scoped_refptr<AudioProcessing> apm_recv_; |
| 161 | 162 |
| 162 // The audio devices must outlive the voice engines. | 163 // The audio devices must outlive the voice engines. |
| 163 std::unique_ptr<test::FakeAudioDevice> fake_send_audio_device_; | 164 std::unique_ptr<test::FakeAudioDevice> fake_send_audio_device_; |
| 164 std::unique_ptr<test::FakeAudioDevice> fake_recv_audio_device_; | 165 std::unique_ptr<test::FakeAudioDevice> fake_recv_audio_device_; |
| 166 | |
| 167 protected: | |
| 168 // Should be last, to destruct first. | |
|
nisse-webrtc
2017/08/21 09:07:07
Explain briefly *why* it has to be destructed firs
eladalon
2017/08/21 10:56:53
Actually, come to think of it, putting this last d
| |
| 169 SingleThreadedTaskQueueForTesting task_queue_; | |
| 165 }; | 170 }; |
| 166 | 171 |
| 167 class BaseTest : public RtpRtcpObserver { | 172 class BaseTest : public RtpRtcpObserver { |
| 168 public: | 173 public: |
| 169 BaseTest(); | 174 BaseTest(); |
| 170 explicit BaseTest(unsigned int timeout_ms); | 175 explicit BaseTest(unsigned int timeout_ms); |
| 171 virtual ~BaseTest(); | 176 virtual ~BaseTest(); |
| 172 | 177 |
| 173 virtual void PerformTest() = 0; | 178 virtual void PerformTest() = 0; |
| 174 virtual bool ShouldCreateReceivers() const = 0; | 179 virtual bool ShouldCreateReceivers() const = 0; |
| 175 | 180 |
| 176 virtual size_t GetNumVideoStreams() const; | 181 virtual size_t GetNumVideoStreams() const; |
| 177 virtual size_t GetNumAudioStreams() const; | 182 virtual size_t GetNumAudioStreams() const; |
| 178 virtual size_t GetNumFlexfecStreams() const; | 183 virtual size_t GetNumFlexfecStreams() const; |
| 179 | 184 |
| 180 virtual std::unique_ptr<FakeAudioDevice::Capturer> CreateCapturer(); | 185 virtual std::unique_ptr<FakeAudioDevice::Capturer> CreateCapturer(); |
| 181 virtual std::unique_ptr<FakeAudioDevice::Renderer> CreateRenderer(); | 186 virtual std::unique_ptr<FakeAudioDevice::Renderer> CreateRenderer(); |
| 182 virtual void OnFakeAudioDevicesCreated(FakeAudioDevice* send_audio_device, | 187 virtual void OnFakeAudioDevicesCreated(FakeAudioDevice* send_audio_device, |
| 183 FakeAudioDevice* recv_audio_device); | 188 FakeAudioDevice* recv_audio_device); |
| 184 | 189 |
| 185 virtual Call::Config GetSenderCallConfig(); | 190 virtual Call::Config GetSenderCallConfig(); |
| 186 virtual Call::Config GetReceiverCallConfig(); | 191 virtual Call::Config GetReceiverCallConfig(); |
| 187 virtual void OnRtpTransportControllerSendCreated( | 192 virtual void OnRtpTransportControllerSendCreated( |
| 188 RtpTransportControllerSend* controller); | 193 RtpTransportControllerSend* controller); |
| 189 virtual void OnCallsCreated(Call* sender_call, Call* receiver_call); | 194 virtual void OnCallsCreated(Call* sender_call, Call* receiver_call); |
| 190 | 195 |
| 191 virtual test::PacketTransport* CreateSendTransport(Call* sender_call); | 196 virtual test::PacketTransport* CreateSendTransport( |
| 192 virtual test::PacketTransport* CreateReceiveTransport(); | 197 SingleThreadedTaskQueueForTesting* task_queue, |
| 198 Call* sender_call); | |
| 199 virtual test::PacketTransport* CreateReceiveTransport( | |
| 200 SingleThreadedTaskQueueForTesting* task_queue); | |
| 193 | 201 |
| 194 virtual void ModifyVideoConfigs( | 202 virtual void ModifyVideoConfigs( |
| 195 VideoSendStream::Config* send_config, | 203 VideoSendStream::Config* send_config, |
| 196 std::vector<VideoReceiveStream::Config>* receive_configs, | 204 std::vector<VideoReceiveStream::Config>* receive_configs, |
| 197 VideoEncoderConfig* encoder_config); | 205 VideoEncoderConfig* encoder_config); |
| 198 virtual void ModifyVideoCaptureStartResolution(int* width, | 206 virtual void ModifyVideoCaptureStartResolution(int* width, |
| 199 int* heigt, | 207 int* heigt, |
| 200 int* frame_rate); | 208 int* frame_rate); |
| 201 virtual void OnVideoStreamsCreated( | 209 virtual void OnVideoStreamsCreated( |
| 202 VideoSendStream* send_stream, | 210 VideoSendStream* send_stream, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 234 EndToEndTest(); | 242 EndToEndTest(); |
| 235 explicit EndToEndTest(unsigned int timeout_ms); | 243 explicit EndToEndTest(unsigned int timeout_ms); |
| 236 | 244 |
| 237 bool ShouldCreateReceivers() const override; | 245 bool ShouldCreateReceivers() const override; |
| 238 }; | 246 }; |
| 239 | 247 |
| 240 } // namespace test | 248 } // namespace test |
| 241 } // namespace webrtc | 249 } // namespace webrtc |
| 242 | 250 |
| 243 #endif // WEBRTC_TEST_CALL_TEST_H_ | 251 #endif // WEBRTC_TEST_CALL_TEST_H_ |
| OLD | NEW |