• 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 "br_proxy_test_mock.h"
17 
18 
19 using namespace testing;
20 using namespace testing::ext;
21 
22 namespace OHOS {
23 void *g_brProxyInterfaceMock;
BrProxyInterfaceMock()24 BrProxyInterfaceMock::BrProxyInterfaceMock()
25 {
26     g_brProxyInterfaceMock = reinterpret_cast<void *>(this);
27 }
28 
~BrProxyInterfaceMock()29 BrProxyInterfaceMock::~BrProxyInterfaceMock()
30 {
31     g_brProxyInterfaceMock = nullptr;
32 }
33 
GetBrProxyInterface()34 static BrProxyInterface *GetBrProxyInterface()
35 {
36     return reinterpret_cast<BrProxyInterface *>(g_brProxyInterfaceMock);
37 }
38 
39 extern "C" {
ClientIpcBrProxyOpened(const char * pkgName,int32_t channelId,const char * brMac,const char * uuid,int32_t reason)40 int32_t ClientIpcBrProxyOpened(const char *pkgName, int32_t channelId,
41     const char *brMac, const char *uuid, int32_t reason)
42 {
43     return GetBrProxyInterface()->ClientIpcBrProxyOpened(pkgName, channelId, brMac, uuid, reason);
44 }
45 
ConnectPeerDevice(BrProxyChannelInfo * channelInfo,uint32_t * requestId)46 int32_t ConnectPeerDevice(BrProxyChannelInfo *channelInfo, uint32_t *requestId)
47 {
48     return GetBrProxyInterface()->ConnectPeerDevice(channelInfo, requestId);
49 }
50 
GetCallerHapInfo(char * bundleName,uint32_t bundleNamelen,char * abilityName,uint32_t abilityNameLen)51 int32_t GetCallerHapInfo(char *bundleName, uint32_t bundleNamelen, char *abilityName, uint32_t abilityNameLen)
52 {
53     return GetBrProxyInterface()->GetCallerHapInfo(bundleName, bundleNamelen, abilityName, abilityNameLen);
54 }
55 }
56 }