• 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 <fcntl.h>
20 #include <gtest/gtest.h>
21 #include <string>
22 #include <unistd.h>
23 #include "hdf_uhdf_test.h"
24 #include "hdf_wifi_test.h"
25 
26 using namespace testing::ext;
27 
28 namespace MessageTest {
29 class WiFiMessageTest : public testing::Test {
30 public:
WiFiMessageTest()31     WiFiMessageTest() {}
~WiFiMessageTest()32     virtual ~WiFiMessageTest() {}
33     static void SetUpTestCase();
34     static void TearDownTestCase();
35     void SetUp();
36     void TearDown();
37 };
38 
SetUpTestCase()39 void WiFiMessageTest::SetUpTestCase()
40 {
41     HdfTestOpenService();
42 }
43 
TearDownTestCase()44 void WiFiMessageTest::TearDownTestCase()
45 {
46     HdfTestCloseService();
47 }
48 
SetUp()49 void WiFiMessageTest::SetUp() {}
50 
TearDown()51 void WiFiMessageTest::TearDown() {}
52 
53 /**
54  * @tc.name: WIFI_MESSAGE_QUEUE001
55  * @tc.desc: Message queue test case 001.
56  * @tc.type: FUNC
57  */
58 HWTEST_F(WiFiMessageTest, SUB_WLAN_MESSAGE_QUEUE_0001, Function | MediumTest | Level1)
59 {
60     struct HdfTestMsg msg = { TEST_WIFI_TYPE, WIFI_MESSAGE_QUEUE_001, -1 };
61     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
62 }
63 
64 /**
65  * @tc.name: WIFI_MESSAGE_QUEUE002
66  * @tc.desc: Message queue test case 002
67  * @tc.type: FUNC
68  */
69 HWTEST_F(WiFiMessageTest, SUB_WLAN_MESSAGE_QUEUE_0002, Function | MediumTest | Level1)
70 {
71     struct HdfTestMsg msg = { TEST_WIFI_TYPE, WIFI_MESSAGE_QUEUE_002, -1 };
72     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
73 }
74 
75 /**
76  * @tc.name: WIFI_MESSAGE_QUEUE003
77  * @tc.desc: Message queue test case 003
78  * @tc.type: FUNC
79  */
80 HWTEST_F(WiFiMessageTest, SUB_WLAN_MESSAGE_QUEUE_0003, Function | MediumTest | Level1)
81 {
82     struct HdfTestMsg msg = { TEST_WIFI_TYPE, WIFI_MESSAGE_QUEUE_003, -1 };
83     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
84 }
85 
86 /**
87  * @tc.name: WIFI_MESSAGE_SINGLE_NODE001
88  * @tc.desc: Single node message route test 001
89  * @tc.type: FUNC
90  */
91 HWTEST_F(WiFiMessageTest, SUB_WLAN_MESSAGE_SINGLE_NODE_0001, Function | MediumTest | Level1)
92 {
93     struct HdfTestMsg msg = { TEST_WIFI_TYPE, WIFI_MESSAGE_SINGLE_NODE_001, -1 };
94     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
95 }
96 
97 /**
98  * @tc.name: WIFI_MESSAGE_SINGLE_NODE002
99  * @tc.desc: Single node message route test 002
100  * @tc.type: FUNC
101  */
102 HWTEST_F(WiFiMessageTest, SUB_WLAN_MESSAGE_SINGLE_NODE_0002, Function | MediumTest | Level1)
103 {
104     struct HdfTestMsg msg = { TEST_WIFI_TYPE, WIFI_MESSAGE_SINGLE_NODE_002, -1 };
105     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
106 }
107 
108 /**
109  * @tc.name: WIFI_MESSAGE_SINGLE_NODE003
110  * @tc.desc: Single node message route test 003
111  * @tc.type: FUNC
112  */
113 HWTEST_F(WiFiMessageTest, SUB_WLAN_MESSAGE_SINGLE_NODE_0003, Function | MediumTest | Level1)
114 {
115     struct HdfTestMsg msg = { TEST_WIFI_TYPE, WIFI_MESSAGE_SINGLE_NODE_003, -1 };
116     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
117 }
118 
119 /**
120  * @tc.name: WIFI_MESSAGE_SINGLE_NODE004
121  * @tc.desc: Single node message route test 004
122  * @tc.type: FUNC
123  */
124 HWTEST_F(WiFiMessageTest, SUB_WLAN_MESSAGE_SINGLE_NODE_0004, Function | MediumTest | Level1)
125 {
126     struct HdfTestMsg msg = { TEST_WIFI_TYPE, WIFI_MESSAGE_SINGLE_NODE_004, -1 };
127     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
128 }
129 
130 /**
131  * @tc.name: WIFI_MESSAGE_SINGLE_NODE005
132  * @tc.desc: Single node message route test 005
133  * @tc.type: FUNC
134  */
135 HWTEST_F(WiFiMessageTest, SUB_WLAN_MESSAGE_SINGLE_NODE_0005, Function | MediumTest | Level1)
136 {
137     struct HdfTestMsg msg = { TEST_WIFI_TYPE, WIFI_MESSAGE_SINGLE_NODE_005, -1 };
138     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
139 }
140 };
141