1 /* 2 * Copyright (C) 2024 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 #include <gtest/gtest.h> 16 #include <gmock/gmock.h> 17 #include "wifi_netlink.h" 18 19 using namespace OHOS::Wifi; 20 using ::testing::_; 21 using ::testing::DoAll; 22 using ::testing::Eq; 23 using ::testing::Return; 24 using ::testing::SetArgReferee; 25 using ::testing::StrEq; 26 using ::testing::TypedEq; 27 using ::testing::ext::TestSize; 28 29 enum CmdWord { 30 CMD_START_MONITOR = 10, 31 }; 32 33 class WifiNetLinkTest : public testing::Test { 34 protected: SetUp()35 void SetUp() override 36 {} 37 TearDown()38 void TearDown() override 39 {} 40 }; 41 42 HWTEST_F(WifiNetLinkTest, TestInitWifiNetLink, TestSize.Level1) 43 { 44 WifiNetLinkCallbacks callbacks; 45 WifiNetLink::GetInstance().InitWifiNetLink(callbacks); 46 } 47 48 HWTEST_F(WifiNetLinkTest, TestSendCmdKernel, TestSize.Level1) 49 { 50 WifiNetLink wifiNetLink; 51 int32_t sockFd = 123; 52 int32_t cmd = 456; 53 int32_t flag = 789; 54 WifiNetLink::GetInstance().SendCmdKernel(sockFd, cmd, flag); 55 } 56 57 HWTEST_F(WifiNetLinkTest, TestStartMonitor, TestSize.Level1) 58 { 59 int32_t sockFd = 123; 60 WifiNetLink::GetInstance().StartMonitor(sockFd); 61 } 62 63 HWTEST_F(WifiNetLinkTest, TestProcessQueryTcp, TestSize.Level1) 64 { 65 int32_t sockFd = 123; 66 WifiNetLink::GetInstance().ProcessQueryTcp(sockFd); 67 } 68 69 HWTEST_F(WifiNetLinkTest, TestSendQoeCmd, TestSize.Level1) 70 { 71 int32_t cmd = 123; 72 int32_t arg = 456; 73 WifiNetLink::GetInstance().SendQoeCmd(cmd, arg); 74 } 75 76 HWTEST_F(WifiNetLinkTest, TestProcessReportMsg, TestSize.Level1) 77 { 78 int32_t sockFd = 123; 79 int32_t cmd = 456; 80 WifiNetLink::GetInstance().ProcessReportMsg(sockFd, cmd); 81 } 82 83 HWTEST_F(WifiNetLinkTest, SendQoeCmdTest001, TestSize.Level1) 84 { 85 int32_t cmd = CMD_START_MONITOR; 86 int32_t arg = 456; 87 WifiNetLink::GetInstance().SendQoeCmd(cmd, arg); 88 }