• 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_server_manager_mock.h"
17 
18 using namespace testing;
19 using namespace testing::ext;
20 
21 namespace OHOS {
22 void *g_brProxyServerManagerInterfaceMock;
BrProxyServerManagerInterfaceMock()23 BrProxyServerManagerInterfaceMock::BrProxyServerManagerInterfaceMock()
24 {
25     g_brProxyServerManagerInterfaceMock = reinterpret_cast<void *>(this);
26 }
27 
~BrProxyServerManagerInterfaceMock()28 BrProxyServerManagerInterfaceMock::~BrProxyServerManagerInterfaceMock()
29 {
30     g_brProxyServerManagerInterfaceMock = nullptr;
31 }
32 
GetBrProxyServerManagerInterface()33 static BrProxyServerManagerInterface *GetBrProxyServerManagerInterface()
34 {
35     return reinterpret_cast<BrProxyServerManagerInterface *>(g_brProxyServerManagerInterfaceMock);
36 }
37 
38 extern "C" {
PullUpHap(const char * bundleName,const char * abilityName)39 int32_t PullUpHap(const char *bundleName, const char *abilityName)
40 {
41     return GetBrProxyServerManagerInterface()->PullUpHap(bundleName, abilityName);
42 }
43 
GetCallerHapInfo(char * bundleName,uint32_t bundleNamelen,char * abilityName,uint32_t abilityNameLen)44 int32_t GetCallerHapInfo(char *bundleName, uint32_t bundleNamelen, char *abilityName, uint32_t abilityNameLen)
45 {
46     return GetBrProxyServerManagerInterface()->GetCallerHapInfo(bundleName, bundleNamelen, abilityName, abilityNameLen);
47 }
48 
GetCallerPid()49 pid_t GetCallerPid()
50 {
51     return GetBrProxyServerManagerInterface()->GetCallerPid();
52 }
53 
GetCallerUid()54 pid_t GetCallerUid()
55 {
56     return GetBrProxyServerManagerInterface()->GetCallerUid();
57 }
58 
GetCallerTokenId()59 uint32_t GetCallerTokenId()
60 {
61     return GetBrProxyServerManagerInterface()->GetCallerTokenId();
62 }
63 
CheckPushPermission()64 int32_t CheckPushPermission()
65 {
66     return GetBrProxyServerManagerInterface()->CheckPushPermission();
67 }
68 }
69 }