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