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 void SetUp() override 45 { 46 } 47 TearDown()48 void TearDown() override 49 { 50 } 51 }; 52 53 /** 54 * @tc.name: BindWG 55 * @tc.desc: Test whether the BindWG interface are normal. 56 * @tc.type: FUNC 57 */ 58 HWTEST_F(ExecuteUnitTest, BindWG, TestSize.Level1) 59 { 60 QoS *qos1 = new QoS(); 61 FFRTFacade::GetEUInstance().BindWG(DevType(0), *qos1); 62 EXPECT_EQ(*qos1, qos_default); 63 } 64 65 /** 66 * @tc.name: UnbindTG 67 * @tc.desc: Test whether the UnbindTG interface are normal. 68 * @tc.type: FUNC 69 */ 70 HWTEST_F(ExecuteUnitTest, UnbindTG, TestSize.Level1) 71 { 72 QoS *qos1 = new QoS(); 73 FFRTFacade::GetEUInstance().UnbindTG(DevType(0), *qos1); 74 EXPECT_EQ(*qos1, qos_default); 75 } 76 77 /** 78 * @tc.name: BindTG 79 * @tc.desc: Test whether the BindTG interface are normal. 80 * @tc.type: FUNC 81 */ 82 HWTEST_F(ExecuteUnitTest, BindTG, TestSize.Level1) 83 { 84 QoS *qos1 = new QoS(); 85 ThreadGroup* it = FFRTFacade::GetEUInstance().BindTG(DevType(0), *qos1); 86 EXPECT_EQ(*qos1, qos_default); 87 } 88 89 } 90 } 91