Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / webrtc / voice_engine / test / win_test / WinTestDlg.h
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 #ifndef WEBRTC_VOICE_ENGINE_TEST_WIN_TEST_WINTESTDLG_H_
11 #define WEBRTC_VOICE_ENGINE_TEST_WIN_TEST_WINTESTDLG_H_
12
13 #if (_MSC_VER >= 1400)
14 #define PRINT_GET_RESULT(...) \
15     { \
16         _strMsg.Format(__VA_ARGS__); \
17         SetDlgItemText(IDC_EDIT_GET_OUTPUT, _strMsg); \
18     } \
19
20 #define TEST(x, ...) \
21     if (!(x)) \
22     { \
23         _strMsg.Format(__VA_ARGS__); \
24         SetDlgItemText(IDC_EDIT_MESSAGE, _strMsg); \
25         _strErr.Format(_T("FAILED (error=%d)"), _veBasePtr->LastError()); \
26         SetDlgItemText(IDC_EDIT_RESULT, _strErr); \
27         _failCount++; \
28         SetDlgItemInt(IDC_EDIT_N_FAILS, _failCount); \
29         SetDlgItemInt(IDC_EDIT_LAST_ERROR, _veBasePtr->LastError()); \
30     } \
31     else \
32     { \
33         _strMsg.Format(__VA_ARGS__); \
34         SetDlgItemText(IDC_EDIT_MESSAGE, _strMsg); \
35         SetDlgItemText(IDC_EDIT_RESULT, _T("OK")); \
36     } \
37
38 #define TEST2(x, ...) \
39     if (!(x)) \
40     { \
41         _strMsg.Format(__VA_ARGS__); \
42         ((CWinTestDlg*)_parentDialogPtr)->UpdateTest(true, _strMsg); \
43     } \
44     else \
45     { \
46         _strMsg.Format(__VA_ARGS__); \
47         ((CWinTestDlg*)_parentDialogPtr)->UpdateTest(false, _strMsg); \
48     }
49 #else
50 #define TEST(x, exp) \
51     if (!(x)) \
52     { \
53         _strMsg.Format(exp); \
54         SetDlgItemText(IDC_EDIT_MESSAGE, _strMsg); \
55         _strErr.Format("FAILED (error=%d)", _veBasePtr->LastError()); \
56         SetDlgItemText(IDC_EDIT_RESULT, _strErr); \
57         _failCount++; \
58         SetDlgItemInt(IDC_EDIT_N_FAILS, _failCount); \
59         SetDlgItemInt(IDC_EDIT_LAST_ERROR, _veBasePtr->LastError()); \
60     } \
61     else \
62     { \
63         _strMsg.Format(exp); \
64         SetDlgItemText(IDC_EDIT_MESSAGE, _strMsg); \
65         SetDlgItemText(IDC_EDIT_RESULT, _T("OK")); \
66     } \
67
68 #define TEST2(x, exp) \
69     if (!(x)) \
70     { \
71         _strMsg.Format(exp); \
72         ((CWinTestDlg*)_parentDialogPtr)->UpdateTest(true, _strMsg); \
73     } \
74     else \
75     { \
76         _strMsg.Format(exp); \
77         ((CWinTestDlg*)_parentDialogPtr)->UpdateTest(false, _strMsg); \
78     }
79 #endif
80
81 #include <string>
82
83 #include "webrtc/voice_engine/include/voe_base.h"
84 #include "webrtc/voice_engine/include/voe_codec.h"
85 #include "webrtc/voice_engine/include/voe_dtmf.h"
86 #include "webrtc/voice_engine/include/voe_external_media.h"
87 #include "webrtc/voice_engine/include/voe_file.h"
88 #include "webrtc/voice_engine/include/voe_hardware.h"
89 #include "webrtc/voice_engine/include/voe_network.h"
90 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h"
91 #include "webrtc/voice_engine/include/voe_video_sync.h"
92 #include "webrtc/voice_engine/include/voe_volume_control.h"
93
94 #include "webrtc/voice_engine/include/voe_audio_processing.h"
95 #include "webrtc/voice_engine/include/voe_errors.h"
96 #include "webrtc/voice_engine/include/voe_rtp_rtcp.h"
97
98 class MediaProcessImpl;
99 class RxCallback;
100 class MyTransport;
101
102 using namespace webrtc;
103
104 #define MAX_NUM_OF_CHANNELS    10
105
106 // CWinTestDlg dialog
107 class CWinTestDlg : public CDialog,
108                     public VoiceEngineObserver,
109                     public VoERTPObserver
110 {
111 // Construction
112 public:
113     CWinTestDlg(CWnd* pParent = NULL);    // standard constructor
114     virtual ~CWinTestDlg();
115
116 // Dialog Data
117     enum { IDD = IDD_WINTEST_DIALOG };
118
119     BOOL UpdateTest(bool failed, const CString& strMsg);
120
121 protected:
122     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
123
124 protected:  // VoiceEngineObserver
125     virtual void CallbackOnError(int channel, int errCode);
126
127 protected:    // VoERTPObserver
128     virtual void OnIncomingCSRCChanged(
129         int channel, unsigned int CSRC, bool added);
130     virtual void OnIncomingSSRCChanged(
131         int channel, unsigned int SSRC);
132
133 // Implementation
134 protected:
135     HICON m_hIcon;
136
137     // Generated message map functions
138     virtual BOOL OnInitDialog();
139     afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
140     afx_msg void OnPaint();
141     afx_msg HCURSOR OnQueryDragIcon();
142     DECLARE_MESSAGE_MAP()
143 public:
144     afx_msg void OnBnClickedButtonCreate1();
145     afx_msg void OnBnClickedButtonDelete1();
146
147 private:
148     VoiceEngine*    _vePtr;
149
150     VoECodec*               _veCodecPtr;
151     VoEExternalMedia*       _veExternalMediaPtr;
152     VoEVolumeControl*       _veVolumeControlPtr;
153     VoEHardware*            _veHardwarePtr;
154     VoEVideoSync*           _veVideoSyncPtr;
155     VoENetwork*             _veNetworkPtr;
156     VoEFile*                _veFilePtr;
157     VoEAudioProcessing*     _veApmPtr;
158     VoEBase*                _veBasePtr;
159     VoERTP_RTCP*            _veRtpRtcpPtr;
160
161     MyTransport*            _transportPtr;
162     MediaProcessImpl*       _externalMediaPtr;
163     RxCallback*             _rxVadObserverPtr;
164
165 private:
166     int                     _failCount;
167     CString                 _strMsg;
168     CString                 _strErr;
169     bool                    _externalTransport;
170     bool                    _externalTransportBuild;
171     int                     _checkPlayFileIn;
172     int                     _checkPlayFileIn1;
173     int                     _checkPlayFileIn2;
174     int                     _checkPlayFileOut1;
175     int                     _checkPlayFileOut2;
176     int                     _checkAGC;
177     int                     _checkAGC1;
178     int                     _checkNS;
179     int                     _checkNS1;
180     int                     _checkEC;
181     int                     _checkVAD1;
182     int                     _checkVAD2;
183     int                     _checkSrtpTx1;
184     int                     _checkSrtpTx2;
185     int                     _checkSrtpRx1;
186     int                     _checkSrtpRx2;
187     int                     _checkConference1;
188     int                     _checkConference2;
189     int                     _checkOnHold1;
190     int                     _checkOnHold2;
191     bool                    _delayEstimate1;
192     bool                    _delayEstimate2;
193     bool                    _rxVad;
194     int                     _nErrorCallbacks;
195     int                     _timerTicks;
196     std::string             _long_audio_file_path;
197
198 public:
199     afx_msg void OnBnClickedButtonCreate2();
200     afx_msg void OnBnClickedButtonDelete2();
201     afx_msg void OnCbnSelchangeComboCodec1();
202     afx_msg void OnBnClickedButtonStartListen1();
203     afx_msg void OnBnClickedButtonStopListen1();
204     afx_msg void OnBnClickedButtonStartPlayout1();
205     afx_msg void OnBnClickedButtonStopPlayout1();
206     afx_msg void OnBnClickedButtonStartSend1();
207     afx_msg void OnBnClickedButtonStopSend1();
208     afx_msg void OnCbnSelchangeComboIp2();
209     afx_msg void OnCbnSelchangeComboIp1();
210     afx_msg void OnCbnSelchangeComboCodec2();
211     afx_msg void OnBnClickedButtonStartListen2();
212     afx_msg void OnBnClickedButtonStopListen2();
213     afx_msg void OnBnClickedButtonStartPlayout2();
214     afx_msg void OnBnClickedButtonStopPlayout2();
215     afx_msg void OnBnClickedButtonStartSend2();
216     afx_msg void OnBnClickedButtonStopSend2();
217     afx_msg void OnBnClickedButtonTest11();
218     afx_msg void OnBnClickedCheckExtTrans1();
219     afx_msg void OnBnClickedCheckPlayFileIn1();
220     afx_msg void OnBnClickedCheckPlayFileOut1();
221     afx_msg void OnBnClickedCheckExtTrans2();
222     afx_msg void OnBnClickedCheckPlayFileIn2();
223     afx_msg void OnBnClickedCheckPlayFileOut2();
224     afx_msg void OnBnClickedCheckPlayFileIn();
225     afx_msg void OnBnClickedCheckPlayFileOut();
226     afx_msg void OnCbnSelchangeComboRecDevice();
227     afx_msg void OnCbnSelchangeComboPlayDevice();
228     afx_msg void OnBnClickedCheckExtMediaIn1();
229     afx_msg void OnBnClickedCheckExtMediaOut1();
230     afx_msg void OnNMReleasedcaptureSliderInputVolume(NMHDR *pNMHDR, LRESULT *pResult);
231     afx_msg void OnNMReleasedcaptureSliderOutputVolume(NMHDR *pNMHDR, LRESULT *pResult);
232     afx_msg void OnTimer(UINT_PTR nIDEvent);
233     afx_msg void OnBnClickedCheckAgc();
234     CString _strComboIp1;
235     CString _strComboIp2;
236     afx_msg void OnBnClickedCheckNs();
237     afx_msg void OnBnClickedCheckEc();
238     afx_msg void OnBnClickedCheckVad1();
239     afx_msg void OnBnClickedCheckVad2();
240     afx_msg void OnBnClickedCheckExtMediaIn2();
241     afx_msg void OnBnClickedCheckExtMediaOut2();
242     afx_msg void OnBnClickedCheckMuteIn();
243     afx_msg void OnBnClickedCheckMuteIn1();
244     afx_msg void OnBnClickedCheckMuteIn2();
245     afx_msg void OnBnClickedCheckSrtpTx1();
246     afx_msg void OnBnClickedCheckSrtpRx1();
247     afx_msg void OnBnClickedCheckSrtpTx2();
248     afx_msg void OnBnClickedCheckSrtpRx2();
249     afx_msg void OnBnClickedButtonDtmf1();
250     afx_msg void OnBnClickedCheckRecMic();
251     afx_msg void OnBnClickedButtonDtmf2();
252     afx_msg void OnBnClickedButtonTest1();
253     afx_msg void OnBnClickedCheckConference1();
254     afx_msg void OnBnClickedCheckConference2();
255     afx_msg void OnBnClickedCheckOnHold1();
256     afx_msg void OnBnClickedCheckOnHold2();
257     afx_msg void OnBnClickedCheckExtMediaIn();
258     afx_msg void OnBnClickedCheckExtMediaOut();
259     afx_msg void OnLbnSelchangeListCodec1();
260     afx_msg void OnNMReleasedcaptureSliderPanLeft(NMHDR *pNMHDR, LRESULT *pResult);
261     afx_msg void OnNMReleasedcaptureSliderPanRight(NMHDR *pNMHDR, LRESULT *pResult);
262     afx_msg void OnBnClickedButtonVersion();
263     afx_msg void OnBnClickedCheckDelayEstimate1();
264     afx_msg void OnBnClickedCheckRxvad();
265     afx_msg void OnBnClickedCheckAgc1();
266     afx_msg void OnBnClickedCheckNs1();
267     afx_msg void OnBnClickedCheckRecCall();
268     afx_msg void OnBnClickedCheckTypingDetection();
269     afx_msg void OnBnClickedCheckRED();
270     afx_msg void OnBnClickedButtonClearErrorCallback();
271     afx_msg void OnBnClickedCheckBwe1();
272 };
273
274 #endif  // WEBRTC_VOICE_ENGINE_TEST_WIN_TEST_WINTESTDLG_H_