From c8a7e7e43a72ce6e9993daa055b32d863f1ac444 Mon Sep 17 00:00:00 2001 From: fengyang Date: Tue, 24 Jun 2025 19:55:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=E6=96=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fengyang --- test/unittest/device_usage_statistics_multi_test.cpp | 3 ++- test/unittest/device_usage_statistics_test.cpp | 2 -- test/unittest/package_usage_test.cpp | 9 ++++----- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/test/unittest/device_usage_statistics_multi_test.cpp b/test/unittest/device_usage_statistics_multi_test.cpp index a954c8b..4bcd785 100644 --- a/test/unittest/device_usage_statistics_multi_test.cpp +++ b/test/unittest/device_usage_statistics_multi_test.cpp @@ -155,7 +155,8 @@ void MultiTestReportEvent(void) BundleActiveClient::GetInstance().ReportEvent(eventA, g_defaultUserId); BundleActiveEvent eventB(g_defaultBundleName, g_defaultMoudleName, g_defaultFormName, g_defaultDimension, g_defaultFormId, BundleActiveEvent::FORM_IS_REMOVED); - BundleActiveClient::GetInstance().ReportEvent(eventB, g_defaultUserId); + int32_t errorCode = BundleActiveClient::GetInstance().ReportEvent(eventB, g_defaultUserId); + EXPECT_EQ(errorCode, 0); } HWTEST_F(DeviceUsageStatisticsMultiTest, DeviceUsageStatisticsMultiTest_ReportEvent_001, Function | MediumTest | Level0) diff --git a/test/unittest/device_usage_statistics_test.cpp b/test/unittest/device_usage_statistics_test.cpp index 62e03d4..4f26307 100644 --- a/test/unittest/device_usage_statistics_test.cpp +++ b/test/unittest/device_usage_statistics_test.cpp @@ -218,7 +218,6 @@ HWTEST_F(DeviceUsageStatisticsTest, DeviceUsageStatisticsTest_IsBundleIdle_001, { bool result = false; int32_t errCode = BundleActiveClient::GetInstance().IsBundleIdle(result, g_defaultBundleName, g_defaultUserId); - EXPECT_EQ(result, false); EXPECT_EQ(errCode, 0); } @@ -232,7 +231,6 @@ HWTEST_F(DeviceUsageStatisticsTest, DeviceUsageStatisticsTest_IsBundleUsePeriod_ { bool result = false; int32_t errCode = BundleActiveClient::GetInstance().IsBundleUsePeriod(result, g_defaultBundleName, g_defaultUserId); - EXPECT_EQ(result, false); EXPECT_EQ(errCode, 0); } diff --git a/test/unittest/package_usage_test.cpp b/test/unittest/package_usage_test.cpp index 803677a..eaafa15 100644 --- a/test/unittest/package_usage_test.cpp +++ b/test/unittest/package_usage_test.cpp @@ -1170,13 +1170,12 @@ HWTEST_F(PackageUsageTest, BundleActivePackageStats_005, Function | MediumTest | { auto packageStats = std::make_shared(); std::string taskName = "test"; - int64_t timeStamp = 0; - std::string abilityId = "1"; + int64_t timeStamp = 100; int32_t eventId = BundleActiveEvent::LONG_TIME_TASK_ENDED; packageStats->totalContiniousTaskUsedTime_ = 0; - packageStats->longTimeTasks_[taskName] = BundleActiveEvent::LONG_TIME_TASK_ENDED; - packageStats->UpdateAbility(timeStamp, eventId, abilityId); - EXPECT_EQ(packageStats->totalContiniousTaskUsedTime_, 0); + packageStats->longTimeTasks_[taskName] = BundleActiveEvent::LONG_TIME_TASK_STARTTED; + packageStats->UpdateLongTimeTask(taskName, timeStamp, eventId); + EXPECT_NE(packageStats->totalContiniousTaskUsedTime_, 0); } /* -- Gitee