diff --git a/test/BUILD.gn b/test/BUILD.gn index 2de4d12d4a1d69e9996ddcdaa1b7dcdda5df118c..03817e1e44929de9612400caecb5ca8ead65db90 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -95,12 +95,33 @@ ohos_unittest("qos_manager_test") { subsystem_name = "resourceschedule" } +ohos_unittest("intellisense_server_test") { + module_out_path = module_output_path + + sources = [ "unittest/phone/intellisense_server_test.cpp" ] + + include_dirs = [ + "../common/include", + "../frameworks/core/frame_aware_policy/include", + ] + + deps = frame_aware_sched_deps + + if (is_standard_system) { + public_deps = frame_aware_sched_public_deps + } + + part_name = "frame_aware_sched" + subsystem_name = "resourceschedule" +} + group("frame_unittest") { testonly = true deps = [] if (!is_asan) { deps += [ ":frame_msg_intf_test", + ":intellisense_server_test", ":qos_manager_test", ":rtg_interface_test", ] diff --git a/test/unittest/phone/intellisense_server_test.cpp b/test/unittest/phone/intellisense_server_test.cpp new file mode 100644 index 0000000000000000000000000000000000000000..ecb6c2186a6aa02decfd21245f10cf91fe748e8e --- /dev/null +++ b/test/unittest/phone/intellisense_server_test.cpp @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "gtest/gtest.h" + +#define private public +#include "intellisense_server.h" +#undef private + +namespace OHOS { +namespace RME { +using namespace testing; +using namespace testing::ext; + +class IntelliSenseServerTest : public testing::Test { +public: + static void SetUpTestCase(); + static void TearDownTestCase(); + void SetUp(); + void TearDown(); +}; + +void IntelliSenseServerTest::SetUpTestCase() +{ +} + +void IntelliSenseServerTest::TearDownTestCase() +{ +} + +void IntelliSenseServerTest::SetUp() +{ +} + +void IntelliSenseServerTest::TearDown() +{ +} + +/** + * @tc.name: ReportContinuousTaskTest + * @tc.desc: Verify the ReportContinuousTask function. + * @tc.type: FUNC + */ +HWTEST_F(IntelliSenseServerTest, ReportContinuousTaskTest, TestSize.Level1) +{ + int pid = 777; + int uid = 888; + int status = 0; + IntelliSenseServer::GetInstance().m_switch = false; + IntelliSenseServer::GetInstance().ReportContinuousTask(pid, uid, status); + IntelliSenseServer::GetInstance().m_switch = true; + IntelliSenseServer::GetInstance().ReportContinuousTask(pid, uid, status); + status = 1; + IntelliSenseServer::GetInstance().ReportContinuousTask(pid, uid, status); + status = 2; + IntelliSenseServer::GetInstance().ReportContinuousTask(pid, uid, status); +} + +} // namespace RME +} // namespace OHOS \ No newline at end of file