• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 LNN_SYNC_INFO_MOCK_H
17 #define LNN_SYNC_INFO_MOCK_H
18 
19 #include <gmock/gmock.h>
20 #include <mutex>
21 
22 #include "lnn_sync_info_manager.h"
23 
24 namespace OHOS {
25 class LnnSyncInfoInterface {
26 public:
LnnSyncInfoInterface()27     LnnSyncInfoInterface() {};
~LnnSyncInfoInterface()28     virtual ~LnnSyncInfoInterface() {};
29     virtual int32_t LnnRegSyncInfoHandler(LnnSyncInfoType type, LnnSyncInfoMsgHandler handler) = 0;
30     virtual int32_t LnnUnregSyncInfoHandler(LnnSyncInfoType type, LnnSyncInfoMsgHandler handler) = 0;
31     virtual int32_t LnnSendSyncInfoMsg(LnnSyncInfoType type, const char *networkId, const uint8_t *msg, uint32_t len,
32         LnnSyncInfoMsgComplete complete) = 0;
33 
34     virtual int32_t LnnSendP2pSyncInfoMsg(const char *networkId, uint32_t netCapability) = 0;
35 
36     virtual void LnnSendAsyncInfoMsg(void *param) = 0;
37     virtual SendSyncInfoParam *CreateSyncInfoParam(LnnSyncInfoType type, const char *networkId, const uint8_t *msg,
38         uint32_t len, LnnSyncInfoMsgComplete complete) = 0;
39 };
40 
41 class LnnSyncInfoInterfaceMock : public LnnSyncInfoInterface {
42 public:
43     LnnSyncInfoInterfaceMock();
44     ~LnnSyncInfoInterfaceMock() override;
45     MOCK_METHOD2(LnnRegSyncInfoHandler, int32_t(LnnSyncInfoType, LnnSyncInfoMsgHandler));
46     MOCK_METHOD2(LnnUnregSyncInfoHandler, int32_t(LnnSyncInfoType, LnnSyncInfoMsgHandler));
47     MOCK_METHOD5(
48         LnnSendSyncInfoMsg, int32_t(LnnSyncInfoType, const char *, const uint8_t *, uint32_t, LnnSyncInfoMsgComplete));
49     MOCK_METHOD2(LnnSendP2pSyncInfoMsg, int32_t(const char *, uint32_t));
50 
51     MOCK_METHOD1(LnnSendAsyncInfoMsg, void(void *));
52     MOCK_METHOD5(CreateSyncInfoParam,
53         SendSyncInfoParam *(LnnSyncInfoType, const char *, const uint8_t *, uint32_t, LnnSyncInfoMsgComplete));
54 };
55 } // namespace OHOS
56 #endif // LNN_SYNC_INFO_MOCK_H
57