Note: We no longer publish the latest version of our code here. We primarily use a kumc-bmi github organization. The heron ETL repository, in particular, is not public. Peers in the informatics community should see MultiSiteDev for details on requesting access.

source: webrtc/webrtc/modules/audio_device/test/audio_device_test_func.cc @ 0:4bda6873e34c

pub_scrub_3792 tip
Last change on this file since 0:4bda6873e34c was 0:4bda6873e34c, checked in by Michael Prittie <mprittie@…>, 6 years ago

Scrubbed password for publication.

File size: 4.5 KB
Line 
1/*
2 *  Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 *
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
6 *  tree. An additional intellectual property rights grant can be found
7 *  in the file PATENTS.  All contributing project authors may
8 *  be found in the AUTHORS file in the root of the source tree.
9 */
10
11#include <stdio.h>
12#include "webrtc/modules/audio_device/test/audio_device_test_defines.h"
13#include "webrtc/modules/audio_device/test/func_test_manager.h"
14
15#ifndef __GNUC__
16// Disable warning message 4996 ('scanf': This function or variable may be unsafe)
17#pragma warning( disable : 4996 )
18#endif
19
20using namespace webrtc;
21
22int func_test(int);
23
24// ----------------------------------------------------------------------------
25//  main()
26// ----------------------------------------------------------------------------
27
28#if !defined(WEBRTC_IOS)
29int main(int /*argc*/, char* /*argv*/[])
30{
31    func_test(0);
32}
33#endif
34
35// ----------------------------------------------------------------------------
36//  func_test()
37// ----------------------------------------------------------------------------
38
39int func_test(int sel)
40{
41    TEST_LOG("=========================================\n");
42    TEST_LOG("Func Test of the WebRtcAudioDevice Module\n");
43    TEST_LOG("=========================================\n\n");
44
45    // Initialize the counters here to get rid of "unused variables" warnings.
46    warningCount = 0;
47
48    FuncTestManager funcMgr;
49
50    funcMgr.Init();
51
52    bool quit(false);
53
54    while (!quit)
55    {
56        TEST_LOG("---------------------------------------\n");
57        TEST_LOG("Select type of test\n\n");
58        TEST_LOG("  (0) Quit\n");
59        TEST_LOG("  (1) All\n");
60        TEST_LOG("- - - - - - - - - - - - - - - - - - - -\n");
61        TEST_LOG("  (2) Audio-layer selection\n");
62        TEST_LOG("  (3) Device enumeration\n");
63        TEST_LOG("  (4) Device selection\n");
64        TEST_LOG("  (5) Audio transport\n");
65        TEST_LOG("  (6) Speaker volume\n");
66        TEST_LOG("  (7) Microphone volume\n");
67        TEST_LOG("  (8) Speaker mute\n");
68        TEST_LOG("  (9) Microphone mute\n");
69        TEST_LOG(" (10) Microphone boost\n");
70        TEST_LOG(" (11) Microphone AGC\n");
71        TEST_LOG(" (12) Loopback measurements\n");
72        TEST_LOG(" (13) Device removal\n");
73        TEST_LOG(" (14) Advanced mobile device API\n");
74        TEST_LOG(" (66) XTEST\n");
75        TEST_LOG("- - - - - - - - - - - - - - - - - - - -\n");
76        TEST_LOG("\n: ");
77
78        int selection(0);
79        enum TestType testType(TTInvalid);
80
81SHOW_MENU:
82
83        if (sel > 0)
84        {
85            selection = sel;
86        }
87        else
88        {
89            if (scanf("%d", &selection) < 0) {
90              perror("Failed to get selection.");
91            }
92        }
93
94        switch (selection)
95        {
96            case 0:
97                quit = true;
98                break;
99            case 1:
100                testType = TTAll;
101                break;
102            case 2:
103                testType = TTAudioLayerSelection;
104                break;
105            case 3:
106                testType = TTDeviceEnumeration;
107                break;
108            case 4:
109                testType = TTDeviceSelection;
110                break;
111            case 5:
112                testType = TTAudioTransport;
113                break;
114            case 6:
115                testType = TTSpeakerVolume;
116                break;
117            case 7:
118                testType = TTMicrophoneVolume;
119                break;
120            case 8:
121                testType = TTSpeakerMute;
122                break;
123            case 9:
124                testType = TTMicrophoneMute;
125                break;
126            case 10:
127                testType = TTMicrophoneBoost;
128                break;
129            case 11:
130                testType = TTMicrophoneAGC;
131                break;
132            case 12:
133                testType = TTLoopback;
134                break;
135            case 13:
136                testType = TTDeviceRemoval;
137                break;
138            case 14:
139                testType = TTMobileAPI;
140                break;
141            case 66:
142                testType = TTTest;
143                break;
144            default:
145                testType = TTInvalid;
146                TEST_LOG(": ");
147                goto SHOW_MENU;
148                break;
149           }
150
151        funcMgr.DoTest(testType);
152
153        if (sel > 0)
154        {
155            quit = true;
156        }
157    }
158
159    funcMgr.Close();
160
161    return 0;
162}
Note: See TracBrowser for help on using the repository browser.