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 "hdf_wifi_test.h"
17 #include <cstdint>
18 #include <cstdio>
19 #include <cstdlib>
20 #include <string>
21 #include <unistd.h>
22 #include <fcntl.h>
23 #include <gtest/gtest.h>
24 #include "hdf_uhdf_test.h"
25 #include "hdf_io_service_if.h"
26
27 using namespace testing::ext;
28
29 namespace FlowControlTest {
30 class WiFiFlowControlTest : public testing::Test {
31 public:
32 static void SetUpTestCase();
33 static void TearDownTestCase();
34 void SetUp();
35 void TearDown();
36 };
37
SetUpTestCase()38 void WiFiFlowControlTest::SetUpTestCase()
39 {
40 HdfTestOpenService();
41 struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_FLOW_CONTROL_INIT, -1};
42 HdfTestSendMsgToService(&msg);
43 }
44
TearDownTestCase()45 void WiFiFlowControlTest::TearDownTestCase()
46 {
47 struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_FLOW_CONTROL_DEINIT, -1};
48 HdfTestSendMsgToService(&msg);
49 HdfTestCloseService();
50 }
51
SetUp()52 void WiFiFlowControlTest::SetUp() {}
53
TearDown()54 void WiFiFlowControlTest::TearDown() {}
55
56 /**
57 * @tc.name: WiFiFlowControlGetQueueID001
58 * @tc.desc: Obtains the priority ID of a flow control queue
59 * @tc.type: FUNC
60 * @tc.require: AR000F869F
61 */
62 HWTEST_F(WiFiFlowControlTest, WiFiFlowControlGetQueueID001, TestSize.Level1)
63 {
64 struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_FLOW_CONTROL_GET_QUEUE_ID, -1};
65 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
66 }
67
68 /**
69 * @tc.name: WiFiFlowControlSendData001
70 * @tc.desc: Sends data of a flow control
71 * @tc.type: FUNC
72 * @tc.require: AR000F869F
73 */
74 HWTEST_F(WiFiFlowControlTest, WiFiFlowControlSendData001, TestSize.Level1)
75 {
76 struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_FLOW_CONTROL_SEND_DATA, -1};
77 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
78 }
79 };
80