Using gmock for unit test
[platform/core/api/component-manager.git] / mock / aul_mock.cc
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17
18 #include <gio/gio.h>
19
20
21 #include "aul_mock.h"
22 #include "mock_hook.h"
23 #include "test_fixture.h"
24
25 extern "C" int aul_comp_context_foreach_comp_context(
26     aul_comp_context_cb callback, void *user_data)
27 {
28   return MOCK_HOOK_P2(AulMock, aul_comp_context_foreach_comp_context,
29         callback, user_data);
30 }
31
32 extern "C" int aul_comp_context_create(const char *comp_id,
33     aul_comp_context_h *handle)
34 {
35   return MOCK_HOOK_P2(AulMock, aul_comp_context_create, comp_id, handle);
36 }
37
38 extern "C" int aul_comp_context_is_running(aul_comp_context_h handle,
39     bool *running)
40 {
41   return MOCK_HOOK_P2(AulMock, aul_comp_context_is_running, handle, running);
42 }
43
44 extern "C" int aul_comp_info_create(const char *comp_id,
45     aul_comp_info_h *handle)
46 {
47   return MOCK_HOOK_P2(AulMock, aul_comp_info_create, comp_id, handle);
48 }
49
50 extern "C" int aul_comp_context_resume(aul_comp_context_h handle)
51 {
52   return MOCK_HOOK_P1(AulMock, aul_comp_context_resume, handle);
53 }
54
55 extern "C" int aul_comp_context_terminate_bg_comp(aul_comp_context_h handle)
56 {
57   return MOCK_HOOK_P1(AulMock, aul_comp_context_terminate_bg_comp, handle);
58 }
59
60 extern "C" int aul_comp_context_get_app_id(aul_comp_context_h context,
61     const char **app_id)
62 {
63   return MOCK_HOOK_P2(AulMock, aul_comp_context_get_app_id, context, app_id);
64 }
65
66 extern "C" int aul_comp_context_get_comp_id(aul_comp_context_h context,
67     const char **comp_id)
68 {
69   return MOCK_HOOK_P2(AulMock, aul_comp_context_get_comp_id, context, comp_id);
70 }
71
72 extern "C" int aul_comp_context_get_instance_id(aul_comp_context_h context,
73     const char **instance_id)
74 {
75   return MOCK_HOOK_P2(AulMock, aul_comp_context_get_instance_id,
76       context, instance_id);
77 }
78
79 extern "C" int aul_comp_context_get_status(aul_comp_context_h context,
80     int *status)
81 {
82   return MOCK_HOOK_P2(AulMock, aul_comp_context_get_status,
83       context, status);
84 }
85
86 extern "C" int aul_comp_context_is_sub_comp(aul_comp_context_h context,
87     bool *is_sub_comp)
88 {
89   return MOCK_HOOK_P2(AulMock, aul_comp_context_is_sub_comp,
90       context, is_sub_comp);
91 }
92
93 extern "C" int aul_comp_context_clone(aul_comp_context_h handle,
94     aul_comp_context_h *clone)
95 {
96   return MOCK_HOOK_P2(AulMock, aul_comp_context_clone, handle, clone);
97 }
98
99 extern "C" int aul_comp_info_get_app_id(aul_comp_info_h handle,
100     const char **app_id)
101 {
102   return MOCK_HOOK_P2(AulMock, aul_comp_info_get_app_id, handle, app_id);
103 }
104
105 extern "C" int aul_comp_info_get_comp_id(
106     aul_comp_info_h handle, const char **comp_id)
107 {
108   return MOCK_HOOK_P2(AulMock, aul_comp_info_get_comp_id, handle, comp_id);
109 }
110
111 extern "C" int aul_comp_info_get_type(aul_comp_info_h handle, const char **type)
112 {
113   return MOCK_HOOK_P2(AulMock, aul_comp_info_get_type, handle, type);
114 }
115
116 extern "C" int aul_comp_info_is_icon_display(aul_comp_info_h handle,
117     bool *icon_display)
118 {
119   return MOCK_HOOK_P2(AulMock,
120       aul_comp_info_is_icon_display, handle, icon_display);
121 }
122
123 extern "C" int aul_comp_info_is_taskmanage(aul_comp_info_h handle,
124     bool *taskmanage)
125 {
126   return MOCK_HOOK_P2(AulMock, aul_comp_info_is_taskmanage, handle, taskmanage);
127 }
128
129 extern "C" int aul_comp_info_get_icon(aul_comp_info_h handle, const char **icon)
130 {
131   return MOCK_HOOK_P2(AulMock, aul_comp_info_get_icon, handle, icon);
132 }
133
134 extern "C" int aul_comp_info_get_label(aul_comp_info_h handle,
135     const char **label)
136 {
137   return MOCK_HOOK_P2(AulMock, aul_comp_info_get_label, handle, label);
138 }
139
140 extern "C" int aul_comp_info_get_localed_label(aul_comp_info_h handle,
141     const char *locale, const char **label)
142 {
143   return MOCK_HOOK_P3(AulMock, aul_comp_info_get_localed_label,
144       handle, locale, label);
145 }
146
147 extern "C" int aul_comp_info_clone(aul_comp_info_h handle,
148     aul_comp_info_h *clone)
149 {
150   return MOCK_HOOK_P2(AulMock, aul_comp_info_clone, handle, clone);
151 }
152
153 extern "C" int aul_comp_context_pause(aul_comp_context_h handle)
154 {
155   return MOCK_HOOK_P1(AulMock, aul_comp_context_pause, handle);
156 }
157
158 extern "C" int aul_comp_context_terminate(aul_comp_context_h handle)
159 {
160   return MOCK_HOOK_P1(AulMock, aul_comp_context_terminate, handle);
161 }