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 <fcntl.h>
20 #include <gtest/gtest.h>
21 #include <string>
22 #include <unistd.h>
23 #include "hdf_uhdf_test.h"
24 #include "hdf_io_service_if.h"
25 #include "hdf_wifi_test.h"
26
27 using namespace testing::ext;
28
29 namespace ModuleTest {
30 class WiFiModuleTest : public testing::Test {
31 public:
32 static void SetUpTestCase();
33 static void TearDownTestCase();
34 void SetUp();
35 void TearDown();
36 };
37
SetUpTestCase()38 void WiFiModuleTest::SetUpTestCase()
39 {
40 HdfTestOpenService();
41 }
42
TearDownTestCase()43 void WiFiModuleTest::TearDownTestCase()
44 {
45 HdfTestCloseService();
46 }
47
SetUp()48 void WiFiModuleTest::SetUp() {}
49
TearDown()50 void WiFiModuleTest::TearDown() {}
51
52 /**
53 * @tc.name: WiFiModuleCreate001
54 * @tc.desc: wifi create module function test
55 * @tc.type: FUNC
56 */
HWTEST_F(WiFiModuleTest, SUB_WLAN_MODULE_Create_0001, Function | MediumTest | Level1)57 HWTEST_F(WiFiModuleTest, SUB_WLAN_MODULE_Create_0001, Function | MediumTest | Level1)
58 {
59 struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_MODULE_CREATE_MODULE, -1};
60 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
61 }
62
63 /**
64 * @tc.name: WiFiModuleAddFeature001
65 * @tc.desc: wifi module add feature function test
66 * @tc.type: FUNC
67 */
HWTEST_F(WiFiModuleTest, SUB_WLAN_MODULE_AddFeature_0001, Function | MediumTest | Level1)68 HWTEST_F(WiFiModuleTest, SUB_WLAN_MODULE_AddFeature_0001, Function | MediumTest | Level1)
69 {
70 struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_MODULE_ADD_FEATURE, -1};
71 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
72 }
73
74 /**
75 * @tc.name: WiFiModuleDeleteFeature001
76 * @tc.desc: wifi module delete feature function test
77 * @tc.type: FUNC
78 */
HWTEST_F(WiFiModuleTest, SUB_WLAN_MODULE_DeleteFeature_0001, Function | MediumTest | Level1)79 HWTEST_F(WiFiModuleTest, SUB_WLAN_MODULE_DeleteFeature_0001, Function | MediumTest | Level1)
80 {
81 struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_MODULE_DELETE_FEATURE, -1};
82 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
83 }
84
85 /**
86 * @tc.name: WiFiModuleDelete001
87 * @tc.desc: wifi delete module function test
88 * @tc.type: FUNC
89 */
HWTEST_F(WiFiModuleTest, SUB_WLAN_MODULE_Delete_0001, Function | MediumTest | Level1)90 HWTEST_F(WiFiModuleTest, SUB_WLAN_MODULE_Delete_0001, Function | MediumTest | Level1)
91 {
92 struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_MODULE_DELETE_MODULE, -1};
93 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
94 }
95 };
96