1/* 2 * Copyright (c) 2021 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 <cstdint> 17#include <cstdio> 18#include <cstdlib> 19#include <string> 20#include <unistd.h> 21#include <fcntl.h> 22#include <gtest/gtest.h> 23#include "hdf_io_service_if.h" 24#include "hdf_uhdf_test.h" 25#include "hdf_wifi_test.h" 26 27using namespace testing::ext; 28 29namespace NetDeviceTest { 30class WiFiNetDeviceTest : public testing::Test { 31public: 32 static void SetUpTestCase(); 33 static void TearDownTestCase(); 34 void SetUp(); 35 void TearDown(); 36}; 37 38void WiFiNetDeviceTest::SetUpTestCase() 39{ 40 HdfTestOpenService(); 41 struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_NET_DEVICE_INIT, -1}; 42 HdfTestSendMsgToService(&msg); 43} 44 45void WiFiNetDeviceTest::TearDownTestCase() 46{ 47 struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_NET_DEVICE_DEINIT, -1}; 48 HdfTestSendMsgToService(&msg); 49 HdfTestCloseService(); 50} 51 52void WiFiNetDeviceTest::SetUp() {} 53 54void WiFiNetDeviceTest::TearDown() {} 55 56/** 57 * @tc.name: WiFiNetDeviceInit001 58 * @tc.desc: init netdevice function test 59 * @tc.type: FUNC 60 * @tc.require: AR000F869H 61 */ 62HWTEST_F(WiFiNetDeviceTest, WiFiNetDeviceInit001, TestSize.Level1) 63{ 64 struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_NET_DEVICE_INIT, -1}; 65 EXPECT_EQ(0, HdfTestSendMsgToService(&msg)); 66} 67 68/** 69 * @tc.name: WiFiNetDeviceAdd001 70 * @tc.desc: add netdevice function test 71 * @tc.type: FUNC 72 * @tc.require: AR000F869H 73 */ 74HWTEST_F(WiFiNetDeviceTest, WiFiNetDeviceAdd001, TestSize.Level1) 75{ 76 struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_NET_DEVICE_ADD, -1}; 77 EXPECT_EQ(0, HdfTestSendMsgToService(&msg)); 78} 79 80/** 81 * @tc.name: WiFiNetDeviceGet001 82 * @tc.desc: get netdevice function test 83 * @tc.type: FUNC 84 * @tc.require: AR000F869H 85 */ 86HWTEST_F(WiFiNetDeviceTest, WiFiNetDeviceGet001, TestSize.Level1) 87{ 88 struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_NET_DEVICE_GET, -1}; 89 EXPECT_EQ(0, HdfTestSendMsgToService(&msg)); 90} 91 92/** 93 * @tc.name: WiFiNetDeviceGetCount001 94 * @tc.desc: netdevice count query function test 95 * @tc.type: FUNC 96 * @tc.require: AR000F869H 97 */ 98HWTEST_F(WiFiNetDeviceTest, WiFiNetDeviceGetCount001, TestSize.Level1) 99{ 100 struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_NET_DEVICE_GET_COUNT, -1}; 101 EXPECT_EQ(0, HdfTestSendMsgToService(&msg)); 102} 103 104/** 105 * @tc.name: WiFiNetDeviceGetCap001 106 * @tc.desc: netdevice capability query function test 107 * @tc.type: FUNC 108 * @tc.require: AR000F869H 109 */ 110HWTEST_F(WiFiNetDeviceTest, WiFiNetDeviceGetCap001, TestSize.Level1) 111{ 112 struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_NET_DEVICE_GET_CAP, -1}; 113 EXPECT_EQ(0, HdfTestSendMsgToService(&msg)); 114} 115 116/** 117 * @tc.name: WiFiNetDeviceSetAddr001 118 * @tc.desc: set netdevice addr function test 119 * @tc.type: FUNC 120 * @tc.require: AR000F869H 121 */ 122HWTEST_F(WiFiNetDeviceTest, WiFiNetDeviceSetAddr001, TestSize.Level1) 123{ 124 struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_NET_DEVICE_SET_ADDR, -1}; 125 EXPECT_EQ(0, HdfTestSendMsgToService(&msg)); 126} 127 128/** 129 * @tc.name: WiFiNetDeviceDhcpClient001 130 * @tc.desc: netdevice dhcp client function test 131 * @tc.type: FUNC 132 * @tc.require: AR000F869L 133 */ 134HWTEST_F(WiFiNetDeviceTest, WiFiNetDeviceDhcpClient001, TestSize.Level1) 135{ 136 struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_NET_DEVICE_DHCPC, -1}; 137 EXPECT_EQ(0, HdfTestSendMsgToService(&msg)); 138} 139 140/** 141 * @tc.name: WiFiNetDeviceDhcpServer001 142 * @tc.desc: netdevice dhcp server function test 143 * @tc.type: FUNC 144 * @tc.require: AR000F869L 145 */ 146HWTEST_F(WiFiNetDeviceTest, WiFiNetDeviceDhcpServer001, TestSize.Level1) 147{ 148 struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_NET_DEVICE_DHCPS, -1}; 149 EXPECT_EQ(0, HdfTestSendMsgToService(&msg)); 150} 151 152/** 153 * @tc.name: WiFiNetDeviceSetStatus001 154 * @tc.desc: set netdevice status function test 155 * @tc.type: FUNC 156 * @tc.require: AR000F869H 157 */ 158HWTEST_F(WiFiNetDeviceTest, WiFiNetDeviceSetStatus001, TestSize.Level1) 159{ 160 struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_NET_DEVICE_SET_STATUS, -1}; 161 EXPECT_EQ(0, HdfTestSendMsgToService(&msg)); 162} 163 164/** 165 * @tc.name: WiFiNetDeviceSetLinkStatus001 166 * @tc.desc: set netdevice link status function test 167 * @tc.type: FUNC 168 * @tc.require: AR000F869H 169 */ 170HWTEST_F(WiFiNetDeviceTest, WiFiNetDeviceSetLinkStatus001, TestSize.Level1) 171{ 172 struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_NET_DEVICE_SET_LINK_STATUS, -1}; 173 EXPECT_EQ(0, HdfTestSendMsgToService(&msg)); 174} 175 176/** 177 * @tc.name: WiFiNetDeviceRx001 178 * @tc.desc: netdevice receive packet function test 179 * @tc.type: FUNC 180 * @tc.require: AR000F869H 181 */ 182HWTEST_F(WiFiNetDeviceTest, WiFiNetDeviceRx001, TestSize.Level1) 183{ 184 struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_NET_DEVICE_RX, -1}; 185 EXPECT_EQ(0, HdfTestSendMsgToService(&msg)); 186} 187 188/** 189 * @tc.name: WiFiNetDeviceDelete001 190 * @tc.desc: delete netdevice function test 191 * @tc.type: FUNC 192 * @tc.require: AR000F869H 193 */ 194HWTEST_F(WiFiNetDeviceTest, WiFiNetDeviceDelete001, TestSize.Level1) 195{ 196 struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_NET_DEVICE_DELETE, -1}; 197 EXPECT_EQ(0, HdfTestSendMsgToService(&msg)); 198} 199 200/** 201 * @tc.name: WiFiNetDeviceDeInit001 202 * @tc.desc: deinit netdevice function test 203 * @tc.type: FUNC 204 * @tc.require: AR000F869H 205 */ 206HWTEST_F(WiFiNetDeviceTest, WiFiNetDeviceDeInit001, TestSize.Level1) 207{ 208 struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_NET_DEVICE_DEINIT, -1}; 209 EXPECT_EQ(0, HdfTestSendMsgToService(&msg)); 210} 211}; 212