Refactor slp-pkgmgr with tidl
[platform/core/appfw/slp-pkgmgr.git] / test / unit_tests / mock / rpc_port_mock.cc
1 /*
2  * Copyright (c) 2022 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 "mock/rpc_port_mock.hh"
18 #include "mock/mock_hook.hh"
19 #include "mock/test_fixture.hh"
20
21 RpcPortMock::~RpcPortMock() = default;
22
23 extern "C" int rpc_port_proxy_connect_sync(rpc_port_proxy_h h,
24     const char *appid, const char *port_name) {
25   return MOCK_HOOK_P3(RpcPortMock, rpc_port_proxy_connect_sync,
26       h, appid, port_name);
27 }
28
29 extern "C" int rpc_port_read(rpc_port_h h, void *buf, unsigned int size) {
30   return MOCK_HOOK_P3(RpcPortMock, rpc_port_read,
31       h, buf, size);
32 }
33
34 extern "C" int rpc_port_write(rpc_port_h h, const void *buf, unsigned int size) {
35   return MOCK_HOOK_P3(RpcPortMock, rpc_port_write,
36       h, buf, size);
37 }
38
39 extern "C" int rpc_port_proxy_add_connected_event_cb(rpc_port_proxy_h h,
40     rpc_port_proxy_connected_event_cb cb, void *user_data) {
41   return MOCK_HOOK_P3(RpcPortMock, rpc_port_proxy_add_connected_event_cb,
42       h, cb, user_data);
43 }
44
45 extern "C" int rpc_port_parcel_create_from_port(rpc_port_parcel_h* h,
46     rpc_port_h port) {
47   return MOCK_HOOK_P2(RpcPortMock, rpc_port_parcel_create_from_port,
48       h, port);
49 }
50
51 extern "C" int rpc_port_parcel_send(rpc_port_parcel_h h, rpc_port_h port) {
52   return MOCK_HOOK_P2(RpcPortMock, rpc_port_parcel_send,
53       h, port);
54 }