Improves code coverage
[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" GDBusNodeInfo* g_dbus_node_info_new_for_xml(
50     const gchar* arg0, GError** arg1) {
51   return MOCK_HOOK_P2(GioMock, g_dbus_node_info_new_for_xml, arg0, arg1);
52 }
53
54 extern "C" guint g_dbus_connection_register_object(GDBusConnection* arg0,
55     const gchar* arg1, GDBusInterfaceInfo* arg2,
56     const GDBusInterfaceVTable* arg3, gpointer arg4,
57     GDestroyNotify arg5, GError** arg6) {
58   return MOCK_HOOK_P7(GioMock, g_dbus_connection_register_object,
59       arg0, arg1, arg2, arg3, arg4, arg5, arg6);
60 }
61
62 extern "C" gboolean g_dbus_connection_unregister_object (GDBusConnection *connection,
63     guint registration_id) {
64   return MOCK_HOOK_P2(GioMock, g_dbus_connection_unregister_object,
65       connection, registration_id);
66 }
67
68 extern "C" gboolean g_dbus_connection_send_message(GDBusConnection* arg0,
69     GDBusMessage* arg1, GDBusSendMessageFlags arg2,
70     volatile guint32* arg3, GError** arg4) {
71   return MOCK_HOOK_P5(GioMock, g_dbus_connection_send_message,
72       arg0, arg1, arg2, arg3, arg4);
73 }
74
75 extern "C" void g_dbus_message_set_unix_fd_list(GDBusMessage* arg0,
76     GUnixFDList* arg1) {
77   return MOCK_HOOK_P2(GioMock, g_dbus_message_set_unix_fd_list, arg0, arg1);
78 }
79
80 extern "C" guint g_bus_watch_name_on_connection(GDBusConnection* arg0,
81     const gchar* arg1, GBusNameWatcherFlags arg2,
82     GBusNameAppearedCallback arg3, GBusNameVanishedCallback arg4, gpointer arg5,
83     GDestroyNotify arg6) {
84   return MOCK_HOOK_P7(GioMock, g_bus_watch_name_on_connection, arg0, arg1, arg2,
85       arg3, arg4, arg5, arg6);
86 }