OLD | NEW |
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/test/auto_test/automated_mode.h" | 19 #include "webrtc/voice_engine/test/auto_test/automated_mode.h" |
20 #include "webrtc/voice_engine/test/auto_test/voe_test_defines.h" | 20 #include "webrtc/voice_engine/test/auto_test/voe_test_defines.h" |
21 #include "webrtc/voice_engine/voice_engine_defines.h" | 21 #include "webrtc/voice_engine/voice_engine_defines.h" |
22 | 22 |
23 DEFINE_bool(include_timing_dependent_tests, true, | 23 DEFINE_bool(include_timing_dependent_tests, true, |
24 "If true, we will include tests / parts of tests that are known " | 24 "If true, we will include tests / parts of tests that are known " |
25 "to break in slow execution environments (such as valgrind)."); | 25 "to break in slow execution environments (such as valgrind)."); |
26 DEFINE_bool(automated, false, | 26 DEFINE_bool(automated, false, |
27 "If true, we'll run the automated tests we have in noninteractive " | 27 "If true, we'll run the automated tests we have in noninteractive " |
28 "mode."); | 28 "mode."); |
29 | 29 |
30 using namespace webrtc; | 30 namespace webrtc { |
31 | |
32 namespace voetest { | 31 namespace voetest { |
33 | 32 |
34 int dummy = 0; // Dummy used in different functions to avoid warnings | 33 int dummy = 0; // Dummy used in different functions to avoid warnings |
35 | 34 |
36 void SubAPIManager::DisplayStatus() const { | 35 void SubAPIManager::DisplayStatus() const { |
37 TEST_LOG("Supported sub APIs:\n\n"); | 36 TEST_LOG("Supported sub APIs:\n\n"); |
38 if (_base) | 37 if (_base) |
39 TEST_LOG(" Base\n"); | 38 TEST_LOG(" Base\n"); |
40 if (_codec) | 39 if (_codec) |
41 TEST_LOG(" Codec\n"); | 40 TEST_LOG(" Codec\n"); |
(...skipping 18 matching lines...) Expand all Loading... |
60 if (!_hardware) | 59 if (!_hardware) |
61 TEST_LOG(" Hardware\n"); | 60 TEST_LOG(" Hardware\n"); |
62 if (!_network) | 61 if (!_network) |
63 TEST_LOG(" Network\n"); | 62 TEST_LOG(" Network\n"); |
64 if (!_rtp_rtcp) | 63 if (!_rtp_rtcp) |
65 TEST_LOG(" RTP_RTCP\n"); | 64 TEST_LOG(" RTP_RTCP\n"); |
66 if (!_apm) | 65 if (!_apm) |
67 TEST_LOG(" AudioProcessing\n"); | 66 TEST_LOG(" AudioProcessing\n"); |
68 ANL(); | 67 ANL(); |
69 } | 68 } |
70 } // namespace voetest | |
71 | 69 |
72 int RunInManualMode() { | 70 int RunInManualMode() { |
73 using namespace voetest; | |
74 | |
75 SubAPIManager api_manager; | 71 SubAPIManager api_manager; |
76 api_manager.DisplayStatus(); | 72 api_manager.DisplayStatus(); |
77 | 73 |
78 printf("----------------------------\n"); | 74 printf("----------------------------\n"); |
79 printf("Select type of test\n\n"); | 75 printf("Select type of test\n\n"); |
80 printf(" (0) Quit\n"); | 76 printf(" (0) Quit\n"); |
81 printf(" (1) Standard test\n"); | 77 printf(" (1) Standard test\n"); |
82 printf("\n: "); | 78 printf("\n: "); |
83 | 79 |
84 int selection(0); | 80 int selection(0); |
85 dummy = scanf("%d", &selection); | 81 dummy = scanf("%d", &selection); |
86 | 82 |
87 switch (selection) { | 83 switch (selection) { |
88 case 0: | 84 case 0: |
89 return 0; | 85 return 0; |
90 case 1: | 86 case 1: |
91 TEST_LOG("\n\n+++ Running standard tests +++\n\n"); | 87 TEST_LOG("\n\n+++ Running standard tests +++\n\n"); |
92 // Currently, all googletest-rewritten tests are in the "automated" suite. | 88 // Currently, all googletest-rewritten tests are in the "automated" suite. |
93 return RunInAutomatedMode(); | 89 return RunInAutomatedMode(); |
94 default: | 90 default: |
95 TEST_LOG("Invalid selection!\n"); | 91 TEST_LOG("Invalid selection!\n"); |
96 return 0; | 92 return 0; |
97 } | 93 } |
98 } | 94 } |
99 | 95 |
100 // ---------------------------------------------------------------------------- | 96 } // namespace voetest |
101 // main | 97 } // namespace webrtc |
102 // ---------------------------------------------------------------------------- | |
103 | 98 |
104 #if !defined(WEBRTC_IOS) | 99 #if !defined(WEBRTC_IOS) |
105 int main(int argc, char** argv) { | 100 int main(int argc, char** argv) { |
106 // This function and RunInAutomatedMode is defined in automated_mode.cc | 101 // This function and RunInAutomatedMode is defined in automated_mode.cc |
107 // to avoid macro clashes with googletest (for instance ASSERT_TRUE). | 102 // to avoid macro clashes with googletest (for instance ASSERT_TRUE). |
108 InitializeGoogleTest(&argc, argv); | 103 webrtc::voetest::InitializeGoogleTest(&argc, argv); |
109 // AllowCommandLineParsing allows us to ignore flags passed on to us by | 104 // AllowCommandLineParsing allows us to ignore flags passed on to us by |
110 // Chromium build bots without having to explicitly disable them. | 105 // Chromium build bots without having to explicitly disable them. |
111 google::AllowCommandLineReparsing(); | 106 google::AllowCommandLineReparsing(); |
112 google::ParseCommandLineFlags(&argc, &argv, true); | 107 google::ParseCommandLineFlags(&argc, &argv, true); |
113 | 108 |
114 if (FLAGS_automated) { | 109 if (FLAGS_automated) { |
115 return RunInAutomatedMode(); | 110 return webrtc::voetest::RunInAutomatedMode(); |
116 } | 111 } |
117 | 112 |
118 return RunInManualMode(); | 113 return webrtc::voetest::RunInManualMode(); |
119 } | 114 } |
120 #endif //#if !defined(WEBRTC_IOS) | 115 #endif //#if !defined(WEBRTC_IOS) |
OLD | NEW |