Add unittest for badge
[platform/core/appfw/badge.git] / 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 <gio/gio.h>
18
19 #include "gio_mock.h"
20 #include "mock_hook.h"
21 #include "test_fixture.h"
22
23 extern "C" GDBusConnection* g_bus_get_sync(GBusType type,
24     GCancellable* cancellable, GError** error) {
25   return MOCK_HOOK_P3(GioMock, g_bus_get_sync, type, cancellable, error);
26 }
27
28 extern "C" GDBusMessage* g_dbus_connection_send_message_with_reply_sync(
29     GDBusConnection* conn, GDBusMessage* msg, GDBusSendMessageFlags flags,
30     gint timeout, volatile guint32* out_serial, GCancellable* cancellable,
31     GError** error) {
32   return MOCK_HOOK_P7(GioMock, g_dbus_connection_send_message_with_reply_sync,
33       conn, msg, flags, timeout, out_serial, cancellable, error);
34 }
35
36 extern "C" GDBusMessage* g_dbus_message_new_method_call(const gchar* arg0,
37     const gchar* arg1, const gchar* arg2, const gchar* arg3) {
38   return MOCK_HOOK_P4(GioMock, g_dbus_message_new_method_call, arg0, arg1, arg2,
39       arg3);
40 }
41
42 extern "C" void g_dbus_message_set_body(GDBusMessage* arg0, GVariant* arg1) {
43   return MOCK_HOOK_P2(GioMock, g_dbus_message_set_body, arg0, arg1);
44 }
45
46 extern "C" GVariant* g_dbus_message_get_body(GDBusMessage* arg0) {
47   return MOCK_HOOK_P1(GioMock, g_dbus_message_get_body, arg0);
48 }
49
50 extern "C" guint g_dbus_connection_signal_subscribe(GDBusConnection* arg0,
51     const gchar* arg1, const gchar* arg2, const gchar* arg3, const gchar* arg4,
52     const gchar* arg5, GDBusSignalFlags arg6, GDBusSignalCallback arg7,
53     gpointer arg8, GDestroyNotify arg9) {
54   return MOCK_HOOK_P10(GioMock, g_dbus_connection_signal_subscribe,
55       arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
56 }
57
58 extern "C" void g_dbus_connection_send_message_with_reply(GDBusConnection* arg0,
59     GDBusMessage* arg1, GDBusSendMessageFlags arg2, gint arg3,
60     volatile guint32* arg4, GCancellable* arg5, GAsyncReadyCallback arg6,
61     gpointer arg7) {
62   return MOCK_HOOK_P8(GioMock, g_dbus_connection_send_message_with_reply,
63       arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
64 }
65
66 extern "C" gboolean g_dbus_message_to_gerror(
67     GDBusMessage* arg0, GError** arg1) {
68   return MOCK_HOOK_P2(GioMock, g_dbus_message_to_gerror,
69       arg0, arg1);
70 }
71
72 extern "C" guint g_bus_watch_name_on_connection(
73     GDBusConnection* arg0, const gchar* arg1, GBusNameWatcherFlags arg2,
74     GBusNameAppearedCallback arg3, GBusNameVanishedCallback arg4,
75     gpointer arg5, GDestroyNotify arg6) {
76   return MOCK_HOOK_P7(GioMock, g_bus_watch_name_on_connection,
77       arg0, arg1, arg2, arg3, arg4, arg5, arg6);
78 }
79
80 extern "C" void g_bus_unwatch_name(guint arg0) {
81   return MOCK_HOOK_P1(GioMock, g_bus_unwatch_name, arg0);
82 }
83
84 extern "C" void g_dbus_connection_signal_unsubscribe(
85     GDBusConnection* arg0, guint arg1) {
86   return MOCK_HOOK_P2(GioMock, g_dbus_connection_signal_unsubscribe,
87       arg0, arg1);
88 }