• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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 DISTRIBUTE_NET_LEDGER_MOCK_H
17 #define DISTRIBUTE_NET_LEDGER_MOCK_H
18 
19 #include <gmock/gmock.h>
20 #include <mutex>
21 
22 #include "kits/c/wifi_device.h"
23 #include "kits/c/wifi_error_code.h"
24 #include "kits/c/wifi_hid2d.h"
25 #include "kits/c/wifi_p2p.h"
26 #include "kits/c/wifi_scan_info.h"
27 
28 namespace OHOS {
29 class WifiInterface {
30 public:
WifiInterface()31     WifiInterface() {};
~WifiInterface()32     virtual ~WifiInterface() {};
33 
34     virtual WifiErrorCode GetDeviceConfigs(WifiDeviceConfig *result, unsigned int *size) = 0;
35     virtual WifiErrorCode ConnectToDevice(const WifiDeviceConfig *config) = 0;
36     virtual WifiErrorCode Scan(void) = 0;
37     virtual WifiErrorCode RegisterWifiEvent(WifiEvent *event) = 0;
38     virtual WifiErrorCode GetScanInfoList(WifiScanInfo *result, unsigned int *size) = 0;
39     virtual WifiErrorCode UnRegisterWifiEvent(WifiEvent *event) = 0;
40     virtual WifiErrorCode Hid2dGetChannelListFor5G(int32_t *chanList, int32_t len) = 0;
41     virtual WifiErrorCode GetLinkedInfo(WifiLinkedInfo *info) = 0;
42     virtual WifiErrorCode GetCurrentGroup(WifiP2pGroupInfo *groupInfo) = 0;
43     virtual int32_t IsWifiActive(void) = 0;
44     virtual WifiErrorCode GetWifiDetailState(WifiDetailState *state) = 0;
45     virtual WifiErrorCode GetP2pEnableStatus(P2pState *state) = 0;
46 };
47 class WifiInterfaceMock : public WifiInterface {
48 public:
49     WifiInterfaceMock();
50     ~WifiInterfaceMock() override;
51 
52     MOCK_METHOD2(GetDeviceConfigs, WifiErrorCode(WifiDeviceConfig *, unsigned int *));
53     MOCK_METHOD1(ConnectToDevice, WifiErrorCode(const WifiDeviceConfig *));
54     MOCK_METHOD0(Scan, WifiErrorCode(void));
55     MOCK_METHOD1(RegisterWifiEvent, WifiErrorCode(WifiEvent *));
56     MOCK_METHOD2(GetScanInfoList, WifiErrorCode(WifiScanInfo *, unsigned int *));
57     MOCK_METHOD1(UnRegisterWifiEvent, WifiErrorCode(WifiEvent *));
58     MOCK_METHOD2(Hid2dGetChannelListFor5G, WifiErrorCode(int32_t *, int));
59     MOCK_METHOD1(GetLinkedInfo, WifiErrorCode(WifiLinkedInfo *));
60     MOCK_METHOD1(GetCurrentGroup, WifiErrorCode(WifiP2pGroupInfo *));
61     MOCK_METHOD0(IsWifiActive, int(void));
62     MOCK_METHOD1(GetWifiDetailState, WifiErrorCode(WifiDetailState *));
63     MOCK_METHOD1(GetP2pEnableStatus, WifiErrorCode(P2pState *));
64 };
65 } // namespace OHOS
66 #endif // AUTH_CONNECTION_MOCK_H