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
27using namespace testing::ext;
28
29namespace FlowControlTest {
30class WiFiFlowControlTest : public testing::Test {
31public:
32    static void SetUpTestCase();
33    static void TearDownTestCase();
34    void SetUp();
35    void TearDown();
36};
37
38void WiFiFlowControlTest::SetUpTestCase()
39{
40    HdfTestOpenService();
41    struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_FLOW_CONTROL_INIT, -1};
42    HdfTestSendMsgToService(&msg);
43}
44
45void WiFiFlowControlTest::TearDownTestCase()
46{
47    struct HdfTestMsg msg = {TEST_WIFI_TYPE, WIFI_FLOW_CONTROL_DEINIT, -1};
48    HdfTestSendMsgToService(&msg);
49    HdfTestCloseService();
50}
51
52void WiFiFlowControlTest::SetUp() {}
53
54void 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 */
62HWTEST_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 */
74HWTEST_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