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 <gtest/gtest.h>
17
18 #include "client_qos_manager.h"
19 #include "client_trans_session_service.h"
20 #include "session.h"
21 #include "softbus_errcode.h"
22
23 using namespace testing::ext;
24
25 namespace OHOS {
26 const int32_t G_VALID_SESSION_ID = 1;
27 const int32_t G_INVALID_SESSION_ID = 1;
28 const int32_t G_VALID_APP_TYPE = 1;
29 const int32_t G_VALID_QUALITY = 1;
30
31 class TransQosTest : public testing::Test {
32 public:
TransQosTest()33 TransQosTest()
34 {}
~TransQosTest()35 ~TransQosTest()
36 {}
37 static void SetUpTestCase(void);
38 static void TearDownTestCase(void);
SetUp()39 void SetUp() override
40 {}
TearDown()41 void TearDown() override
42 {}
43 };
44
SetUpTestCase(void)45 void TransQosTest::SetUpTestCase(void)
46 {}
47
TearDownTestCase(void)48 void TransQosTest::TearDownTestCase(void)
49 {}
50
51 /**
52 * @tc.name: TransQosTest001
53 * @tc.desc: test the wrong parameter.
54 * @tc.type: FUNC
55 * @tc.require:
56 */
57 HWTEST_F(TransQosTest, QosReportTest001, TestSize.Level0)
58 {
59 int ret;
60 ret = QosReport(G_INVALID_SESSION_ID, G_VALID_APP_TYPE, QOS_IMPROVE);
61 EXPECT_NE(ret, SOFTBUS_OK);
62
63 ret = QosReport(G_VALID_SESSION_ID, G_VALID_APP_TYPE, QOS_RECOVER);
64 EXPECT_NE(ret, SOFTBUS_OK);
65
66 ret = QosReport(G_VALID_SESSION_ID, G_VALID_APP_TYPE, QOS_IMPROVE);
67 EXPECT_NE(ret, SOFTBUS_OK);
68
69 ret = ClientQosReport(G_VALID_SESSION_ID, G_VALID_APP_TYPE, QOS_IMPROVE, G_VALID_QUALITY);
70 EXPECT_NE(ret, SOFTBUS_NOT_IMPLEMENT);
71 }
72 } // namespace OHOS