• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 #include <fcntl.h>
18 #include "eu/qos_interface.h"
19 #include "cpp/qos_convert.h"
20 #include "eu/osattr_manager.h"
21 #include "sync/delayed_worker.h"
22 #include "util/ffrt_facade.h"
23 #include "../common.h"
24 
25 using namespace testing;
26 #ifdef HWTEST_TESTING_EXT_ENABLE
27 using namespace testing::ext;
28 #endif
29 using namespace ffrt;
30 
31 
32 class QosConvertTestCase : public testing::Test {
33 protected:
SetUpTestCase()34     static void SetUpTestCase()
35     {
36     }
37 
TearDownTestCase()38     static void TearDownTestCase()
39     {
40     }
41 
SetUp()42     void SetUp() override
43     {
44     }
45 
TearDown()46     void TearDown() override
47     {
48     }
49 };
50 
51 HWTEST_F(QosConvertTestCase, GetDynamicQosTest, TestSize.Level1)
52 {
53     qos tmpQos = qos_default;
54     int ret = GetDynamicQos(tmpQos);
55     EXPECT_EQ(ret, -1);
56 }
57 
58 HWTEST_F(QosConvertTestCase, GetStaticQosTest, TestSize.Level1)
59 {
60     qos tmpQos = qos_default;
61     int ret = GetStaticQos(tmpQos);
62     EXPECT_EQ(ret, -1);
63 }
64 
65 HWTEST_F(QosConvertTestCase, IsDelayerWorkerThreadTest, TestSize.Level0)
66 {
67     DelayedWorker::ThreadEnvCreate();
68     sleep(1);
69     bool ret = DelayedWorker::IsDelayerWorkerThread();
70     EXPECT_EQ(ret, false);
71 }
72