From ef2beaef3cbd29291b251d6dd15242ce116e2b7a Mon Sep 17 00:00:00 2001 From: liuyuxiu Date: Tue, 14 Nov 2023 15:40:42 +0800 Subject: [PATCH 1/2] feature Signed-off-by: liuyuxiu --- test/BUILD.gn | 21 ++++++ .../phone/intellisense_server_test.cpp | 72 +++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 test/unittest/phone/intellisense_server_test.cpp diff --git a/test/BUILD.gn b/test/BUILD.gn index f082e42..3278e77 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -80,12 +80,33 @@ ohos_unittest("rtg_interface_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", ":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 0000000..ecb6c21 --- /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 -- Gitee From 461972a668cb41530450b8e0b1a5c6754c88db67 Mon Sep 17 00:00:00 2001 From: liuyuxiu Date: Tue, 14 Nov 2023 15:59:25 +0800 Subject: [PATCH 2/2] feature Signed-off-by: liuyuxiu --- test/unittest/phone/intellisense_server_test.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/test/unittest/phone/intellisense_server_test.cpp b/test/unittest/phone/intellisense_server_test.cpp index ecb6c21..945311c 100644 --- a/test/unittest/phone/intellisense_server_test.cpp +++ b/test/unittest/phone/intellisense_server_test.cpp @@ -67,6 +67,5 @@ HWTEST_F(IntelliSenseServerTest, ReportContinuousTaskTest, TestSize.Level1) status = 2; IntelliSenseServer::GetInstance().ReportContinuousTask(pid, uid, status); } - } // namespace RME } // namespace OHOS \ No newline at end of file -- Gitee