• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "client_connection_mock_test.h"
17 
18 using namespace testing::ext;
19 
20 namespace OHOS {
21 static void *g_mock = nullptr;
ClientConnectionInterfaceMock()22 ClientConnectionInterfaceMock::ClientConnectionInterfaceMock()
23 {
24     g_mock = reinterpret_cast<void *>(this);
25 }
26 
~ClientConnectionInterfaceMock()27 ClientConnectionInterfaceMock::~ClientConnectionInterfaceMock()
28 {
29     g_mock = nullptr;
30 }
31 
GetMock()32 static ClientConnectionInterfaceMock* GetMock()
33 {
34     return reinterpret_cast<ClientConnectionInterfaceMock*>(g_mock);
35 }
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
SoftBusMutexInit(SoftBusMutex * mutex,SoftBusMutexAttr * mutexAttr)41 int32_t SoftBusMutexInit(SoftBusMutex *mutex, SoftBusMutexAttr *mutexAttr)
42 {
43     return GetMock()->SoftBusMutexInit(mutex, mutexAttr);
44 }
45 
SoftBusMutexLockInner(SoftBusMutex * mutex)46 int32_t SoftBusMutexLockInner(SoftBusMutex *mutex)
47 {
48     return GetMock()->SoftBusMutexLockInner(mutex);
49 }
50 
SoftBusMutexUnlockInner(SoftBusMutex * mutex)51 int32_t SoftBusMutexUnlockInner(SoftBusMutex *mutex)
52 {
53     return GetMock()->SoftBusMutexUnlockInner(mutex);
54 }
55 
InitSoftBus(const char * pkgName)56 int32_t InitSoftBus(const char *pkgName)
57 {
58     return GetMock()->InitSoftBus(pkgName);
59 }
60 
ServerIpcCreateServer(const char * pkgName,const char * name)61 int32_t ServerIpcCreateServer(const char *pkgName, const char *name)
62 {
63     return GetMock()->ServerIpcCreateServer(pkgName, name);
64 }
65 
ServerIpcRemoveServer(const char * pkgName,const char * name)66 int32_t ServerIpcRemoveServer(const char *pkgName, const char *name)
67 {
68     return GetMock()->ServerIpcRemoveServer(pkgName, name);
69 }
70 
ServerIpcConnect(const char * pkgName,const char * name,const Address * address)71 int32_t ServerIpcConnect(const char *pkgName, const char *name, const Address *address)
72 {
73     return GetMock()->ServerIpcConnect(pkgName, name, address);
74 }
75 
ServerIpcDisconnect(uint32_t handle)76 int32_t ServerIpcDisconnect(uint32_t handle)
77 {
78     return GetMock()->ServerIpcDisconnect(handle);
79 }
80 
ServerIpcSend(uint32_t handle,const uint8_t * data,uint32_t len)81 int32_t ServerIpcSend(uint32_t handle, const uint8_t *data, uint32_t len)
82 {
83     return GetMock()->ServerIpcSend(handle, data, len);
84 }
85 
ServerIpcGetPeerDeviceId(uint32_t handle,char * deviceId,uint32_t len)86 int32_t ServerIpcGetPeerDeviceId(uint32_t handle, char *deviceId, uint32_t len)
87 {
88     return GetMock()->ServerIpcGetPeerDeviceId(handle, deviceId, len);
89 }
90 
91 #ifdef __cplusplus
92 }
93 #endif
94 }