• 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_EXT_TEST_MOCK_H
17 #define BR_PROXY_EXT_TEST_MOCK_H
18 
19 #include <gmock/gmock.h>
20 #include "br_proxy.h"
21 #include "trans_client_proxy.h"
22 
23 namespace OHOS {
24 class BrProxyExtInterface {
25 public:
BrProxyExtInterface()26     BrProxyExtInterface() {};
~BrProxyExtInterface()27     virtual ~BrProxyExtInterface() {};
28     virtual SoftBusList *CreateSoftBusList(void) = 0;
29     virtual void DestroySoftBusList(SoftBusList *list) = 0;
30     virtual int32_t ClientStubInit(void) = 0;
31     virtual int32_t ClientRegisterBrProxyService(const char *pkgName) = 0;
32     virtual int32_t ServerIpcOpenBrProxy(const char *brMac, const char *uuid) = 0;
33     virtual int32_t ServerIpcIsProxyChannelEnabled(int32_t uid, bool *isEnable) = 0;
34     virtual int32_t ServerIpcSendBrProxyData(int32_t channelId, char *data, uint32_t dataLen) = 0;
35     virtual int32_t ServerIpcCloseBrProxy(int32_t channelId) = 0;
36     virtual int32_t ServerIpcSetListenerState(int32_t channelId, int32_t type, bool CbEnabled) = 0;
37     virtual int ClientRegisterService(const char *pkgName) = 0;
38 };
39 
40 class BrProxyExtInterfaceMock : public BrProxyExtInterface {
41 public:
42     BrProxyExtInterfaceMock();
43     ~BrProxyExtInterfaceMock() override;
44     MOCK_METHOD0(CreateSoftBusList, SoftBusList * (void));
45     MOCK_METHOD1(DestroySoftBusList, void (SoftBusList *));
46     MOCK_METHOD0(ClientStubInit, int32_t (void));
47     MOCK_METHOD1(ClientRegisterBrProxyService, int32_t (const char *));
48     MOCK_METHOD2(ServerIpcOpenBrProxy, int32_t (const char *, const char *));
49     MOCK_METHOD2(ServerIpcIsProxyChannelEnabled, int32_t (int32_t, bool *));
50     MOCK_METHOD3(ServerIpcSendBrProxyData, int32_t (int32_t, char *, uint32_t));
51     MOCK_METHOD1(ServerIpcCloseBrProxy, int32_t (int32_t));
52     MOCK_METHOD3(ServerIpcSetListenerState, int32_t (int32_t, int32_t, bool));
53     MOCK_METHOD1(ClientRegisterService, int (const char *));
54 };
55 } // namespace OHOS
56 #endif // BR_PROXY_EXT_TEST_MOCK_H