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

Side by Side Diff: webrtc/voice_engine/test/auto_test/voe_standard_test.cc

Issue 2681153003: Remove unused voe_stress_test.cc (Closed)
Patch Set: Removed more things after rebase Created 3 years, 10 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 "webrtc/voice_engine/test/auto_test/voe_standard_test.h" 11 #include "webrtc/voice_engine/test/auto_test/voe_standard_test.h"
12 12
13 #include <assert.h> 13 #include <assert.h>
14 #include <stdio.h> 14 #include <stdio.h>
15 #include <string.h> 15 #include <string.h>
16 16
17 #include "webrtc/system_wrappers/include/event_wrapper.h" 17 #include "webrtc/system_wrappers/include/event_wrapper.h"
18 #include "webrtc/typedefs.h" 18 #include "webrtc/typedefs.h"
19 #include "webrtc/voice_engine/include/voe_neteq_stats.h" 19 #include "webrtc/voice_engine/include/voe_neteq_stats.h"
20 #include "webrtc/voice_engine/test/auto_test/automated_mode.h" 20 #include "webrtc/voice_engine/test/auto_test/automated_mode.h"
21 #include "webrtc/voice_engine/test/auto_test/voe_stress_test.h"
22 #include "webrtc/voice_engine/test/auto_test/voe_test_defines.h" 21 #include "webrtc/voice_engine/test/auto_test/voe_test_defines.h"
23 #include "webrtc/voice_engine/voice_engine_defines.h" 22 #include "webrtc/voice_engine/voice_engine_defines.h"
24 23
25 DEFINE_bool(include_timing_dependent_tests, true, 24 DEFINE_bool(include_timing_dependent_tests, true,
26 "If true, we will include tests / parts of tests that are known " 25 "If true, we will include tests / parts of tests that are known "
27 "to break in slow execution environments (such as valgrind)."); 26 "to break in slow execution environments (such as valgrind).");
28 DEFINE_bool(automated, false, 27 DEFINE_bool(automated, false,
29 "If true, we'll run the automated tests we have in noninteractive " 28 "If true, we'll run the automated tests we have in noninteractive "
30 "mode."); 29 "mode.");
31 30
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 if (!_rtp_rtcp) 77 if (!_rtp_rtcp)
79 TEST_LOG(" RTP_RTCP\n"); 78 TEST_LOG(" RTP_RTCP\n");
80 if (!_videoSync) 79 if (!_videoSync)
81 TEST_LOG(" VideoSync\n"); 80 TEST_LOG(" VideoSync\n");
82 if (!_volumeControl) 81 if (!_volumeControl)
83 TEST_LOG(" VolumeControl\n"); 82 TEST_LOG(" VolumeControl\n");
84 if (!_apm) 83 if (!_apm)
85 TEST_LOG(" AudioProcessing\n"); 84 TEST_LOG(" AudioProcessing\n");
86 ANL(); 85 ANL();
87 } 86 }
88
89 VoETestManager::VoETestManager()
90 : initialized_(false),
91 voice_engine_(NULL),
92 voe_base_(0),
93 voe_codec_(0),
94 voe_xmedia_(0),
95 voe_file_(0),
96 voe_hardware_(0),
97 voe_network_(0),
98 voe_neteq_stats_(NULL),
99 voe_rtp_rtcp_(0),
100 voe_vsync_(0),
101 voe_volume_control_(0),
102 voe_apm_(0) {
103 }
104
105 VoETestManager::~VoETestManager() {
106 }
107
108 bool VoETestManager::Init() {
109 if (initialized_)
110 return true;
111
112 voice_engine_ = VoiceEngine::Create();
113 if (!voice_engine_) {
114 TEST_LOG("Failed to create VoiceEngine\n");
115 return false;
116 }
117
118 return true;
119 }
120
121 void VoETestManager::GetInterfaces() {
122 if (voice_engine_) {
123 voe_base_ = VoEBase::GetInterface(voice_engine_);
124 voe_codec_ = VoECodec::GetInterface(voice_engine_);
125 voe_volume_control_ = VoEVolumeControl::GetInterface(voice_engine_);
126 voe_rtp_rtcp_ = VoERTP_RTCP::GetInterface(voice_engine_);
127 voe_apm_ = VoEAudioProcessing::GetInterface(voice_engine_);
128 voe_network_ = VoENetwork::GetInterface(voice_engine_);
129 voe_file_ = VoEFile::GetInterface(voice_engine_);
130 #ifdef _TEST_VIDEO_SYNC_
131 voe_vsync_ = VoEVideoSync::GetInterface(voice_engine_);
132 #endif
133 voe_hardware_ = VoEHardware::GetInterface(voice_engine_);
134 // Set the audio layer to use in all tests
135 if (voe_hardware_) {
136 int res = voe_hardware_->SetAudioDeviceLayer(TESTED_AUDIO_LAYER);
137 if (res < 0) {
138 printf("\nERROR: failed to set audio layer to use in "
139 "testing\n");
140 } else {
141 printf("\nAudio layer %d will be used in testing\n",
142 TESTED_AUDIO_LAYER);
143 }
144 }
145 #ifdef _TEST_XMEDIA_
146 voe_xmedia_ = VoEExternalMedia::GetInterface(voice_engine_);
147 #endif
148 voe_neteq_stats_ = VoENetEqStats::GetInterface(voice_engine_);
149 }
150 }
151
152 int VoETestManager::ReleaseInterfaces() {
153 bool releaseOK(true);
154
155 if (voe_base_) {
156 voe_base_->Release();
157 voe_base_ = NULL;
158 }
159 if (voe_codec_) {
160 voe_codec_->Release();
161 voe_codec_ = NULL;
162 }
163 if (voe_volume_control_) {
164 voe_volume_control_->Release();
165 voe_volume_control_ = NULL;
166 }
167 if (voe_rtp_rtcp_) {
168 voe_rtp_rtcp_->Release();
169 voe_rtp_rtcp_ = NULL;
170 }
171 if (voe_apm_) {
172 voe_apm_->Release();
173 voe_apm_ = NULL;
174 }
175 if (voe_network_) {
176 voe_network_->Release();
177 voe_network_ = NULL;
178 }
179 if (voe_file_) {
180 voe_file_->Release();
181 voe_file_ = NULL;
182 }
183 #ifdef _TEST_VIDEO_SYNC_
184 if (voe_vsync_) {
185 voe_vsync_->Release();
186 voe_vsync_ = NULL;
187 }
188 #endif
189 if (voe_hardware_) {
190 voe_hardware_->Release();
191 voe_hardware_ = NULL;
192 }
193 #ifdef _TEST_XMEDIA_
194 if (voe_xmedia_) {
195 voe_xmedia_->Release();
196 voe_xmedia_ = NULL;
197 }
198 #endif
199 if (voe_neteq_stats_) {
200 voe_neteq_stats_->Release();
201 voe_neteq_stats_ = NULL;
202 }
203 if (false == VoiceEngine::Delete(voice_engine_)) {
204 TEST_LOG("\n\nVoiceEngine::Delete() failed. \n");
205 releaseOK = false;
206 }
207
208 return (releaseOK == true) ? 0 : -1;
209 }
210
211 int run_auto_test(TestType test_type) {
212 assert(test_type != Standard);
213
214 SubAPIManager api_manager;
215 api_manager.DisplayStatus();
216
217 ////////////////////////////////////
218 // Create VoiceEngine and sub API:s
219
220 voetest::VoETestManager test_manager;
221 if (!test_manager.Init()) {
222 return -1;
223 }
224 test_manager.GetInterfaces();
225
226 int result = -1;
227 if (test_type == Stress) {
228 VoEStressTest stressTest(test_manager);
229 result = stressTest.DoTest();
230 } else {
231 // Should never end up here
232 assert(false);
233 }
234
235 //////////////////
236 // Release/Delete
237
238 int release_ok = test_manager.ReleaseInterfaces();
239
240 if ((0 == result) && (release_ok != -1)) {
241 TEST_LOG("\n\n*** All tests passed *** \n\n");
242 } else {
243 TEST_LOG("\n\n*** Test failed! *** \n");
244 }
245
246 return 0;
247 }
248 } // namespace voetest 87 } // namespace voetest
249 88
250 int RunInManualMode() { 89 int RunInManualMode() {
251 using namespace voetest; 90 using namespace voetest;
252 91
253 SubAPIManager api_manager; 92 SubAPIManager api_manager;
254 api_manager.DisplayStatus(); 93 api_manager.DisplayStatus();
255 94
256 printf("----------------------------\n"); 95 printf("----------------------------\n");
257 printf("Select type of test\n\n"); 96 printf("Select type of test\n\n");
258 printf(" (0) Quit\n"); 97 printf(" (0) Quit\n");
259 printf(" (1) Standard test\n"); 98 printf(" (1) Standard test\n");
260 printf(" (2) [OBSOLETE: Extended test(s)...]\n");
261 printf(" (3) Stress test(s)...\n");
262 printf(" (4) [OBSOLETE: Unit test(s)...]\n");
263 printf("\n: "); 99 printf("\n: ");
264 100
265 int selection(0); 101 int selection(0);
266 dummy = scanf("%d", &selection); 102 dummy = scanf("%d", &selection);
267 103
268 TestType test_type = Invalid;
269 switch (selection) { 104 switch (selection) {
270 case 0: 105 case 0:
271 return 0; 106 return 0;
272 case 1: 107 case 1:
273 test_type = Standard; 108 TEST_LOG("\n\n+++ Running standard tests +++\n\n");
274 break; 109 // Currently, all googletest-rewritten tests are in the "automated" suite.
275 case 2: 110 return RunInAutomatedMode();
276 break;
277 case 3:
278 test_type = Stress;
279 break;
280 case 4:
281 break;
282 default: 111 default:
283 TEST_LOG("Invalid selection!\n"); 112 TEST_LOG("Invalid selection!\n");
284 return 0; 113 return 0;
285 } 114 }
286
287 if (test_type == Standard) {
288 TEST_LOG("\n\n+++ Running standard tests +++\n\n");
289
290 // Currently, all googletest-rewritten tests are in the "automated" suite.
291 return RunInAutomatedMode();
292 }
293
294 // Function that can be called from other entry functions.
295 return run_auto_test(test_type);
296 } 115 }
297 116
298 // ---------------------------------------------------------------------------- 117 // ----------------------------------------------------------------------------
299 // main 118 // main
300 // ---------------------------------------------------------------------------- 119 // ----------------------------------------------------------------------------
301 120
302 #if !defined(WEBRTC_IOS) 121 #if !defined(WEBRTC_IOS)
303 int main(int argc, char** argv) { 122 int main(int argc, char** argv) {
304 // This function and RunInAutomatedMode is defined in automated_mode.cc 123 // This function and RunInAutomatedMode is defined in automated_mode.cc
305 // to avoid macro clashes with googletest (for instance ASSERT_TRUE). 124 // to avoid macro clashes with googletest (for instance ASSERT_TRUE).
306 InitializeGoogleTest(&argc, argv); 125 InitializeGoogleTest(&argc, argv);
307 // AllowCommandLineParsing allows us to ignore flags passed on to us by 126 // AllowCommandLineParsing allows us to ignore flags passed on to us by
308 // Chromium build bots without having to explicitly disable them. 127 // Chromium build bots without having to explicitly disable them.
309 google::AllowCommandLineReparsing(); 128 google::AllowCommandLineReparsing();
310 google::ParseCommandLineFlags(&argc, &argv, true); 129 google::ParseCommandLineFlags(&argc, &argv, true);
311 130
312 if (FLAGS_automated) { 131 if (FLAGS_automated) {
313 return RunInAutomatedMode(); 132 return RunInAutomatedMode();
314 } 133 }
315 134
316 return RunInManualMode(); 135 return RunInManualMode();
317 } 136 }
318 #endif //#if !defined(WEBRTC_IOS) 137 #endif //#if !defined(WEBRTC_IOS)
OLDNEW
« no previous file with comments | « webrtc/voice_engine/test/auto_test/voe_standard_test.h ('k') | webrtc/voice_engine/test/auto_test/voe_stress_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698