From 1da04c0c9eb75f481f96ad22a530f569c140d664 Mon Sep 17 00:00:00 2001 From: HengBai Date: Mon, 14 Oct 2024 08:40:46 +0000 Subject: [PATCH 1/8] test Signed-off-by: HengBai --- ressched/test/unittest/src/res_sched_service_test.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ressched/test/unittest/src/res_sched_service_test.cpp b/ressched/test/unittest/src/res_sched_service_test.cpp index 80833601..d059301e 100644 --- a/ressched/test/unittest/src/res_sched_service_test.cpp +++ b/ressched/test/unittest/src/res_sched_service_test.cpp @@ -55,6 +55,7 @@ public: void OnSystemloadLevel(int32_t level) { + RESSCHED_LOGE("BHTAG OnSystemloadLevel %{public}d", level); testSystemloadLevel = level; } @@ -245,6 +246,7 @@ HWTEST_F(ResSchedServiceTest, TestResSchedSystemloadListener001, Function | Medi NotifierMgr::GetInstance().OnApplicationStateChange(2, IPCSkeleton::GetCallingPid()); resSchedService_->OnDeviceLevelChanged(0, 2); sleep(1); + std::cout << TestResSchedSystemloadListener::testSystemloadLevel; EXPECT_TRUE(TestResSchedSystemloadListener::testSystemloadLevel == 2); resSchedService_->UnRegisterSystemloadNotifier(); NotifierMgr::GetInstance().OnApplicationStateChange(4, IPCSkeleton::GetCallingPid()); -- Gitee From d5da93434ec0a7b74b92cd5209c738fd4fc9fc19 Mon Sep 17 00:00:00 2001 From: HengBai Date: Mon, 14 Oct 2024 09:05:39 +0000 Subject: [PATCH 2/8] update ressched/test/unittest/src/res_sched_service_test.cpp. Signed-off-by: HengBai --- ressched/test/unittest/src/res_sched_service_test.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ressched/test/unittest/src/res_sched_service_test.cpp b/ressched/test/unittest/src/res_sched_service_test.cpp index d059301e..67f3dcfb 100644 --- a/ressched/test/unittest/src/res_sched_service_test.cpp +++ b/ressched/test/unittest/src/res_sched_service_test.cpp @@ -15,6 +15,7 @@ #include "gtest/gtest.h" #include "gtest/hwext/gtest-multithread.h" +#include "ressched_log.h" #include #include "accesstoken_kit.h" -- Gitee From ca45808c60e76578539acfa989acf241c1063e32 Mon Sep 17 00:00:00 2001 From: HengBai Date: Mon, 14 Oct 2024 09:06:41 +0000 Subject: [PATCH 3/8] update ressched/test/unittest/src/res_sched_service_test.cpp. Signed-off-by: HengBai --- ressched/test/unittest/src/res_sched_service_test.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ressched/test/unittest/src/res_sched_service_test.cpp b/ressched/test/unittest/src/res_sched_service_test.cpp index 67f3dcfb..584f7686 100644 --- a/ressched/test/unittest/src/res_sched_service_test.cpp +++ b/ressched/test/unittest/src/res_sched_service_test.cpp @@ -248,6 +248,7 @@ HWTEST_F(ResSchedServiceTest, TestResSchedSystemloadListener001, Function | Medi resSchedService_->OnDeviceLevelChanged(0, 2); sleep(1); std::cout << TestResSchedSystemloadListener::testSystemloadLevel; + RESSCHED_LOGE("BHTAG TestResSchedSystemloadListener001 %{public}d", TestResSchedSystemloadListener::testSystemloadLevel); EXPECT_TRUE(TestResSchedSystemloadListener::testSystemloadLevel == 2); resSchedService_->UnRegisterSystemloadNotifier(); NotifierMgr::GetInstance().OnApplicationStateChange(4, IPCSkeleton::GetCallingPid()); -- Gitee From 40b6707a233b6b23c807f64cc5d659b5281e82ba Mon Sep 17 00:00:00 2001 From: HengBai Date: Mon, 14 Oct 2024 09:28:44 +0000 Subject: [PATCH 4/8] update ressched/test/unittest/src/res_sched_service_test.cpp. Signed-off-by: HengBai --- ressched/test/unittest/src/res_sched_service_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ressched/test/unittest/src/res_sched_service_test.cpp b/ressched/test/unittest/src/res_sched_service_test.cpp index 584f7686..e7e340ea 100644 --- a/ressched/test/unittest/src/res_sched_service_test.cpp +++ b/ressched/test/unittest/src/res_sched_service_test.cpp @@ -15,7 +15,7 @@ #include "gtest/gtest.h" #include "gtest/hwext/gtest-multithread.h" -#include "ressched_log.h" +#include "res_sched_log.h" #include #include "accesstoken_kit.h" -- Gitee From 46709328761d42e59e6e838e5c6b8e513154c733 Mon Sep 17 00:00:00 2001 From: HengBai Date: Mon, 14 Oct 2024 11:15:10 +0000 Subject: [PATCH 5/8] add Signed-off-by: HengBai --- .../ressched_client/src/res_sched_systemload_notifier_stub.cpp | 1 + ressched/test/unittest/BUILD.gn | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/ressched/interfaces/innerkits/ressched_client/src/res_sched_systemload_notifier_stub.cpp b/ressched/interfaces/innerkits/ressched_client/src/res_sched_systemload_notifier_stub.cpp index a87c651c..f652cafd 100644 --- a/ressched/interfaces/innerkits/ressched_client/src/res_sched_systemload_notifier_stub.cpp +++ b/ressched/interfaces/innerkits/ressched_client/src/res_sched_systemload_notifier_stub.cpp @@ -57,6 +57,7 @@ int32_t ResSchedSystemloadNotifierStub::OnSystemloadLevelInner(MessageParcel& da RESSCHED_LOGE("wrong level type."); return ERR_INVALID_VALUE; } + RESSCHED_LOGE("BHTAG OnSystemloadLevel %{public}d", level); OnSystemloadLevel(level); return ERR_OK; } diff --git a/ressched/test/unittest/BUILD.gn b/ressched/test/unittest/BUILD.gn index 229d22cf..43287114 100644 --- a/ressched/test/unittest/BUILD.gn +++ b/ressched/test/unittest/BUILD.gn @@ -43,7 +43,6 @@ ohos_unittest("resschedservice_test") { sources = [ "${ressched_common}/src/oobe_datashare_utils.cpp", "${ressched_common}/src/oobe_manager.cpp", - "src/event_listener_mgr_test.cpp", "src/oobe_datashare_utils_test.cpp", "src/oobe_mgr_test.cpp", "src/res_sched_client_test.cpp", -- Gitee From 9b8cae0cf34d059fbd36a7d595f6fe05ee86b50e Mon Sep 17 00:00:00 2001 From: HengBai Date: Mon, 14 Oct 2024 11:16:09 +0000 Subject: [PATCH 6/8] update ressched/test/unittest/BUILD.gn. Signed-off-by: HengBai --- ressched/test/unittest/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/ressched/test/unittest/BUILD.gn b/ressched/test/unittest/BUILD.gn index 43287114..229d22cf 100644 --- a/ressched/test/unittest/BUILD.gn +++ b/ressched/test/unittest/BUILD.gn @@ -43,6 +43,7 @@ ohos_unittest("resschedservice_test") { sources = [ "${ressched_common}/src/oobe_datashare_utils.cpp", "${ressched_common}/src/oobe_manager.cpp", + "src/event_listener_mgr_test.cpp", "src/oobe_datashare_utils_test.cpp", "src/oobe_mgr_test.cpp", "src/res_sched_client_test.cpp", -- Gitee From 8f3665e19ab32f5839d29dccb8d8308065832582 Mon Sep 17 00:00:00 2001 From: HengBai Date: Mon, 14 Oct 2024 12:37:09 +0000 Subject: [PATCH 7/8] update ressched/test/unittest/src/res_sched_service_test.cpp. Signed-off-by: HengBai --- .../unittest/src/res_sched_service_test.cpp | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ressched/test/unittest/src/res_sched_service_test.cpp b/ressched/test/unittest/src/res_sched_service_test.cpp index e7e340ea..a13df532 100644 --- a/ressched/test/unittest/src/res_sched_service_test.cpp +++ b/ressched/test/unittest/src/res_sched_service_test.cpp @@ -54,6 +54,26 @@ class TestResSchedSystemloadListener : public ResSchedSystemloadNotifierStub { public: TestResSchedSystemloadListener() = default; + int32_t OnSystemloadLevelInner(MessageParcel& data, MessageParcel& reply) + { + std::u16string descriptor = IResSchedSystemloadNotifier::GetDescriptor(); + std::u16string remoteDescriptor = data.ReadInterfaceToken(); + if (descriptor != remoteDescriptor) { + RESSCHED_LOGE("descriptor check failed"); + return ERR_INVALID_VALUE; + } + int32_t level = static_cast(ResType::SystemloadLevel::LOW); + READ_PARCEL(data, Int32, level, ERR_RES_SCHED_PARCEL_ERROR, ResSchedSystemloadNotifierStub); + if ((level > static_cast(ResType::SystemloadLevel::ESCAPE)) + || (level < static_cast(ResType::SystemloadLevel::LOW))) { + RESSCHED_LOGE("wrong level type."); + return ERR_INVALID_VALUE; + } + RESSCHED_LOGE("BHTAG22222 OnSystemloadLevel %{public}d", level); + OnSystemloadLevel(level); + return ERR_OK; + } + void OnSystemloadLevel(int32_t level) { RESSCHED_LOGE("BHTAG OnSystemloadLevel %{public}d", level); -- Gitee From 20cf9e526b89c238d624767642dd668a5db2f47b Mon Sep 17 00:00:00 2001 From: HengBai Date: Mon, 14 Oct 2024 13:59:55 +0000 Subject: [PATCH 8/8] update ressched/test/unittest/src/res_sched_service_test.cpp. Signed-off-by: HengBai --- ressched/test/unittest/src/res_sched_service_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ressched/test/unittest/src/res_sched_service_test.cpp b/ressched/test/unittest/src/res_sched_service_test.cpp index a13df532..d065a5c4 100644 --- a/ressched/test/unittest/src/res_sched_service_test.cpp +++ b/ressched/test/unittest/src/res_sched_service_test.cpp @@ -63,7 +63,7 @@ public: return ERR_INVALID_VALUE; } int32_t level = static_cast(ResType::SystemloadLevel::LOW); - READ_PARCEL(data, Int32, level, ERR_RES_SCHED_PARCEL_ERROR, ResSchedSystemloadNotifierStub); + READ_PARCEL(data, Int32, level, ERR_RES_SCHED_PARCEL_ERROR, TestResSchedSystemloadListener); if ((level > static_cast(ResType::SystemloadLevel::ESCAPE)) || (level < static_cast(ResType::SystemloadLevel::LOW))) { RESSCHED_LOGE("wrong level type."); -- Gitee