• 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 CLIENT_TRANS_PROXY_MANAGER_MOCK_H
17 #define CLIENT_TRANS_PROXY_MANAGER_MOCK_H
18 
19 #include <gmock/gmock.h>
20 #include "client_trans_pending.h"
21 #include "client_trans_proxy_manager.h"
22 #include "client_trans_proxy_file_manager.h"
23 #include "client_trans_session_manager.h"
24 #include "client_trans_socket_manager.h"
25 #include "trans_proxy_process_data.h"
26 #include "trans_server_proxy.h"
27 
28 namespace OHOS {
29 class ClientTransProxyFileHelperInterface {
30 public:
ClientTransProxyFileHelperInterface()31     ClientTransProxyFileHelperInterface() {};
~ClientTransProxyFileHelperInterface()32     virtual ~ClientTransProxyFileHelperInterface() {};
33     virtual int32_t ClientTransProxyPackAndSendData(int32_t channelId, const void* data, uint32_t len,
34         ProxyChannelInfoDetail* info, SessionPktType pktType) = 0;
35     virtual int32_t ClientTransProxyGetInfoByChannelId(int32_t channelId, ProxyChannelInfoDetail *info) = 0;
36     virtual uint32_t SoftBusLtoHl(uint32_t value) = 0;
37     virtual uint32_t SoftBusHtoLl(uint32_t value) = 0;
38     virtual uint64_t SoftBusLtoHll(uint64_t value) = 0;
39     virtual uint64_t SoftBusHtoLll(uint64_t value) = 0;
40     virtual uint32_t SoftBusNtoHl(uint32_t netlong) = 0;
41     virtual int64_t SoftBusPreadFile(int32_t fd, void *buf, uint64_t readBytes, uint64_t offset) = 0;
42     virtual uint16_t SoftBusHtoLs(uint16_t value) = 0;
43     virtual uint16_t RTU_CRC(const unsigned char *puchMsg, uint16_t usDataLen) = 0;
44     virtual int32_t FrameIndexToType(uint64_t index, uint64_t frameNumber) = 0;
45 };
46 
47 class ClientTransProxyFileHelperInterfaceMock : public ClientTransProxyFileHelperInterface {
48 public:
49     ClientTransProxyFileHelperInterfaceMock();
50     ~ClientTransProxyFileHelperInterfaceMock() override;
51     MOCK_METHOD5(ClientTransProxyPackAndSendData, int32_t (int32_t channelId, const void* data, uint32_t len,
52         ProxyChannelInfoDetail* info, SessionPktType pktType));
53     MOCK_METHOD2(ClientTransProxyGetInfoByChannelId, int32_t (int32_t channelId, ProxyChannelInfoDetail *info));
54     MOCK_METHOD1(SoftBusLtoHl, uint32_t (uint32_t value));
55     MOCK_METHOD1(SoftBusHtoLl, uint32_t (uint32_t value));
56     MOCK_METHOD1(SoftBusLtoHll, uint64_t (uint64_t value));
57     MOCK_METHOD1(SoftBusHtoLll, uint64_t (uint64_t value));
58     MOCK_METHOD1(SoftBusNtoHl, uint32_t (uint32_t netlong));
59     MOCK_METHOD1(SoftBusHtoLs, uint16_t (uint16_t value));
60     MOCK_METHOD4(SoftBusPreadFile, int64_t (int32_t fd, void *buf, uint64_t readBytes, uint64_t offset));
61     MOCK_METHOD2(RTU_CRC, uint16_t (const unsigned char *puchMsg, uint16_t usDataLen));
62     MOCK_METHOD2(FrameIndexToType, int32_t (uint64_t index, uint64_t frameNumber));
63 };
64 }
65 #endif