• 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_hotspot.h"
26 #include "kits/c/wifi_p2p.h"
27 #include "kits/c/wifi_scan_info.h"
28 
29 namespace OHOS {
30 class WifiInterface {
31 public:
WifiInterface()32     WifiInterface() {};
~WifiInterface()33     virtual ~WifiInterface() {};
34 
35     virtual WifiErrorCode GetDeviceConfigs(WifiDeviceConfig *result, unsigned int *size) = 0;
36     virtual WifiErrorCode ConnectToDevice(const WifiDeviceConfig *config) = 0;
37     virtual WifiErrorCode Scan(void) = 0;
38     virtual WifiErrorCode RegisterWifiEvent(WifiEvent *event) = 0;
39     virtual WifiErrorCode GetScanInfoList(WifiScanInfo *result, unsigned int *size) = 0;
40     virtual WifiErrorCode UnRegisterWifiEvent(WifiEvent *event) = 0;
41     virtual WifiErrorCode Hid2dGetChannelListFor5G(int32_t *chanList, int32_t len) = 0;
42     virtual WifiErrorCode GetLinkedInfo(WifiLinkedInfo *info) = 0;
43     virtual WifiErrorCode GetCurrentGroup(WifiP2pGroupInfo *groupInfo) = 0;
44     virtual int32_t IsWifiActive(void) = 0;
45     virtual WifiErrorCode GetWifiDetailState(WifiDetailState *state) = 0;
46     virtual WifiErrorCode GetP2pEnableStatus(P2pState *state) = 0;
47     virtual WifiErrorCode GetHotspotConfig(HotspotConfig *result) = 0;
48 };
49 class WifiInterfaceMock : public WifiInterface {
50 public:
51     WifiInterfaceMock();
52     ~WifiInterfaceMock() override;
53 
54     MOCK_METHOD2(GetDeviceConfigs, WifiErrorCode(WifiDeviceConfig *, unsigned int *));
55     MOCK_METHOD1(ConnectToDevice, WifiErrorCode(const WifiDeviceConfig *));
56     MOCK_METHOD0(Scan, WifiErrorCode(void));
57     MOCK_METHOD1(RegisterWifiEvent, WifiErrorCode(WifiEvent *));
58     MOCK_METHOD2(GetScanInfoList, WifiErrorCode(WifiScanInfo *, unsigned int *));
59     MOCK_METHOD1(UnRegisterWifiEvent, WifiErrorCode(WifiEvent *));
60     MOCK_METHOD2(Hid2dGetChannelListFor5G, WifiErrorCode(int32_t *, int));
61     MOCK_METHOD1(GetLinkedInfo, WifiErrorCode(WifiLinkedInfo *));
62     MOCK_METHOD1(GetCurrentGroup, WifiErrorCode(WifiP2pGroupInfo *));
63     MOCK_METHOD0(IsWifiActive, int(void));
64     MOCK_METHOD1(GetWifiDetailState, WifiErrorCode(WifiDetailState *));
65     MOCK_METHOD1(GetP2pEnableStatus, WifiErrorCode(P2pState *));
66     MOCK_METHOD1(GetHotspotConfig, WifiErrorCode(HotspotConfig *));
67 };
68 } // namespace OHOS
69 #endif // AUTH_CONNECTION_MOCK_H