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