• 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 #ifndef BR_PROXY_SERVER_MANAGER_TEST_MOCK_H
17 #define BR_PROXY_SERVER_MANAGER_TEST_MOCK_H
18 
19 #include <gmock/gmock.h>
20 #include "br_proxy_common.h"
21 #include "trans_client_proxy.h"
22 
23 namespace OHOS {
24 class BrProxyServerManagerInterface {
25 public:
BrProxyServerManagerInterface()26     BrProxyServerManagerInterface() {};
~BrProxyServerManagerInterface()27     virtual ~BrProxyServerManagerInterface() {};
28 
29     virtual int32_t PullUpHap(const char *bundleName, const char *abilityName) = 0;
30     virtual int32_t GetCallerHapInfo(char *bundleName, uint32_t bundleNamelen, char *abilityName,
31         uint32_t abilityNameLen) = 0;
32     virtual pid_t GetCallerPid() = 0;
33     virtual pid_t GetCallerUid() = 0;
34     virtual uint32_t GetCallerTokenId() = 0;
35     virtual int32_t CheckPushPermission() = 0;
36 };
37 
38 class BrProxyServerManagerInterfaceMock : public BrProxyServerManagerInterface {
39 public:
40     BrProxyServerManagerInterfaceMock();
41     ~BrProxyServerManagerInterfaceMock() override;
42 
43     MOCK_METHOD2(PullUpHap, int32_t (const char *, const char *));
44     MOCK_METHOD4(GetCallerHapInfo, int32_t (char *, uint32_t, char *, uint32_t));
45     MOCK_METHOD0(GetCallerPid, pid_t (void));
46     MOCK_METHOD0(GetCallerUid, pid_t (void));
47     MOCK_METHOD0(GetCallerTokenId, uint32_t (void));
48     MOCK_METHOD0(CheckPushPermission, int32_t (void));
49 };
50 } // namespace OHOS
51 #endif // BR_PROXY_SERVER_MANAGER_TEST_MOCK_H