Implement gtest for every public API
[platform/core/appfw/message-port.git] / 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 "gio_mock.h"
18
19 #include "mock_hook.h"
20 #include "test_fixture.h"
21
22 extern "C" GDBusConnection* g_bus_get_sync(GBusType type,
23     GCancellable* cancellable, GError** error) {
24   return MOCK_HOOK_P3(GioMock, g_bus_get_sync, type, cancellable, error);
25 }
26
27 extern "C" GDBusMessage* g_dbus_connection_send_message_with_reply_sync(
28     GDBusConnection* conn, GDBusMessage* msg, GDBusSendMessageFlags flags,
29     gint timeout, volatile guint32* out_serial, GCancellable* cancellable,
30     GError** error) {
31   return MOCK_HOOK_P7(GioMock, g_dbus_connection_send_message_with_reply_sync,
32       conn, msg, flags, timeout, out_serial, cancellable, error);
33 }
34
35 extern "C" GDBusMessage* g_dbus_message_new_method_call(const gchar* arg0,
36     const gchar* arg1, const gchar* arg2, const gchar* arg3) {
37   return MOCK_HOOK_P4(GioMock, g_dbus_message_new_method_call, arg0, arg1, arg2,
38       arg3);
39 }
40
41 extern "C" void g_dbus_message_set_body(GDBusMessage* arg0, GVariant* arg1) {
42   return MOCK_HOOK_P2(GioMock, g_dbus_message_set_body, arg0, arg1);
43 }
44
45 extern "C" GVariant* g_dbus_message_get_body(GDBusMessage* arg0) {
46   return MOCK_HOOK_P1(GioMock, g_dbus_message_get_body, arg0);
47 }
48
49 extern "C" gboolean g_dbus_connection_emit_signal(GDBusConnection* arg0,
50     const gchar* arg1, const gchar* arg2, const gchar* arg3, const gchar* arg4,
51     GVariant* arg5, GError** arg6) {
52   return MOCK_HOOK_P7(GioMock, g_dbus_connection_emit_signal,
53       arg0, arg1, arg2, arg3, arg4, arg5, arg6);
54 }
55
56 extern "C" GDBusNodeInfo* g_dbus_node_info_new_for_xml(
57     const gchar* arg0, GError** arg1) {
58   return MOCK_HOOK_P2(GioMock, g_dbus_node_info_new_for_xml, arg0, arg1);
59 }
60
61 extern "C" guint g_dbus_connection_register_object(GDBusConnection* arg0,
62     const gchar* arg1, GDBusInterfaceInfo* arg2,
63     const GDBusInterfaceVTable* arg3, gpointer arg4,
64     GDestroyNotify arg5, GError** arg6) {
65   return MOCK_HOOK_P7(GioMock, g_dbus_connection_register_object,
66       arg0, arg1, arg2, arg3, arg4, arg5, arg6);
67 }
68
69 extern "C" gboolean g_dbus_connection_unregister_object (GDBusConnection *connection,
70     guint registration_id) {
71   return MOCK_HOOK_P2(GioMock, g_dbus_connection_unregister_object,
72       connection, registration_id);
73 }
74
75 extern "C" guint g_bus_own_name_on_connection(GDBusConnection* arg0,
76     const gchar* arg1, GBusNameOwnerFlags arg2,
77     GBusNameAcquiredCallback arg3, GBusNameLostCallback arg4,
78     gpointer arg5, GDestroyNotify arg6) {
79   return MOCK_HOOK_P7(GioMock, g_bus_own_name_on_connection,
80       arg0, arg1, arg2, arg3, arg4, arg5, arg6);
81 }
82
83 extern "C" guint g_dbus_connection_signal_subscribe(GDBusConnection* arg0,
84     const gchar* arg1, const gchar* arg2, const gchar* arg3, const gchar* arg4,
85     const gchar* arg5, GDBusSignalFlags arg6, GDBusSignalCallback arg7,
86     gpointer arg8, GDestroyNotify arg9) {
87   return MOCK_HOOK_P10(GioMock, g_dbus_connection_signal_subscribe,
88       arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
89 }
90
91 extern "C" void g_dbus_connection_send_message_with_reply(GDBusConnection* arg0,
92     GDBusMessage* arg1, GDBusSendMessageFlags arg2, gint arg3,
93     volatile guint32* arg4, GCancellable* arg5, GAsyncReadyCallback arg6,
94     gpointer arg7) {
95   return MOCK_HOOK_P8(GioMock, g_dbus_connection_send_message_with_reply,
96       arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
97 }
98
99 extern "C" GDBusMessage* g_dbus_connection_send_message_with_reply_finish(
100     GDBusConnection* arg0, GAsyncResult* arg1, GError** arg2) {
101   return MOCK_HOOK_P3(GioMock, g_dbus_connection_send_message_with_reply_finish,
102       arg0, arg1, arg2);
103 }
104
105 extern "C" gboolean g_dbus_connection_send_message(GDBusConnection* arg0,
106     GDBusMessage* arg1, GDBusSendMessageFlags arg2,
107     volatile guint32* arg3, GError** arg4) {
108   return MOCK_HOOK_P5(GioMock, g_dbus_connection_send_message,
109       arg0, arg1, arg2, arg3, arg4);
110 }
111
112 extern "C" void g_dbus_message_set_unix_fd_list(GDBusMessage* arg0,
113     GUnixFDList* arg1) {
114   return MOCK_HOOK_P2(GioMock, g_dbus_message_set_unix_fd_list, arg0, arg1);
115 }
116
117 extern "C" guint g_bus_watch_name_on_connection(GDBusConnection* arg0,
118     const gchar* arg1, GBusNameWatcherFlags arg2,
119     GBusNameAppearedCallback arg3, GBusNameVanishedCallback arg4, gpointer arg5,
120     GDestroyNotify arg6) {
121   return MOCK_HOOK_P7(GioMock, g_bus_watch_name_on_connection, arg0, arg1, arg2,
122       arg3, arg4, arg5, arg6);
123 }