1 /*
2 * Copyright (c) 2023 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 #include <gtest/gtest.h>
16 #include <thread>
17 #include "eu/execute_unit.h"
18 #include "eu/thread_group.h"
19 #include "internal_inc/types.h"
20 #include "util/ffrt_facade.h"
21 #include "common.h"
22
23 namespace OHOS {
24 namespace FFRT_TEST {
25 using namespace testing;
26 #ifdef HWTEST_TESTING_EXT_ENABLE
27 using namespace testing::ext;
28 #endif
29 using namespace OHOS::FFRT_TEST;
30 using namespace ffrt;
31 using namespace std;
32
33
34 class ExecuteUnitTest : public testing::Test {
35 protected:
SetUpTestCase()36 static void SetUpTestCase()
37 {
38 }
39
TearDownTestCase()40 static void TearDownTestCase()
41 {
42 }
43
SetUp()44 virtual void SetUp()
45 {
46 }
47
TearDown()48 virtual void TearDown()
49 {
50 }
51 };
52
53 /**
54 * @tc.name: NotifyTaskAdded
55 * @tc.desc: Test whether the NotifyTaskAdded interface are normal.
56 * @tc.type: FUNC
57 */
HWTEST_F(ExecuteUnitTest, NotifyTaskAdded, TestSize.Level1)58 HWTEST_F(ExecuteUnitTest, NotifyTaskAdded, TestSize.Level1)
59 {
60 FFRTFacade::GetEUInstance().NotifyTaskAdded(QoS(qos(5)));
61 }
62
63 /**
64 * @tc.name: BindWG
65 * @tc.desc: Test whether the BindWG interface are normal.
66 * @tc.type: FUNC
67 */
HWTEST_F(ExecuteUnitTest, BindWG, TestSize.Level1)68 HWTEST_F(ExecuteUnitTest, BindWG, TestSize.Level1)
69 {
70 QoS *qos1 = new QoS();
71 FFRTFacade::GetEUInstance().BindWG(DevType(0), *qos1);
72 }
73
74 /**
75 * @tc.name: UnbindTG
76 * @tc.desc: Test whether the UnbindTG interface are normal.
77 * @tc.type: FUNC
78 */
HWTEST_F(ExecuteUnitTest, UnbindTG, TestSize.Level1)79 HWTEST_F(ExecuteUnitTest, UnbindTG, TestSize.Level1)
80 {
81 QoS *qos1 = new QoS();
82 FFRTFacade::GetEUInstance().UnbindTG(DevType(0), *qos1);
83 }
84
85 /**
86 * @tc.name: BindTG
87 * @tc.desc: Test whether the BindTG interface are normal.
88 * @tc.type: FUNC
89 */
HWTEST_F(ExecuteUnitTest, BindTG, TestSize.Level1)90 HWTEST_F(ExecuteUnitTest, BindTG, TestSize.Level1)
91 {
92 QoS *qos1 = new QoS();
93 ThreadGroup* it = FFRTFacade::GetEUInstance().BindTG(DevType(0), *qos1);
94 }
95
96 }
97 }
98