FileMgrSrvTest.h
11.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2005
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*******************************************************************************
* Filename:
* ---------
* FileMgrSrvTest.h
*
* Project:
* --------
* MAUI
*
* Description:
* ------------
* File Manager service internal prototype header.
*
* Author:
* -------
* -------
*
*==============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
*
*
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*==============================================================================
*******************************************************************************/
#ifndef SRV_FMGR_TEST_H
#define SRV_FMGR_TEST_H
#ifndef _FMGR_INTERNAL_SOURCE_C_
#error "This header is only for FileManager source!"
#endif
#if defined(SRV_FMGR_TESTBED_ENABLE)
enum SrvFtstTestTypeEnum
{
SRV_FTST_TT_DO,
SRV_FTST_TT_MENU,
SRV_FTST_TT_TEST,
SRV_FTST_TT_END_OF_ENUM
};
enum SrvFtstTestResultEnum
{
SRV_FTST_TR_FAIL = 0,
SRV_FTST_TR_OK,
SRV_FTST_TR_END_OF_ENUM
};
typedef SrvFtstTestResultEnum (*SrvFtstTestFuncPtr)(U32 param); // Test invoke function pointer type
struct SrvFtstMenuItem
{
const WCHAR* title; // Test title string
SrvFtstTestFuncPtr testFuncPtr; // Test invoke function
U32 param; // Test userdata
SrvFtstTestTypeEnum tt; // Test type
};
struct SrvFtstMenu
{
const WCHAR *title;
const SrvFtstMenuItem *items;
S32 count;
};
struct SrvFtstMenuStack
{
const SrvFtstMenu *menu;
S32 focusIdx;
};
// Define Menu Macro:
// Example:
// SRV_FTST_BEGIN_DEF_MENU(L"Venus RT", main)
// SRV_FTST_DEF_ITEM_DO(L"Auto test", srv_ftst_rt_auto_test, 0)
// SRV_FTST_DEF_ITEM_MENU(L"Test Item", venustest)
// SRV_FTST_END_DEF_MENU(main)
#define SRV_FTST_BEGIN_DEF_MENU(_title, _name) \
const WCHAR* g_menu_title_##_name = (WCHAR*)_title; \
static const SrvFtstMenuItem g_items_##_name[] = {
#define SRV_FTST_END_DEF_MENU(_name) \
}; \
static const SrvFtstMenu g_menu_##_name = { \
g_menu_title_##_name, g_items_##_name, (sizeof(g_items_##_name) / sizeof(g_items_##_name[0])) \
};
#define SRV_FTST_DEF_ITEM_DO(_title, _func, _param) {(WCHAR*)_title, _func, (U32)_param, SRV_FTST_TT_DO},
#define SRV_FTST_DEF_ITEM_TEST(_title, _func, _param) {(WCHAR*)_title, _func, (U32)_param, SRV_FTST_TT_TEST},
#define SRV_FTST_DEF_ITEM_MENU(_title, _submenu) {(WCHAR*)_title, srv_ftst_rt_menu_enter, (U32)&g_menu_##_submenu, SRV_FTST_TT_MENU},
#define SRV_FTST_MENU(_name) g_menu_##_name
#define SRV_FTST_START(_class) \
do \
{ \
srv_ftst_rt_entry(); \
SrvFtstTestItem* scr = new _class(); \
srv_ftst_testcase_start(scr, MMI_TRUE); \
} while(0)
#define SRV_FTST_CHECK(x) check(x, NULL, __FILE__, __LINE__)
#if defined(SRV_FMGR_TESTBED_ENABLE) && !defined(__MTK_TARGET__) /* Modis */
#define SRV_FMGR_TEST_PRINT0(str) kal_printf(str)
#define SRV_FMGR_TEST_PRINT1(str,p1) kal_printf(str,p1)
#define SRV_FMGR_TEST_PRINT2(str,p1,p2) kal_printf(str,p1,p2)
#define SRV_FMGR_TEST_PRINT3(str,p1,p2,p3) kal_printf(str,p1,p2,p3)
#elif 0 //defined(SRV_FMGR_TESTBED_ENABLE) /* Target */
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#else
#define SRV_FMGR_TEST_PRINT0(str)
#define SRV_FMGR_TEST_PRINT1(str,p1)
#define SRV_FMGR_TEST_PRINT2(str,p1,p2)
#define SRV_FMGR_TEST_PRINT3(str,p1,p2,p3)
#endif
/*****************************************************************************
* Class ISrvFtstRtScreenInterface
*****************************************************************************/
#define SRV_FTST_RT_TESTCASE_NEEDCONFIRM (-1)
#define SRV_FTST_RT_END_TESTCASE (-5000)
class ISrvFtstTestItemInterface
{
// Method
public:
// Query the final test result
// RETURNS:
// MMI_TRUE if the test is successful
virtual MMI_BOOL getTestResult() = 0;
// Timer handler to triggle phase change
virtual void step() = 0;
// Start the test case
virtual void testStart() = 0;
// End the test case
virtual void testEnd() = 0;
// start test case, and return how many phase you need to test
// RETURNS:
// How many phase about this testcase.
virtual S32 start() = 0;
// start test case phase, and return how long time (ms) you need to take
// RETURNS:
// How many time the phase takes, after this time,
// Return SRV_FTST_RT_TESTCASE_NEEDCONFIRM means the phase time is not fixed.
// Maybe the testcase needs user's input.
// After the phase is end, you should call endPhase API.
// Return SRV_FTST_RT_END_TESTCASE you want to end the testcase.
virtual S32 phase(
S32 idx // [IN] the phase index, this value is Zero index
) = 0;
// Verify whether the testcase is success
virtual void end() = 0;
};
/*****************************************************************************
* Class SrvFtstRtScr
*****************************************************************************/
class SrvFtstTestItem : public ISrvFtstTestItemInterface
{
// Variable
public:
//VfxTextFrame *m_title;
//VfxTextFrame *m_status;
MMI_BOOL m_fail;
S32 m_phaseCount, m_phase;
MMI_BOOL m_phasePendding;
MMI_BOOL m_waitConfirm;
FS_HANDLE m_fp;
static void *operator new (
size_t size // [IN] The memory size to allocate
);
static void operator delete (
void *ptr // [IN] pointer to instance
);
// Constructor / Destructor
public:
// Default constructor
SrvFtstTestItem()
: m_fail(MMI_FALSE)
, m_phaseCount(0), m_phase(0), m_phasePendding(MMI_FALSE)
, m_waitConfirm(MMI_FALSE)
, m_fp(0)
{
}
virtual ~SrvFtstTestItem()
{
if(m_fp)
FS_Close(m_fp);
}
// Method
public:
// Set the test case to fail
void fail()
{
m_fail = MMI_TRUE;
}
// Verify the result. If the statement is false, the testcase fail.
// And then the report will show testName is fail.
MMI_BOOL check(
bool statement, // [IN] The check statement
const WCHAR *testName, // [IN] The test item name
const char *filename,
S32 fileline
);
// Query the final test result
// RETURNS:
// MMI_TRUE if the test is successful
MMI_BOOL getTestResult()
{
return m_fail ? MMI_FALSE : MMI_TRUE;
}
// Timer handler to triggle phase change
void step();
// Triggle to next phase when phase return 0, if bFatalError = True,
// it will end directly
void endPhase(MMI_BOOL bFatalError = MMI_FALSE);
S32 getPhase()
{
if(m_phasePendding)
return m_phase - 1;
return m_phase;
}
void writeString(const WCHAR* buffer, MMI_BOOL newline = MMI_TRUE);
void verifyOutput(void);
// Overridable
public:
// start test case, and return how many phase you need to test
// RETURNS:
// How many phase about this testcase
virtual S32 start() { return 0; }
// start test case phase, and return how long time (ms) you need to take
// RETURNS:
// How many time the phase takes, after this time,
// Return < 0 means the phase time is not fixed.
// Maybe the testcase needs user's input.
// After the phase is end, you should call endPhase.
virtual S32 phase(
S32 idx // [IN] the phase index, this value is Zero index
)
{
return SRV_FTST_RT_END_TESTCASE;
}
// Verify whether the testcase is success
virtual void end() {}
virtual mmi_ret onProc(mmi_event_struct *param)
{
return MMI_RET_OK;
}
virtual const WCHAR* getWritePath(WCHAR* path, S32 size)
{
return NULL;
}
virtual const WCHAR* getCheckPath(WCHAR* path, S32 size)
{
return NULL;
}
// Override
public:
// Start the test case
void testStart();
// End the test case
void testEnd();
protected:
static mmi_ret _Proc(mmi_event_struct *param)
{
SrvFtstTestItem* self = reinterpret_cast<SrvFtstTestItem*>(param->user_data);
return self->onProc(param);
}
};
/*****************************************************************************
* Global Function
*****************************************************************************/
void srv_ftst_rt_entry(void);
void srv_ftst_rt_entry_rotate(void);
void srv_ftst_rt_leave(void);
void srv_ftst_rt_autotest_trigger(void);
void srv_ftst_rt_autotest_result_entry(void);
void srv_ftst_rt_proc_call(media_in_proc_call_type func, kal_uint32 func_arg1, void *func_arg2);
void srv_ftst_add_fail_log(const WCHAR *testName);
void srv_ftst_rt_verify(void);
void srv_ftst_rt_autotest_step(void);
void srv_ftst_rt_autotest_result_entry(void);
void srv_ftst_rt_autotest_trigger(void);
void srv_ftst_rt_testcase_step(void);
void srv_ftst_testcase_start(ISrvFtstTestItemInterface* testcase, MMI_BOOL isCategory);
void srv_ftst_testcase_end();
S32 srv_ftst_rt_compare_file(const WCHAR* src_path, const WCHAR* dest_path);
#ifdef __cplusplus
extern "C"
{
#endif
// This is main entry function for our testing
extern void srv_ftst_rt_main_entry(void);
#ifdef __cplusplus
}
#endif
#endif
#endif /* SRV_FMGR_TEST_H */