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