1 /*
2  * Copyright (c) 2021-2023 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 #include <gtest/gtest.h>
17 #include <osal_mem.h>
18 #include "wifi_driver_client.h"
19 #ifdef OHOS_ARCH_LITE
20 #include "hostapd_client.h"
21 #include "wpa_client.h"
22 #endif
23 #include "securec.h"
24 
25 using namespace testing::ext;
26 
27 namespace ClientTest {
28 const uint32_t DEFAULT_COMBO_SIZE = 10;
29 const char *WLAN_IFNAME = "wlan0";
30 const uint32_t RESET_TIME = 3;
31 class WifiClientTest : public testing::Test {
32 public:
33     static void SetUpTestCase();
34     static void TearDownTestCase();
35     void SetUp();
36     void TearDown();
37 };
38 
SetUpTestCase()39 void WifiClientTest::SetUpTestCase()
40 {
41 }
42 
TearDownTestCase()43 void WifiClientTest::TearDownTestCase()
44 {
45 }
46 
SetUp()47 void WifiClientTest::SetUp()
48 {
49     WifiDriverClientInit();
50 }
51 
TearDown()52 void WifiClientTest::TearDown()
53 {
54     WifiDriverClientDeinit();
55 }
56 
Hid2dFunCb(const uint8_t * recvMsg,uint32_t recvMsgLen)57 static int32_t Hid2dFunCb(const uint8_t *recvMsg, uint32_t recvMsgLen)
58 {
59     (void)recvMsg;
60     (void)recvMsgLen;
61     return RET_CODE_SUCCESS;
62 }
63 
64 /**
65  * @tc.name: WifiClientSetResetDriver001
66  * @tc.desc: Wifi client reset driver function test
67  * @tc.type: FUNC
68  * @tc.require:
69  */
70 HWTEST_F(WifiClientTest, WifiClientSetResetDriver001, TestSize.Level1)
71 {
72     int32_t ret;
73     uint8_t chipId = 0;
74 
75     ret = AcquireChipId(WLAN_IFNAME, &chipId);
76     ASSERT_TRUE(chipId < MAX_WLAN_DEVICE);
77     EXPECT_EQ(RET_CODE_SUCCESS, ret);
78 
79     ret = SetResetDriver(chipId, WLAN_IFNAME);
80     EXPECT_EQ(RET_CODE_SUCCESS, ret);
81     sleep(RESET_TIME);
82 }
83 
84 /**
85  * @tc.name: WifiClientSetCountryCode001
86  * @tc.desc: Wifi client set country code function test
87  * @tc.type: FUNC
88  * @tc.require: AR000FRMJC
89  */
90 HWTEST_F(WifiClientTest, WifiClientSetCountryCode001, TestSize.Level1)
91 {
92     int32_t ret;
93     const char *code = "CN";
94     const char *codeDigital = "99";
95     const char *ifNameInvalid = "wlanTest";
96     uint32_t len = 2;
97 
98     ret = WifiSetCountryCode(ifNameInvalid, code, len);
99     EXPECT_EQ(RET_CODE_FAILURE, ret);
100     ret = WifiSetCountryCode(WLAN_IFNAME, code, len);
101     EXPECT_EQ(RET_CODE_SUCCESS, ret);
102     ret = WifiSetCountryCode(WLAN_IFNAME, codeDigital, len);
103     bool flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT);
104     ASSERT_TRUE(flag);
105 }
106 
107 /**
108  * @tc.name: WifiClientGetUsableNetworkInfo001
109  * @tc.desc: Wifi client get usable networkInfo function test
110  * @tc.type: FUNC
111  * @tc.require: AR000FRMJC
112  */
113 HWTEST_F(WifiClientTest, WifiClientGetUsableNetworkInfo001, TestSize.Level1)
114 {
115     int32_t ret;
116     struct NetworkInfoResult networkInfo;
117 
118     ret = GetUsableNetworkInfo(&networkInfo);
119     EXPECT_EQ(RET_CODE_SUCCESS, ret);
120 }
121 
122 /**
123  * @tc.name: WifiClientIsSupportCombo001
124  * @tc.desc: Wifi client is support combo function test
125  * @tc.type: FUNC
126  * @tc.require: AR000FRMJC
127  */
128 HWTEST_F(WifiClientTest, WifiClientIsSupportCombo001, TestSize.Level1)
129 {
130     int32_t ret;
131     uint8_t isSupportCombo;
132 
133     ret = IsSupportCombo(&isSupportCombo);
134     EXPECT_EQ(RET_CODE_SUCCESS, ret);
135 }
136 
137 /**
138  * @tc.name: WifiClientGetComboInfo001
139  * @tc.desc: Wifi client get combo info function test
140  * @tc.type: FUNC
141  * @tc.require: AR000FRMJC
142  */
143 HWTEST_F(WifiClientTest, WifiClientGetComboInfo001, TestSize.Level1)
144 {
145     int32_t ret;
146     uint64_t comboInfo[DEFAULT_COMBO_SIZE] = {};
147 
148     ret = GetComboInfo(comboInfo, DEFAULT_COMBO_SIZE);
149     bool flag = (ret == RET_CODE_SUCCESS || ret == RET_CODE_NOT_SUPPORT);
150     ASSERT_TRUE(flag);
151 }
152 
153 /**
154  * @tc.name: WifiClientSetMacAddr001
155  * @tc.desc: Wifi client set mac addr function test
156  * @tc.type: FUNC
157  * @tc.require: AR000FRMJC
158  */
159 HWTEST_F(WifiClientTest, WifiClientSetMacAddr001, TestSize.Level1)
160 {
161     int32_t ret;
162     const char *ifNameInvalid = "wlanTest";
163     unsigned char mac[ETH_ADDR_LEN] = {0x12, 0x34, 0x56, 0x78, 0xab, 0xcd};
164     unsigned char errorMac[ETH_ADDR_LEN] = {0x11, 0x34, 0x56, 0x78, 0xab, 0xcd};
165 
166     ret = SetMacAddr(WLAN_IFNAME, mac, ETH_ADDR_LEN);
167     bool flag = (ret == HDF_SUCCESS || ret == HDF_ERR_NOT_SUPPORT || ret == HDF_ERR_DEVICE_BUSY);
168     ASSERT_TRUE(flag);
169     ret = SetMacAddr(WLAN_IFNAME, errorMac, ETH_ADDR_LEN);
170     EXPECT_NE(RET_CODE_SUCCESS, ret);
171     ret = SetMacAddr(ifNameInvalid, mac, ETH_ADDR_LEN);
172     EXPECT_NE(RET_CODE_SUCCESS, ret);
173 }
174 
175 /**
176  * @tc.name: WifiClientGetDevMacAddr001
177  * @tc.desc: Wifi client get mac addr function test
178  * @tc.type: FUNC
179  * @tc.require: AR000FRMJC
180  */
181 HWTEST_F(WifiClientTest, WifiClientGetDevMacAddr001, TestSize.Level1)
182 {
183     int32_t ret;
184     unsigned char mac[ETH_ADDR_LEN] = {};
185     int32_t type = WIFI_IFTYPE_STATION;
186     const char *ifNameInvalid = "wlanTest";
187 
188     ret = GetDevMacAddr(WLAN_IFNAME, type, mac, ETH_ADDR_LEN);
189     EXPECT_NE(RET_CODE_FAILURE, ret);
190     ret = GetDevMacAddr(ifNameInvalid, type, mac, ETH_ADDR_LEN);
191     EXPECT_NE(RET_CODE_SUCCESS, ret);
192 }
193 
194 /**
195  * @tc.name: WifiClientGetDevMacAddr002
196  * @tc.desc: Wifi client get mac addr function test
197  * @tc.type: FUNC
198  * @tc.require: AR000H603L
199  */
200 HWTEST_F(WifiClientTest, WifiClientGetDevMacAddr002, TestSize.Level1)
201 {
202     int32_t ret;
203     unsigned char mac[ETH_ADDR_LEN] = {};
204     int32_t type = WIFI_IFTYPE_AP;
205 
206     ret = GetDevMacAddr(WLAN_IFNAME, type, mac, ETH_ADDR_LEN);
207     EXPECT_NE(RET_CODE_FAILURE, ret);
208 }
209 
210 /**
211  * @tc.name: WifiClientGetValidFreqByBand001
212  * @tc.desc: Wifi client get valid freq function test
213  * @tc.type: FUNC
214  * @tc.require: AR000FRMJC
215  */
216 HWTEST_F(WifiClientTest, WifiClientGetValidFreqByBand001, TestSize.Level1)
217 {
218     int32_t ret;
219     int32_t band = IEEE80211_BAND_2GHZ;
220     int32_t bandNotSupport = IEEE80211_NUM_BANDS;
221     struct FreqInfoResult result;
222     uint32_t size = 14;
223     uint32_t i;
224     const char *ifNameInvalid = "wlanTest";
225 
226     result.freqs = (uint32_t *)OsalMemCalloc(35 * sizeof(uint32_t));
227     if (result.freqs == NULL) {
228         printf("%s: OsalMemCalloc failed", __FUNCTION__);
229         return;
230     }
231 
232     result.txPower = (uint32_t *)OsalMemCalloc(35 * sizeof(uint32_t));
233     if (result.txPower == NULL) {
234         printf("%s: OsalMemCalloc failed", __FUNCTION__);
235         OsalMemFree(result.freqs);
236         return;
237     }
238 
239     ret = GetValidFreqByBand(WLAN_IFNAME, bandNotSupport, &result, size);
240     EXPECT_NE(RET_CODE_SUCCESS, ret);
241     ret = GetValidFreqByBand(WLAN_IFNAME, band, nullptr, size);
242     EXPECT_NE(RET_CODE_SUCCESS, ret);
243     ret = GetValidFreqByBand(ifNameInvalid, band, &result, size);
244     EXPECT_NE(RET_CODE_SUCCESS, ret);
245     ret = GetValidFreqByBand(WLAN_IFNAME, band, &result, size);
246     EXPECT_EQ(RET_CODE_SUCCESS, ret);
247     if (ret == RET_CODE_SUCCESS) {
248         printf("%s: num = %u\n", __func__, result.nums);
249         for (i = 0; i < result.nums; i++) {
250             printf("%s: freq[%d] = %d\n", __func__, i, result.freqs[i]);
251         }
252     }
253 
254     OsalMemFree(result.txPower);
255     OsalMemFree(result.freqs);
256 }
257 
258 /**
259  * @tc.name: WifiClientSetTxPower001
260  * @tc.desc: Wifi client set tx power function test
261  * @tc.type: FUNC
262  * @tc.require: AR000FRMJC
263  */
264 HWTEST_F(WifiClientTest, WifiClientSetTxPower001, TestSize.Level1)
265 {
266     int32_t ret;
267     int32_t power = 10;
268     const char *ifNameInvalid = "wlanTest";
269 
270     ret = SetTxPower(ifNameInvalid, power);
271     EXPECT_NE(RET_CODE_SUCCESS, ret);
272     ret = SetTxPower(WLAN_IFNAME, power);
273     EXPECT_EQ(RET_CODE_SUCCESS, ret);
274 }
275 
276 /**
277  * @tc.name: WifiClientGetAssociatedStas001
278  * @tc.desc: Wifi client get associated status function test
279  * @tc.type: FUNC
280  * @tc.require: AR000H603L
281  */
282 HWTEST_F(WifiClientTest, WifiClientGetAssociatedStas001, TestSize.Level1)
283 {
284     int32_t ret;
285     struct AssocStaInfoResult result;
286 
287     ret = GetAssociatedStas(WLAN_IFNAME, &result);
288     EXPECT_EQ(RET_CODE_SUCCESS, ret);
289 }
290 
291 /**
292  * @tc.name: WifiClientSetScanMacAddr001
293  * @tc.desc: Wifi client set scan MAC address function test
294  * @tc.type: FUNC
295  * @tc.require: AR000H603L
296  */
297 HWTEST_F(WifiClientTest, WifiClientSetScanMacAddr001, TestSize.Level1)
298 {
299     int32_t ret;
300     const char *ifNameInvalid = "wlanTest";
301     unsigned char scanMac[ETH_ADDR_LEN] = {0x12, 0x34, 0x56, 0x78, 0xab, 0xcd};
302 
303     ret = SetScanMacAddr(ifNameInvalid, scanMac, ETH_ADDR_LEN);
304     EXPECT_EQ(RET_CODE_FAILURE, ret);
305     ret = SetScanMacAddr(WLAN_IFNAME, scanMac, ETH_ADDR_LEN);
306     bool flag = (ret == RET_CODE_SUCCESS || ret == RET_CODE_NOT_SUPPORT);
307     ASSERT_TRUE(flag);
308 }
309 
310 /**
311  * @tc.name: WifiClientAcquireChipId001
312  * @tc.desc: Wifi client get chipId function test
313  * @tc.type: FUNC
314  * @tc.require: AR000H603L
315  */
316 HWTEST_F(WifiClientTest, WifiClientAcquireChipId001, TestSize.Level1)
317 {
318     int32_t ret;
319     const char *ifNameInvalid = "wlanTest";
320     uint8_t chipId = 0;
321 
322     ret = AcquireChipId(nullptr, &chipId);
323     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
324     ret = AcquireChipId(WLAN_IFNAME, nullptr);
325     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
326     ret = AcquireChipId(ifNameInvalid, &chipId);
327     EXPECT_NE(RET_CODE_SUCCESS, ret);
328     ret = AcquireChipId(WLAN_IFNAME, &chipId);
329     ASSERT_TRUE(chipId < MAX_WLAN_DEVICE);
330     EXPECT_EQ(RET_CODE_SUCCESS, ret);
331 }
332 
333 /**
334  * @tc.name: WifiClientGetIfNamesByChipId001
335  * @tc.desc: Wifi client get ifName by chipId function test
336  * @tc.type: FUNC
337  * @tc.require: AR000H603L
338  */
339 HWTEST_F(WifiClientTest, WifiClientGetIfNamesByChipId001, TestSize.Level1)
340 {
341     int32_t ret;
342     uint8_t chipId = 0;
343     uint8_t chipIdInvalid = 100;
344     char *ifNames = nullptr;
345     uint32_t num = 0;
346 
347     ret = AcquireChipId(WLAN_IFNAME, &chipId);
348     ASSERT_TRUE(chipId < MAX_WLAN_DEVICE);
349     EXPECT_EQ(RET_CODE_SUCCESS, ret);
350     ret = GetIfNamesByChipId(chipIdInvalid, &ifNames, &num);
351     EXPECT_NE(RET_CODE_SUCCESS, ret);
352     ret = GetIfNamesByChipId(chipId, &ifNames, &num);
353     EXPECT_NE(ifNames, nullptr);
354     EXPECT_EQ(RET_CODE_SUCCESS, ret);
355     ret = GetIfNamesByChipId(chipId, &ifNames, nullptr);
356     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
357     ret = GetIfNamesByChipId(chipId, nullptr, &num);
358     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
359     free(ifNames);
360 }
361 
362 /**
363  * @tc.name: WifiClientGetNetDeviceInfo001
364  * @tc.desc: Wifi client get netDevice information function test
365  * @tc.type: FUNC
366  * @tc.require: AR000H603L
367  */
368 HWTEST_F(WifiClientTest, WifiClientGetNetDeviceInfo001, TestSize.Level1)
369 {
370     int32_t ret;
371     struct NetDeviceInfoResult netDeviceInfoResult;
372 
373     ret = GetNetDeviceInfo(&netDeviceInfoResult);
374     EXPECT_EQ(RET_CODE_SUCCESS, ret);
375 }
376 
377 /**
378  * @tc.name: WifiClientGetCurrentPowerMode001
379  * @tc.desc: Wifi client get current power mode function test
380  * @tc.type: FUNC
381  * @tc.require: AR000H603L
382  */
383 HWTEST_F(WifiClientTest, WifiClientGetCurrentPowerMode001, TestSize.Level1)
384 {
385     int32_t ret;
386     uint8_t mode = 0;
387     const char *ifNameInvalid = "wlanTest";
388 
389     ret = GetCurrentPowerMode(ifNameInvalid, &mode);
390     EXPECT_NE(RET_CODE_SUCCESS, ret);
391     ret = GetCurrentPowerMode(WLAN_IFNAME, &mode);
392     bool flag = (ret == RET_CODE_SUCCESS || ret == RET_CODE_NOT_SUPPORT);
393     ASSERT_TRUE(flag);
394 }
395 
396 /**
397  * @tc.name: WifiClientSetPowerMode001
398  * @tc.desc: Wifi client set power mode function test
399  * @tc.type: FUNC
400  * @tc.require: AR000H603L
401  */
402 HWTEST_F(WifiClientTest, WifiClientSetPowerMode001, TestSize.Level1)
403 {
404     int32_t ret;
405     const char *ifNameInvalid = "wlanTest";
406 
407     ret = SetPowerMode(ifNameInvalid, WIFI_POWER_MODE_SLEEPING);
408     EXPECT_NE(RET_CODE_SUCCESS, ret);
409     ret = SetPowerMode(WLAN_IFNAME, WIFI_POWER_MODE_SLEEPING);
410     bool flag = (ret == RET_CODE_SUCCESS || ret == RET_CODE_NOT_SUPPORT);
411     ASSERT_TRUE(flag);
412 }
413 
414 /**
415  * @tc.name: WifiClientSetPowerMode002
416  * @tc.desc: Wifi client set power mode function test
417  * @tc.type: FUNC
418  * @tc.require: AR000H603L
419  */
420 HWTEST_F(WifiClientTest, WifiClientSetPowerMode002, TestSize.Level1)
421 {
422     int32_t ret;
423 
424     ret = SetPowerMode(WLAN_IFNAME, WIFI_POWER_MODE_GENERAL);
425     bool flag = (ret == RET_CODE_SUCCESS || ret == RET_CODE_NOT_SUPPORT);
426     ASSERT_TRUE(flag);
427 }
428 
429 /**
430  * @tc.name: WifiClientSetPowerMode003
431  * @tc.desc: Wifi client set power mode function test
432  * @tc.type: FUNC
433  * @tc.require: AR000H603L
434  */
435 HWTEST_F(WifiClientTest, WifiClientSetPowerMode003, TestSize.Level1)
436 {
437     int32_t ret;
438 
439     ret = SetPowerMode(WLAN_IFNAME, WIFI_POWER_MODE_THROUGH_WALL);
440     bool flag = (ret == RET_CODE_SUCCESS || ret == RET_CODE_NOT_SUPPORT);
441     ASSERT_TRUE(flag);
442 }
443 
444 /**
445  * @tc.name: WifiClientSetPowerMode004
446  * @tc.desc: Wifi client set power mode function test
447  * @tc.type: FUNC
448  * @tc.require: AR000H603L
449  */
450 HWTEST_F(WifiClientTest, WifiClientSetPowerMode004, TestSize.Level1)
451 {
452     int32_t ret;
453 
454     ret = SetPowerMode(WLAN_IFNAME, WIFI_POWER_MODE_NUM);
455     EXPECT_NE(RET_CODE_SUCCESS, ret);
456 }
457 
458 /**
459  * @tc.name: WifiRegisterHid2dCallback001
460  * @tc.desc: Wifi register hid2d callback function test
461  * @tc.type: FUNC
462  * @tc.require:
463  */
464 HWTEST_F(WifiClientTest, WifiRegisterHid2dCallback001, TestSize.Level1)
465 {
466     int32_t ret;
467 
468     ret = WifiRegisterHid2dCallback(nullptr, WLAN_IFNAME);
469     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
470     ret = WifiRegisterHid2dCallback(Hid2dFunCb, nullptr);
471     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
472     ret = WifiRegisterHid2dCallback(Hid2dFunCb, WLAN_IFNAME);
473     EXPECT_EQ(RET_CODE_SUCCESS, ret);
474     WifiUnregisterHid2dCallback(nullptr, WLAN_IFNAME);
475     WifiUnregisterHid2dCallback(Hid2dFunCb, nullptr);
476 }
477 
478 /**
479  * @tc.name: WifiGetSignalPollInfo001
480  * @tc.desc: Wifi get signal poll info function test
481  * @tc.type: FUNC
482  * @tc.require:
483  */
484 HWTEST_F(WifiClientTest, WifiGetSignalPollInfo001, TestSize.Level1)
485 {
486     int32_t ret;
487     const char *ifNameInvalid = "wlanTest";
488     struct SignalResult signalResult;
489     (void)memset_s(&signalResult, sizeof(signalResult), 0, sizeof(signalResult));
490 
491     ret = WifiGetSignalPollInfo(nullptr, &signalResult);
492     EXPECT_EQ(RET_CODE_FAILURE, ret);
493     ret = WifiGetSignalPollInfo(ifNameInvalid, nullptr);
494     EXPECT_EQ(RET_CODE_FAILURE, ret);
495     ret = WifiGetSignalPollInfo(ifNameInvalid, &signalResult);
496     EXPECT_EQ(RET_CODE_FAILURE, ret);
497 }
498 
WifiEventCb(uint32_t event,void * respData,const char * ifName)499 static int32_t WifiEventCb(uint32_t event, void *respData, const char *ifName)
500 {
501     (void)event;
502     (void)respData;
503     (void)ifName;
504     return RET_CODE_SUCCESS;
505 }
506 
507 /**
508  * @tc.name: WifiRegisterEventCallback001
509  * @tc.desc: Wifi register event callback function test
510  * @tc.type: FUNC
511  * @tc.require:
512  */
513 HWTEST_F(WifiClientTest, WifiRegisterEventCallback001, TestSize.Level1)
514 {
515     int32_t ret;
516 
517     ret = WifiRegisterEventCallback(nullptr, WIFI_KERNEL_TO_HAL_CLIENT, WLAN_IFNAME);
518     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
519     ret = WifiRegisterEventCallback(WifiEventCb, WIFI_KERNEL_TO_HAL_CLIENT, nullptr);
520     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
521     WifiUnregisterEventCallback(nullptr, WIFI_KERNEL_TO_HAL_CLIENT, WLAN_IFNAME);
522     WifiUnregisterEventCallback(WifiEventCb, WIFI_KERNEL_TO_HAL_CLIENT, nullptr);
523 }
524 
525 /**
526  * @tc.name: WifiRegisterActionFrameReceiver001
527  * @tc.desc: Wifi register action frame function test
528  * @tc.type: FUNC
529  * @tc.require:
530  */
531 HWTEST_F(WifiClientTest, WifiRegisterActionFrameReceiver001, TestSize.Level1)
532 {
533     int32_t ret;
534     const char *ifNameInvalid = "wlanTest";
535     uint8_t mastch = 0;
536     uint32_t matchLen = RESET_TIME;
537 
538     ret = WifiRegisterActionFrameReceiver(nullptr, &mastch, matchLen);
539     EXPECT_EQ(RET_CODE_FAILURE, ret);
540     ret = WifiRegisterActionFrameReceiver(ifNameInvalid, 0, matchLen);
541     EXPECT_EQ(RET_CODE_FAILURE, ret);
542     ret = WifiRegisterActionFrameReceiver(ifNameInvalid, &mastch, 0);
543     EXPECT_EQ(RET_CODE_FAILURE, ret);
544     ret = WifiRegisterActionFrameReceiver(ifNameInvalid, &mastch, matchLen);
545     EXPECT_EQ(RET_CODE_FAILURE, ret);
546 }
547 
548 /**
549  * @tc.name: WifiSendActionFrame001
550  * @tc.desc: Wifi send action frame function test
551  * @tc.type: FUNC
552  * @tc.require:
553  */
554 HWTEST_F(WifiClientTest, WifiSendActionFrame001, TestSize.Level1)
555 {
556     int32_t ret;
557     const char *ifNameInvalid = "wlanTest";
558     uint8_t frameData = 0;
559     uint32_t freq = RESET_TIME;
560     uint32_t frameDataLen = RESET_TIME;
561 
562     ret = WifiSendActionFrame(nullptr, freq, &frameData, frameDataLen);
563     EXPECT_EQ(RET_CODE_FAILURE, ret);
564     ret = WifiSendActionFrame(ifNameInvalid, 0, &frameData, frameDataLen);
565     EXPECT_EQ(RET_CODE_FAILURE, ret);
566     ret = WifiSendActionFrame(ifNameInvalid, freq, &frameData, frameDataLen);
567     EXPECT_EQ(RET_CODE_FAILURE, ret);
568     ret = WifiSendActionFrame(ifNameInvalid, freq, &frameData, 0);
569     EXPECT_EQ(RET_CODE_FAILURE, ret);
570     ret = WifiSendActionFrame(ifNameInvalid, freq, &frameData, frameDataLen);
571     EXPECT_EQ(RET_CODE_FAILURE, ret);
572 }
573 
574 /**
575  * @tc.name: ClientGetApBandwidth001
576  * @tc.desc: client get ap bandwidth function test
577  * @tc.type: FUNC
578  * @tc.require:
579  */
580 HWTEST_F(WifiClientTest, ClientGetApBandwidth001, TestSize.Level1)
581 {
582     int32_t ret;
583     const char *ifNameInvalid = "wlanTest";
584     uint8_t bandwidth = 0;
585 
586     ret = ClientGetApBandwidth(nullptr, &bandwidth);
587     EXPECT_EQ(RET_CODE_FAILURE, ret);
588     ret = ClientGetApBandwidth(ifNameInvalid, nullptr);
589     EXPECT_EQ(RET_CODE_FAILURE, ret);
590     ret = ClientGetApBandwidth(ifNameInvalid, &bandwidth);
591     EXPECT_EQ(RET_CODE_FAILURE, ret);
592 }
593 
594 /**
595  * @tc.name: SetProjectionScreenParam001
596  * @tc.desc: set rx remain On channel test
597  * @tc.type: FUNC
598  * @tc.require:
599  */
600 HWTEST_F(WifiClientTest, SetProjectionScreenParam001, TestSize.Level1)
601 {
602     int32_t ret;
603     const char *ifNameInvalid = "wlanTest";
604     ProjectionScreenParam *param = nullptr;
605     param->cmdId = CMD_ID_RX_REMAIN_ON_CHANNEL;
606     param->buf[0] = 0;
607     param->bufLen = 40;
608     ret = SetProjectionScreenParam(ifNameInvalid, param);
609     EXPECT_EQ(RET_CODE_FAILURE, ret);
610 }
611 
612 /**
613  * @tc.name: SetProjectionScreenParam001
614  * @tc.desc: set rx remain On channel test
615  * @tc.type: FUNC
616  * @tc.require:
617  */
618 HWTEST_F(WifiClientTest, SetProjectionScreenParam002, TestSize.Level1)
619 {
620     int32_t ret;
621     const char *ifNameInvalid = "wlanTest";
622     ProjectionScreenParam *param = nullptr;
623     param->cmdId = CMD_ID_RX_REMAIN_ON_CHANNEL;
624     param->buf[0] = 0;
625     param->bufLen = 1;
626     ret = SetProjectionScreenParam(ifNameInvalid, param);
627     EXPECT_EQ(RET_CODE_FAILURE, ret);
628 }
629 /**
630  * @tc.name: WifiEapolPacketSend001
631  * @tc.desc: set rx remain On channel test
632  * @tc.type: FUNC
633  * @tc.require:
634  */
635 HWTEST_F(WifiClientTest, WifiEapolPacketSend001, TestSize.Level1)
636 {
637     int32_t ret;
638     int32_t length = 0;
639     const char *ifNameInvalid = "wlanTest";
640     uint8_t srcAddr = 0;
641     uint8_t dstAddr = 0;
642     uint8_t buf = 0;
643     ret = WifiEapolPacketSend(NULL, &srcAddr, &dstAddr, &buf, length);
644     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
645     WifiEapolPacketSend(ifNameInvalid, &srcAddr, &dstAddr, &buf, length);
646 }
647 /**
648  * @tc.name: WifiEapolPacketReceive002
649  * @tc.desc: set rx remain On channel test
650  * @tc.type: FUNC
651  * @tc.require:
652  */
653 HWTEST_F(WifiClientTest, WifiEapolPacketReceive002, TestSize.Level1)
654 {
655     int32_t ret;
656     const char *ifNameInvalid = "wlanTest";
657     WifiRxEapol *rxEapol = NULL;
658     ret = WifiEapolPacketReceive(NULL, rxEapol);
659     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
660     ret = WifiEapolPacketReceive(ifNameInvalid, rxEapol);
661     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
662 }
663 /**
664  * @tc.name: WifiEapolEnable003
665  * @tc.desc: set rx remain On channel test
666  * @tc.type: FUNC
667  * @tc.require:
668  */
669 HWTEST_F(WifiClientTest, WifiEapolEnable003, TestSize.Level1)
670 {
671     int32_t ret;
672     const char *ifNameInvalid = "wlanTest";
673     ret = WifiEapolEnable(NULL);
674     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
675     WifiEapolEnable(ifNameInvalid);
676 }
677 /**
678  * @tc.name: WifiEapolDisable004
679  * @tc.desc: set rx remain On channel test
680  * @tc.type: FUNC
681  * @tc.require:
682  */
683 HWTEST_F(WifiClientTest, WifiEapolDisable004, TestSize.Level1)
684 {
685     int32_t ret;
686     const char *ifNameInvalid = "wlanTest";
687     ret = WifiEapolDisable(NULL);
688     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
689     WifiEapolDisable(ifNameInvalid);
690 }
691 /**
692  * @tc.name: WifiCmdSetAp005
693  * @tc.desc: set rx remain On channel test
694  * @tc.type: FUNC
695  * @tc.require:
696  */
697 HWTEST_F(WifiClientTest, WifiCmdSetAp005, TestSize.Level1)
698 {
699     int32_t ret;
700     const char *ifNameInvalid = "wlanTest";
701     WifiApSetting *apsettings = NULL;
702     ret = WifiCmdSetAp(NULL, apsettings);
703     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
704     ret = WifiCmdSetAp(ifNameInvalid, apsettings);
705     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
706 }
707 /**
708  * @tc.name: WifiCmdChangeBeacon006
709  * @tc.desc: set rx remain On channel test
710  * @tc.type: FUNC
711  * @tc.require:
712  */
713 HWTEST_F(WifiClientTest, WifiCmdChangeBeacon006, TestSize.Level1)
714 {
715     int32_t ret;
716     const char *ifNameInvalid = "wlanTest";
717     WifiApSetting *apsettings = NULL;
718     ret = WifiCmdChangeBeacon(NULL, apsettings);
719     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
720     ret = WifiCmdChangeBeacon(ifNameInvalid, apsettings);
721     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
722 }
723 /**
724  * @tc.name: WifiCmdSendMlme007
725  * @tc.desc: set rx remain On channel test
726  * @tc.type: FUNC
727  * @tc.require:
728  */
729 HWTEST_F(WifiClientTest, WifiCmdSendMlme007, TestSize.Level1)
730 {
731     int32_t ret;
732     const char *ifNameInvalid = "wlanTest";
733     WifiMlmeData *mlme = NULL;
734     ret = WifiCmdSendMlme(NULL, mlme);
735     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
736     ret = WifiCmdSendMlme(ifNameInvalid, mlme);
737     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
738 }
739 /**
740  * @tc.name: WifiCmdDelKey008
741  * @tc.desc: set rx remain On channel test
742  * @tc.type: FUNC
743  * @tc.require:
744  */
745 HWTEST_F(WifiClientTest, WifiCmdDelKey008, TestSize.Level1)
746 {
747     int32_t ret;
748     const char *ifNameInvalid = "wlanTest";
749     WifiKeyExt *keyExt = NULL;
750     ret = WifiCmdDelKey(NULL, keyExt);
751     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
752     ret = WifiCmdDelKey(ifNameInvalid, keyExt);
753     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
754 }
755 /**
756  * @tc.name: WifiCmdNewKey009
757  * @tc.desc: set rx remain On channel test
758  * @tc.type: FUNC
759  * @tc.require:
760  */
761 HWTEST_F(WifiClientTest, WifiCmdNewKey009, TestSize.Level1)
762 {
763     const char *ifNameInvalid = "wlanTest";
764     WifiKeyExt keyExt;
765     WifiCmdNewKey(ifNameInvalid, &keyExt);
766 }
767 /**
768  * @tc.name: WifiCmdSetKey0010
769  * @tc.desc: set rx remain On channel test
770  * @tc.type: FUNC
771  * @tc.require:
772  */
773 HWTEST_F(WifiClientTest, WifiCmdSetKey0010, TestSize.Level1)
774 {
775     const char *ifNameInvalid = "wlanTest";
776     WifiKeyExt keyExt;
777     WifiCmdSetKey(ifNameInvalid, &keyExt);
778 }
779 /**
780  * @tc.name: WifiCmdGetOwnMac0011
781  * @tc.desc: set rx remain On channel test
782  * @tc.type: FUNC
783  * @tc.require:
784  */
785 HWTEST_F(WifiClientTest, WifiCmdGetOwnMac0011, TestSize.Level1)
786 {
787     int32_t ret;
788     const char *ifNameInvalid = "wlanTest";
789     uint32_t len = 0;
790     ret = WifiCmdGetOwnMac(NULL, NULL, len);
791     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
792     ret = WifiCmdGetOwnMac(ifNameInvalid, NULL, len);
793     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
794     WifiCmdGetOwnMac(ifNameInvalid, NULL, len);
795 }
796 /**
797  * @tc.name: WifiCmdSetMode0012
798  * @tc.desc: set rx remain On channel test
799  * @tc.type: FUNC
800  * @tc.require:
801  */
802 HWTEST_F(WifiClientTest, WifiCmdSetMode0012, TestSize.Level1)
803 {
804     int32_t ret;
805     const char *ifNameInvalid = "wlanTest";
806     WifiSetMode *setMode = NULL;
807     ret = WifiCmdSetMode(NULL, setMode);
808     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
809     ret = WifiCmdSetMode(ifNameInvalid, setMode);
810     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
811 }
812 /**
813  * @tc.name: WifiCmdGetHwFeature0013
814  * @tc.desc: set rx remain On channel test
815  * @tc.type: FUNC
816  * @tc.require:
817  */
818 HWTEST_F(WifiClientTest, WifiCmdGetHwFeature0013, TestSize.Level1)
819 {
820     int32_t ret;
821     const char *ifNameInvalid = "wlanTest";
822     WifiHwFeatureData hwFeatureData;
823     ret = WifiCmdGetHwFeature(NULL, &hwFeatureData);
824     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
825     WifiCmdGetHwFeature(ifNameInvalid, &hwFeatureData);
826 }
827 /**
828  * @tc.name: WifiCmdDisconnet0014
829  * @tc.desc: set rx remain On channel test
830  * @tc.type: FUNC
831  * @tc.require:
832  */
833 HWTEST_F(WifiClientTest, WifiCmdDisconnet0014, TestSize.Level1)
834 {
835     int32_t ret;
836     const char *ifNameInvalid = "wlanTest";
837     int32_t reasonCode = 0;
838     ret = WifiCmdDisconnet(NULL, reasonCode);
839     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
840     WifiCmdDisconnet(ifNameInvalid, reasonCode);
841 }
842 /**
843  * @tc.name: WifiCmdAssoc0016
844  * @tc.desc: set rx remain On channel test
845  * @tc.type: FUNC
846  * @tc.require:
847  */
848 HWTEST_F(WifiClientTest, WifiCmdAssoc0016, TestSize.Level1)
849 {
850     int32_t ret;
851     const char *ifNameInvalid = "wlanTest";
852     WifiAssociateParams assocParams;
853     ret = WifiCmdAssoc(NULL, &assocParams);
854     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
855     WifiCmdAssoc(ifNameInvalid, &assocParams);
856 }
857 /**
858  * @tc.name: WifiCmdSetNetdev0017
859  * @tc.desc: set rx remain On channel test
860  * @tc.type: FUNC
861  * @tc.require:
862  */
863 HWTEST_F(WifiClientTest, WifiCmdSetNetdev0017, TestSize.Level1)
864 {
865     int32_t ret;
866     const char *ifNameInvalid = "wlanTest";
867     WifiSetNewDev info;
868     ret = WifiCmdSetNetdev(NULL, &info);
869     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
870     WifiCmdSetNetdev(ifNameInvalid, &info);
871 }
872 /**
873  * @tc.name: WifiCmdStaRemove0018
874  * @tc.desc: set rx remain On channel test
875  * @tc.type: FUNC
876  * @tc.require:
877  */
878 HWTEST_F(WifiClientTest, WifiCmdStaRemove0018, TestSize.Level1)
879 {
880     int32_t ret;
881     const char *ifNameInvalid = "wlanTest";
882     uint8_t *addr = NULL;
883     uint32_t addrLen = 0;
884     ret = WifiCmdStaRemove(NULL, addr, addrLen);
885     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
886     WifiCmdStaRemove(ifNameInvalid, addr, addrLen);
887 }
888 /**
889  * @tc.name: WifiCmdSendAction0019
890  * @tc.desc: set rx remain On channel test
891  * @tc.type: FUNC
892  * @tc.require:
893  */
894 HWTEST_F(WifiClientTest, WifiCmdSendAction0019, TestSize.Level1)
895 {
896     int32_t ret;
897     const char *ifNameInvalid = "wlanTest";
898     WifiActionData actionData;
899     ret = WifiCmdSendAction(NULL, &actionData);
900     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
901     WifiCmdSendAction(ifNameInvalid, &actionData);
902 }
903 /**
904  * @tc.name: WifiCmdSetClient0020
905  * @tc.desc: set rx remain On channel test
906  * @tc.type: FUNC
907  * @tc.require:
908  */
909 HWTEST_F(WifiClientTest, WifiCmdSetClient0020, TestSize.Level1)
910 {
911     uint32_t clientNum = 0;
912     WifiCmdSetClient(clientNum);
913 }
914 /**
915  * @tc.name: WifiCmdProbeReqReport0021
916  * @tc.desc: set rx remain On channel test
917  * @tc.type: FUNC
918  * @tc.require:
919  */
920 HWTEST_F(WifiClientTest, WifiCmdProbeReqReport0021, TestSize.Level1)
921 {
922     int32_t ret;
923     const char *ifNameInvalid = "wlanTest";
924     int32_t *report = NULL;
925     ret = WifiCmdProbeReqReport(NULL, report);
926     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
927     WifiCmdProbeReqReport(ifNameInvalid, report);
928 }
929 /**
930  * @tc.name: WifiCmdRemainOnChannel0022
931  * @tc.desc: set rx remain On channel test
932  * @tc.type: FUNC
933  * @tc.require:
934  */
935 HWTEST_F(WifiClientTest, WifiCmdRemainOnChannel0022, TestSize.Level1)
936 {
937     int32_t ret;
938     const char *ifNameInvalid = "wlanTest";
939     WifiOnChannel onChannel;
940     ret = WifiCmdRemainOnChannel(NULL, &onChannel);
941     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
942     WifiCmdRemainOnChannel(ifNameInvalid, &onChannel);
943 }
944 /**
945  * @tc.name: WifiCmdCancelRemainOnChannel0023
946  * @tc.desc: set rx remain On channel test
947  * @tc.type: FUNC
948  * @tc.require:
949  */
950 HWTEST_F(WifiClientTest, WifiCmdCancelRemainOnChannel0023, TestSize.Level1)
951 {
952     int32_t ret;
953     const char *ifNameInvalid = "wlanTest";
954     ret = WifiCmdCancelRemainOnChannel(NULL);
955     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
956     WifiCmdCancelRemainOnChannel(ifNameInvalid);
957 }
958 /**
959  * @tc.name: WifiCmdAddIf024
960  * @tc.desc: set rx remain On channel test
961  * @tc.type: FUNC
962  * @tc.require:
963  */
964 HWTEST_F(WifiClientTest, WifiCmdAddIf024, TestSize.Level1)
965 {
966     int32_t ret;
967     const char *ifNameInvalid = "wlanTest";
968     WifiIfAdd ifAdd;
969     ret = WifiCmdAddIf(NULL, &ifAdd);
970     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
971     WifiCmdAddIf(ifNameInvalid, &ifAdd);
972 }
973 /**
974  * @tc.name: WifiCmdRemoveIf025
975  * @tc.desc: set rx remain On channel test
976  * @tc.type: FUNC
977  * @tc.require:
978  */
979 HWTEST_F(WifiClientTest, WifiCmdRemoveIf025, TestSize.Level1)
980 {
981     int32_t ret;
982     const char *ifNameInvalid = "wlanTest";
983     WifiIfRemove ifRemove;
984     ret = WifiCmdRemoveIf(NULL, &ifRemove);
985     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
986     WifiCmdRemoveIf(ifNameInvalid, &ifRemove);
987 }
988 /**
989  * @tc.name: WifiCmdSetApWpsP2pIe026
990  * @tc.desc: set rx remain On channel test
991  * @tc.type: FUNC
992  * @tc.require:
993  */
994 HWTEST_F(WifiClientTest, WifiCmdSetApWpsP2pIe026, TestSize.Level1)
995 {
996     int32_t ret;
997     const char *ifNameInvalid = "wlanTest";
998     WifiAppIe appIe;
999     ret = WifiCmdSetApWpsP2pIe(NULL, &appIe);
1000     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
1001     WifiCmdSetApWpsP2pIe(ifNameInvalid, &appIe);
1002 }
1003 /**
1004  * @tc.name: WifiCmdGetDrvFlags027
1005  * @tc.desc: set rx remain On channel test
1006  * @tc.type: FUNC
1007  * @tc.require:
1008  */
1009 HWTEST_F(WifiClientTest, WifiCmdGetDrvFlags027, TestSize.Level1)
1010 {
1011     int32_t ret;
1012     const char *ifNameInvalid = "wlanTest";
1013     WifiGetDrvFlags params;
1014     ret = WifiCmdGetDrvFlags(NULL, &params);
1015     EXPECT_EQ(RET_CODE_INVALID_PARAM, ret);
1016     WifiCmdGetDrvFlags(ifNameInvalid, &params);
1017 }
1018 /**
1019  * @tc.name: WifiSetDpiMarkRule028
1020  * @tc.desc: set rx remain On channel test
1021  * @tc.type: FUNC
1022  * @tc.require:
1023  */
1024 HWTEST_F(WifiClientTest, WifiSetDpiMarkRule028, TestSize.Level1)
1025 {
1026     int32_t srcAddr = 0;
1027     int32_t dstAddr = 0;
1028     int32_t buf = 0;
1029     WifiSetDpiMarkRule(srcAddr, dstAddr, buf);
1030 }
1031 /**
1032  * @tc.name: WifiInstallWlanExtParam029
1033  * @tc.desc: install wlan ext param
1034  * @tc.type: FUNC
1035  * @tc.require:
1036  */
1037 HWTEST_F(WifiClientTest, WifiInstallWlanExtParam029, TestSize.Level1)
1038 {
1039     int32_t ret;
1040     const char *ifNameInvalid = "wlanTest";
1041     InstallWlanParam param;
1042     param.id = 0;
1043     param.suite = 0;
1044     param.len = 0;
1045     ret = WifiInstallWlanExtParam(ifNameInvalid, &param);
1046     EXPECT_EQ(RET_CODE_FAILURE, ret);
1047 }
1048 /**
1049  * @tc.name: WpaEventReport
1050  * @tc.desc: set rx remain On channel test
1051  * @tc.type: FUNC
1052  * @tc.require:
1053  */
1054 #ifdef OHOS_ARCH_LITE
WpaEventCb(uint32_t event,void * respData,const char * ifName)1055 static int32_t WpaEventCb(uint32_t event, void *respData, const char *ifName)
1056 {
1057     (void)event;
1058     (void)respData;
1059     (void)ifName;
1060     return RET_CODE_SUCCESS;
1061 }
1062 
1063 /**
1064  * @tc.name: GetChannelMeasResult027
1065  * @tc.desc: set rx remain On channel test
1066  * @tc.type: FUNC
1067  * @tc.require:
1068  */
1069 HWTEST_F(WifiClientTest, GetChannelMeasResult027, TestSize.Level1)
1070 {
1071     int32_t ret;
1072     const char *ifNameInvalid = "wlanTest";
1073     MeasResult measResult;
1074     ret = GetChannelMeasResult(NULL, &measResult);
1075     EXPECT_EQ(RET_CODE_NOT_SUPPORT, ret);
1076     GetChannelMeasResult(ifNameInvalid, &measResult);
1077 }
1078  /**
1079  * @tc.name: WpaRegisterEventCallback01
1080  * @tc.desc: wpa register event callback function test
1081  * @tc.type: FUNC
1082  * @tc.require:
1083  */
1084 HWTEST_F(WifiClientTest, WpaRegisterEventCallback01, TestSize.Level1)
1085 {
1086     int32_t ret;
1087 
1088     ret = WpaRegisterEventCallback(nullptr, WIFI_WPA_TO_HAL_CLIENT, WLAN_IFNAME);
1089     EXPECT_EQ(RET_CODE_FAILURE, ret);
1090     ret = WpaRegisterEventCallback(WpaEventCb, WIFI_WPA_TO_HAL_CLIENT, nullptr);
1091     EXPECT_EQ(RET_CODE_FAILURE, ret);
1092     WpaRegisterEventCallback(WpaEventCb, WIFI_WPA_TO_HAL_CLIENT, WLAN_IFNAME);
1093     WpaUnregisterEventCallback(WpaEventCb, WIFI_WPA_TO_HAL_CLIENT, WLAN_IFNAME);
1094     WpaUnregisterEventCallback(nullptr, WIFI_WPA_TO_HAL_CLIENT, WLAN_IFNAME);
1095     WpaUnregisterEventCallback(WpaEventCb, WIFI_WPA_TO_HAL_CLIENT, nullptr);
1096 }
1097 
1098 /**
1099  * @tc.name: WpaEventReport02
1100  * @tc.desc: wpa cb interface test
1101  * @tc.type: FUNC
1102  * @tc.require:
1103  */
1104 HWTEST_F(WifiClientTest, WpaEventReport02, TestSize.Level1)
1105 {
1106     struct WpaStateChangedParam wpaStateChangedParma = {0};
1107     WpaEventReport(WLAN_IFNAME, WPA_EVENT_STATE_CHANGED, (void *) &wpaStateChangedParma);
1108     WpaEventReport(WLAN_IFNAME, WPA_EVENT_STATE_CHANGED, nullptr);
1109     WpaEventReport(nullptr, WPA_EVENT_STATE_CHANGED, (void *) &wpaStateChangedParma);
1110 }
1111 
1112 /**
1113  * @tc.name: HostapdRegisterEventCallback03
1114  * @tc.desc: hostapd register event callback function test
1115  * @tc.type: FUNC
1116  * @tc.require:
1117  */
1118 HWTEST_F(WifiClientTest, HostapdRegisterEventCallback03, TestSize.Level1)
1119 {
1120     int32_t ret;
1121 
1122     ret = HostapdRegisterEventCallback(nullptr, WIFI_HOSTAPD_TO_HAL_CLIENT, WLAN_IFNAME);
1123     EXPECT_EQ(RET_CODE_FAILURE, ret);
1124     ret = HostapdRegisterEventCallback(WpaEventCb, WIFI_HOSTAPD_TO_HAL_CLIENT, nullptr);
1125     EXPECT_EQ(RET_CODE_FAILURE, ret);
1126     HostapdRegisterEventCallback(WpaEventCb, WIFI_HOSTAPD_TO_HAL_CLIENT, WLAN_IFNAME);
1127     HostapdUnregisterEventCallback(WpaEventCb, WIFI_HOSTAPD_TO_HAL_CLIENT, WLAN_IFNAME);
1128     HostapdUnregisterEventCallback(nullptr, WIFI_HOSTAPD_TO_HAL_CLIENT, WLAN_IFNAME);
1129     HostapdUnregisterEventCallback(WpaEventCb, WIFI_HOSTAPD_TO_HAL_CLIENT, nullptr);
1130 }
1131 
1132 /**
1133  * @tc.name: HostapdEventReport04
1134  * @tc.desc: hostapd cb interface test
1135  * @tc.type: FUNC
1136  * @tc.require:
1137  */
1138 HWTEST_F(WifiClientTest, HostapdEventReport04, TestSize.Level1)
1139 {
1140     struct HostapdApCbParm hostapdApCbParm = {};
1141     HostapdEventReport(WLAN_IFNAME, HOSTAPD_EVENT_AP_STATE, (void *) &hostapdApCbParm);
1142     HostapdEventReport(WLAN_IFNAME, HOSTAPD_EVENT_AP_STATE, nullptr);
1143     HostapdEventReport(nullptr, HOSTAPD_EVENT_AP_STATE, (void *) &hostapdApCbParm);
1144 }
1145 
1146 /**
1147  * @tc.name: WifiSetPowerSaveMode029
1148  * @tc.desc: set rx remain On channel test
1149  * @tc.type: FUNC
1150  * @tc.require:
1151  */
1152 HWTEST_F(WifiClientTest, WifiSetPowerSaveMode029, TestSize.Level1)
1153 {
1154     int32_t frequency = 0;
1155     int32_t mode = 0;
1156     const char *ifName = "wlanTest";
1157     WifiSetPowerSaveMode(ifName, frequency, mode);
1158 }
1159 }
1160 }
1161 #endif
1162 };