Fix coverity issue 1149129
[apps/native/volume-app.git] / test / test_main.c
1 #include "../inc/test.h"
2 #if (TEST_MODE == TEST_APP)
3
4 #include "control/app_control.h"
5
6 #include "unit/inc/unit.h"
7 #include "function_test/function_test.h"
8 #include "feature_test/feature_test.h"
9
10 #include <Elementary.h>
11
12 static struct {
13         Ecore_Timer * feature_test_run_timer;
14 } s_info = {
15         .feature_test_run_timer = NULL,
16 };
17
18 static Eina_Bool __run_timer_callback(void * data);
19
20 static bool __create(void * data)
21 {
22 }
23
24 static void __app_control(app_control_h app_control_handle, void * data)
25 {
26         app_control(app_control_handle, data);
27 }
28
29 static void __resume(void * data)
30 {
31         app_resume(data);
32
33         if (s_info.feature_test_run_timer) {
34                 ecore_timer_del(s_info.feature_test_run_timer);
35                 s_info.feature_test_run_timer = NULL;
36         }
37
38         s_info.feature_test_run_timer = ecore_timer_add(1, __run_timer_callback, NULL);
39 }
40
41 static void __pause(void * data)
42 {
43         app_pause(data);
44 }
45
46 static void __terminate(void * data)
47 {
48         app_terminate(data);
49 }
50
51 static Eina_Bool __run_timer_callback(void * data)
52 {
53         s_info.feature_test_run_timer = NULL;
54         return ECORE_CALLBACK_CANCEL;
55 }
56
57 int main(int argc, char *argv[])
58 {
59         unit_init();
60
61         ui_app_lifecycle_callback_s lifecycle_callback = {NULL, };
62
63         lifecycle_callback.create = __create;
64         lifecycle_callback.app_control = __app_control;
65         lifecycle_callback.resume = __resume;
66         lifecycle_callback.pause = __pause;
67         lifecycle_callback.terminate = __terminate;
68
69         int ret = ui_app_main(argc, argv, &lifecycle_callback, NULL);
70         if (ret != APP_ERROR_NONE)
71                 __T("app_main() is failed. err = %d", ret);
72
73         unit_fini();
74
75         return 0;
76 }
77
78 #endif