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 17 #include <gtest/gtest.h> 18 #include <thread> 19 #include "eu/cpu_monitor.h" 20 #include "eu/cpu_worker.h" 21 #include "eu/scpuworker_manager.h" 22 #ifdef FFRT_GITEE 23 #include "eu/cpu_manager_interface.h" 24 #else 25 #include "eu/cpu_manager_strategy.h" 26 #endif 27 #include "eu/worker_thread.h" 28 #include "qos.h" 29 #include "common.h" 30 31 namespace OHOS { 32 namespace FFRT_TEST { 33 using namespace testing; 34 #ifdef HWTEST_TESTING_EXT_ENABLE 35 using namespace testing::ext; 36 #endif 37 using namespace OHOS::FFRT_TEST; 38 using namespace ffrt; 39 using namespace std; 40 41 42 class CpuworkerManagerTest : public testing::Test { 43 protected: SetUpTestCase()44 static void SetUpTestCase() 45 { 46 } 47 TearDownTestCase()48 static void TearDownTestCase() 49 { 50 } 51 SetUp()52 virtual void SetUp() 53 { 54 } 55 TearDown()56 virtual void TearDown() 57 { 58 } 59 }; 60 61 /** 62 * @tc.name: NotifyTaskAdded 63 * @tc.desc: Test whether the NotifyTaskAdded interface are normal. 64 * @tc.type: FUNC 65 */ HWTEST_F(CpuworkerManagerTest, NotifyTaskAdded, TestSize.Level1)66HWTEST_F(CpuworkerManagerTest, NotifyTaskAdded, TestSize.Level1) 67 { 68 auto *it = new SCPUWorkerManager(); 69 it->NotifyTaskAdded(QoS(qos(5))); 70 } 71 } 72 } 73