• 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 "wifi_device.h"
20 #include "wifi_errcode.h"
21 #include "wifi_hid2d.h"
22 #include "wifi_p2p.h"
23 #include "wifi_scan.h"
24 #include <gmock/gmock.h>
25 #include <mutex>
26 
27 namespace OHOS {
28 class WifiInterface {
29 public:
WifiInterface()30     WifiInterface() {};
~WifiInterface()31     virtual ~WifiInterface() {};
32 
33     virtual WifiErrorCode GetDeviceConfigs(WifiDeviceConfig *result, unsigned int *size) = 0;
34     virtual WifiErrorCode ConnectToDevice(const WifiDeviceConfig *config) = 0;
35     virtual WifiErrorCode Scan(void) = 0;
36     virtual WifiErrorCode RegisterWifiEvent(WifiEvent *event) = 0;
37     virtual WifiErrorCode GetScanInfoList(WifiScanInfo *result, unsigned int *size) = 0;
38     virtual WifiErrorCode UnRegisterWifiEvent(WifiEvent *event) = 0;
39     virtual WifiErrorCode Hid2dGetChannelListFor5G(int *chanList, int len) = 0;
40     virtual WifiErrorCode GetLinkedInfo(WifiLinkedInfo *info) = 0;
41     virtual WifiErrorCode GetCurrentGroup(WifiP2pGroupInfo* groupInfo) = 0;
42 };
43 class WifiInterfaceMock : public WifiInterface {
44 public:
45     WifiInterfaceMock();
46     ~WifiInterfaceMock() override;
47 
48     MOCK_METHOD2(GetDeviceConfigs, WifiErrorCode(WifiDeviceConfig *, unsigned int *));
49     MOCK_METHOD1(ConnectToDevice, WifiErrorCode(const WifiDeviceConfig *));
50     MOCK_METHOD0(Scan, WifiErrorCode(void));
51     MOCK_METHOD1(RegisterWifiEvent, WifiErrorCode(WifiEvent *));
52     MOCK_METHOD2(GetScanInfoList, WifiErrorCode(WifiScanInfo *, unsigned int *));
53     MOCK_METHOD1(UnRegisterWifiEvent, WifiErrorCode(WifiEvent *));
54     MOCK_METHOD2(Hid2dGetChannelListFor5G, WifiErrorCode(int *, int));
55     MOCK_METHOD1(GetLinkedInfo, WifiErrorCode(WifiLinkedInfo *));
56     MOCK_METHOD1(GetCurrentGroup, WifiErrorCode(WifiP2pGroupInfo*));
57 };
58 } // namespace OHOS
59 #endif // AUTH_CONNECTION_MOCK_H