4e048fc1e0750e45a5dcaf39297d32c309e6d606
[platform/core/appfw/appcore-widget.git] / test / unit_tests / mock / gio_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 #include "unit_tests/mock/gio_mock.h"
18
19 #include <gio/gio.h>
20
21 #include "unit_tests/mock/mock_hook.h"
22 #include "unit_tests/mock/test_fixture.h"
23
24 extern "C" GDBusConnection* g_bus_get_sync(GBusType type,
25     GCancellable* cancellable, GError** error) {
26   return MOCK_HOOK_P3(GioMock, g_bus_get_sync, type, cancellable, error);
27 }
28
29 extern "C" GDBusMessage* g_dbus_connection_send_message_with_reply_sync(
30     GDBusConnection* conn, GDBusMessage* msg, GDBusSendMessageFlags flags,
31     gint timeout, volatile guint32* out_serial, GCancellable* cancellable,
32     GError** error) {
33   return MOCK_HOOK_P7(GioMock, g_dbus_connection_send_message_with_reply_sync,
34       conn, msg, flags, timeout, out_serial, cancellable, error);
35 }
36
37 extern "C" GDBusMessage* g_dbus_message_new_method_call(const gchar* arg0,
38     const gchar* arg1, const gchar* arg2, const gchar* arg3) {
39   return MOCK_HOOK_P4(GioMock, g_dbus_message_new_method_call, arg0, arg1, arg2,
40       arg3);
41 }
42
43 extern "C" void g_dbus_message_set_body(GDBusMessage* arg0, GVariant* arg1) {
44   return MOCK_HOOK_P2(GioMock, g_dbus_message_set_body, arg0, arg1);
45 }
46
47 extern "C" GVariant* g_dbus_message_get_body(GDBusMessage* arg0) {
48   return MOCK_HOOK_P1(GioMock, g_dbus_message_get_body, arg0);
49 }
50
51 extern "C" gboolean g_dbus_connection_emit_signal(GDBusConnection* arg0,
52     const gchar* arg1, const gchar* arg2, const gchar* arg3, const gchar* arg4,
53     GVariant* arg5, GError** arg6) {
54   return MOCK_HOOK_P7(GioMock, g_dbus_connection_emit_signal,
55       arg0, arg1, arg2, arg3, arg4, arg5, arg6);
56 }
57
58 extern "C" GDBusNodeInfo* g_dbus_node_info_new_for_xml(
59     const gchar* arg0, GError** arg1) {
60   return MOCK_HOOK_P2(GioMock, g_dbus_node_info_new_for_xml, arg0, arg1);
61 }
62
63 extern "C" guint g_dbus_connection_register_object(GDBusConnection* arg0,
64     const gchar* arg1, GDBusInterfaceInfo* arg2,
65     const GDBusInterfaceVTable* arg3, gpointer arg4,
66     GDestroyNotify arg5, GError** arg6) {
67   return MOCK_HOOK_P7(GioMock, g_dbus_connection_register_object,
68       arg0, arg1, arg2, arg3, arg4, arg5, arg6);
69 }
70
71 extern "C" guint g_bus_own_name_on_connection(GDBusConnection* arg0,
72     const gchar* arg1, GBusNameOwnerFlags arg2,
73     GBusNameAcquiredCallback arg3, GBusNameLostCallback arg4,
74     gpointer arg5, GDestroyNotify arg6) {
75   return MOCK_HOOK_P7(GioMock, g_bus_own_name_on_connection,
76       arg0, arg1, arg2, arg3, arg4, arg5, arg6);
77 }
78
79 extern "C" guint g_dbus_connection_signal_subscribe(GDBusConnection* arg0,
80     const gchar* arg1, const gchar* arg2, const gchar* arg3, const gchar* arg4,
81     const gchar* arg5, GDBusSignalFlags arg6, GDBusSignalCallback arg7,
82     gpointer arg8, GDestroyNotify arg9) {
83   return MOCK_HOOK_P10(GioMock, g_dbus_connection_signal_subscribe,
84       arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
85 }
86
87 extern "C" void g_dbus_connection_send_message_with_reply(GDBusConnection* arg0,
88     GDBusMessage* arg1, GDBusSendMessageFlags arg2, gint arg3,
89     volatile guint32* arg4, GCancellable* arg5, GAsyncReadyCallback arg6,
90     gpointer arg7) {
91   return MOCK_HOOK_P8(GioMock, g_dbus_connection_send_message_with_reply,
92       arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
93 }
94
95 extern "C" GDBusMessage* g_dbus_connection_send_message_with_reply_finish(
96   GDBusConnection* arg0, GAsyncResult* arg1, GError** arg2) {
97   return MOCK_HOOK_P3(GioMock, g_dbus_connection_send_message_with_reply_finish,
98       arg0, arg1, arg2);
99 }