From ead082e8bd3aae131117b9873e604fb796eca9d3 Mon Sep 17 00:00:00 2001 From: xushengbin Date: Wed, 16 Apr 2025 07:07:27 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0tdd=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xushengbin --- .../phone/concurrent_svc_intf_test.cpp | 24 ++++++++++- ...current_task_controller_interface_test.cpp | 18 +++++++++ test/unittest/phone/qos_interface_test.cpp | 32 +++++++++++++++ test/unittest/phone/qos_ndk_test.cpp | 18 +++++++++ test/unittest/phone/qos_test.cpp | 40 +++++++++++++++++-- 5 files changed, 128 insertions(+), 4 deletions(-) diff --git a/test/unittest/phone/concurrent_svc_intf_test.cpp b/test/unittest/phone/concurrent_svc_intf_test.cpp index 8c8042a..63098e5 100644 --- a/test/unittest/phone/concurrent_svc_intf_test.cpp +++ b/test/unittest/phone/concurrent_svc_intf_test.cpp @@ -71,7 +71,29 @@ void ConcurrentSvcIntfTest::TearDown() */ HWTEST_F(ConcurrentSvcIntfTest, QueryBeforeGetPriv, TestSize.Level1) { - int grpId = QueryInterval(QUERY_RENDER); + int grpId = QueryInterval(QUERY_UI); + EXPECT_EQ(grpId, -1); + grpId = QueryInterval(QUERY_RENDER); + EXPECT_EQ(grpId, -1); + grpId = QueryInterval(QUERY_RENDER_SERVICE); + EXPECT_EQ(grpId, -1); + grpId = QueryInterval(QUERY_COMPOSER); + EXPECT_EQ(grpId, -1); + grpId = QueryInterval(QUERY_HARDWARE); + EXPECT_EQ(grpId, -1); + grpId = QueryInterval(QUERY_EXECUTOR_START); + EXPECT_EQ(grpId, -1); + grpId = QueryInterval(QUERY_RENDER_SERVICE_RENDER); + EXPECT_EQ(grpId, -1); + grpId = QueryInterval(QUERY_SELF_RENDER_REMOVE_THREAD); + EXPECT_EQ(grpId, -1); + grpId = QueryInterval(QUERY_SELF_RENDER_ADD_THREAD); + EXPECT_EQ(grpId, -1); + grpId = QueryInterval(QUERY_MODIFIER_DRAW); + EXPECT_EQ(grpId, -1); + grpId = QueryInterval(QUERY_SELF_RENDER_FRAME_START); + EXPECT_EQ(grpId, -1); + grpId = QueryInterval(QUERY_SELF_RENDER_FRAME_END); EXPECT_EQ(grpId, -1); } diff --git a/test/unittest/phone/concurrent_task_controller_interface_test.cpp b/test/unittest/phone/concurrent_task_controller_interface_test.cpp index c0d723b..ddce904 100644 --- a/test/unittest/phone/concurrent_task_controller_interface_test.cpp +++ b/test/unittest/phone/concurrent_task_controller_interface_test.cpp @@ -122,6 +122,24 @@ HWTEST_F(ConcurrentTaskControllerInterfaceTest, QueryIntervalTest, TestSize.Leve queInt.QueryInterval(queryItem, queryRs); queryItem = QUERY_COMPOSER; queInt.QueryInterval(queryItem, queryRs); + queryItem = QUERY_HARDWARE; + queInt.QueryInterval(queryItem, queryRs); + queryItem = QUERY_EXECUTOR_START; + queInt.QueryInterval(queryItem, queryRs); + queryItem = QUERY_RENDER_SERVICE_MAIN; + queInt.QueryInterval(queryItem, queryRs); + queryItem = QUERY_RENDER_SERVICE_RENDER; + queInt.QueryInterval(queryItem, queryRs); + queryItem = QUERY_SELF_RENDER_REMOVE_THREAD; + queInt.QueryInterval(queryItem, queryRs); + queryItem = QUERY_SELF_RENDER_ADD_THREAD; + queInt.QueryInterval(queryItem, queryRs); + queryItem = QUERY_MODIFIER_DRAW; + queInt.QueryInterval(queryItem, queryRs); + queryItem = QUERY_SELF_RENDER_FRAME_START; + queInt.QueryInterval(queryItem, queryRs); + queryItem = QUERY_SELF_RENDER_FRAME_END; + queInt.QueryInterval(queryItem, queryRs); queryItem = QURRY_TYPE_MAX; queInt.QueryInterval(queryItem, queryRs); EXPECT_FALSE(queInt.inited_); diff --git a/test/unittest/phone/qos_interface_test.cpp b/test/unittest/phone/qos_interface_test.cpp index 9245e82..f8a073a 100644 --- a/test/unittest/phone/qos_interface_test.cpp +++ b/test/unittest/phone/qos_interface_test.cpp @@ -154,6 +154,10 @@ HWTEST_F(QosInterfaceTest, QosApplyFuncTestExt, TestSize.Level1) level = 1024; val = QosApply(level); EXPECT_EQ(val, -1); + + level = -1; + val = QosApply(level); + EXPECT_EQ(val, -1); } /** @@ -245,6 +249,10 @@ HWTEST_F(QosInterfaceTest, QosApplyForOtherFuncTestExt, TestSize.Level1) level = 1024; val = QosApplyForOther(level, tid); EXPECT_EQ(val, -1); + + level = -1; + val = QosApplyForOther(level, tid); + EXPECT_EQ(val, -1); } /** @@ -338,6 +346,16 @@ HWTEST_F(QosInterfaceTest, QosLeaveFuncTestExt, TestSize.Level1) EXPECT_EQ(val, -1); val = QosLeave(); EXPECT_EQ(val, -1); + + val = QosApply(1024); + EXPECT_EQ(val, -1); + val = QosLeave(); + EXPECT_EQ(val, -1); + + val = QosApply(-1); + EXPECT_EQ(val, -1); + val = QosLeave(); + EXPECT_EQ(val, -1); } /** @@ -442,6 +460,20 @@ HWTEST_F(QosInterfaceTest, QosLeaveForOtherFuncTest, TestSize.Level1) EXPECT_EQ(val, -1); val = QosLeaveForOther(tid); EXPECT_EQ(val, -1); + + level = 1024; + tid = gettid(); + val = QosApplyForOther(level, tid); + EXPECT_EQ(val, -1); + val = QosLeaveForOther(tid); + EXPECT_EQ(val, -1); + + level = -1; + tid = gettid(); + val = QosApplyForOther(level, tid); + EXPECT_EQ(val, -1); + val = QosLeaveForOther(tid); + EXPECT_EQ(val, -1); } /** diff --git a/test/unittest/phone/qos_ndk_test.cpp b/test/unittest/phone/qos_ndk_test.cpp index badd257..39d1151 100644 --- a/test/unittest/phone/qos_ndk_test.cpp +++ b/test/unittest/phone/qos_ndk_test.cpp @@ -152,6 +152,24 @@ HWTEST_F(QoSNdkTest, ResetThreadQoSNdkTest5, TestSize.Level0) EXPECT_EQ(val, 0); } +HWTEST_F(QoSNdkTest, ResetThreadQoSNdkTestExt, TestSize.Level0) +{ + int val = OH_QoS_SetThreadQoS((QoS_Level)-1); + EXPECT_EQ(val, -1); + val = OH_QoS_ResetThreadQoS(); + EXPECT_EQ(val, -1); + + val = OH_QoS_SetThreadQoS((QoS_Level)6); + EXPECT_EQ(val, -1); + val = OH_QoS_ResetThreadQoS(); + EXPECT_EQ(val, -1); + + val = OH_QoS_SetThreadQoS((QoS_Level)1024); + EXPECT_EQ(val, -1); + val = OH_QoS_ResetThreadQoS(); + EXPECT_EQ(val, -1); +} + /** * @tc.name: GetThreadQoSNdkTest * @tc.desc: Verify the Get QoSLevel function. diff --git a/test/unittest/phone/qos_test.cpp b/test/unittest/phone/qos_test.cpp index 3d57c10..6e61a9b 100644 --- a/test/unittest/phone/qos_test.cpp +++ b/test/unittest/phone/qos_test.cpp @@ -249,6 +249,16 @@ HWTEST_F(QosTest, ResetThreadQosTestExt, TestSize.Level1) EXPECT_EQ(val, 0); val = ResetThreadQos(); EXPECT_EQ(val, 0); + + val = SetThreadQos(QosLevel(-1)); + EXPECT_EQ(val, -1); + val = ResetThreadQos(); + EXPECT_EQ(val, -1); + + val = SetThreadQos(QosLevel(1024)); + EXPECT_EQ(val, -1); + val = ResetThreadQos(); + EXPECT_EQ(val, -1); } /** @@ -326,6 +336,16 @@ HWTEST_F(QosTest, ResetQosForOtherThreadTestExt, TestSize.Level0) EXPECT_EQ(val, 0); val = ResetQosForOtherThread(gettid()); EXPECT_EQ(val, 0); + + val = SetQosForOtherThread(QosLevel(-1), gettid()); + EXPECT_EQ(val, -1); + val = ResetQosForOtherThread(gettid()); + EXPECT_EQ(val, -1); + + val = SetQosForOtherThread(QosLevel(1024), gettid()); + EXPECT_EQ(val, -1); + val = ResetQosForOtherThread(gettid()); + EXPECT_EQ(val, -1); } /** @@ -407,10 +427,24 @@ HWTEST_F(QosTest, GetThreadQosTestExt, TestSize.Level1) { int val = SetThreadQos(QosLevel::QOS_MAX); EXPECT_NE(val, 0); - enum QosLevel level; - val = GetThreadQos(level); + enum QosLevel level2; + val = GetThreadQos(level2); + EXPECT_EQ(val, 0); + EXPECT_NE(static_cast(level2), static_cast(QosLevel::QOS_MAX)); + + val = SetThreadQos((QosLevel)-1); + EXPECT_NE(val, 0); + enum QosLevel level3; + val = GetThreadQos(level3); + EXPECT_EQ(val, 0); + EXPECT_NE(static_cast(level3), static_cast((QosLevel)-1)); + + val = SetThreadQos((QosLevel)1024); + EXPECT_NE(val, 0); + enum QosLevel level4; + val = GetThreadQos(level4); EXPECT_EQ(val, 0); - EXPECT_NE(static_cast(level), static_cast(QosLevel::QOS_MAX)); + EXPECT_NE(static_cast(level4), static_cast((QosLevel)1024)); } /** -- Gitee From 749b95ec088647351569a1e54134a2ae9d127ca9 Mon Sep 17 00:00:00 2001 From: xushengbin Date: Wed, 16 Apr 2025 08:21:26 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0tdd=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xushengbin --- test/unittest/phone/concurrent_svc_intf_test.cpp | 10 ---------- .../concurrent_task_controller_interface_test.cpp | 10 ---------- 2 files changed, 20 deletions(-) diff --git a/test/unittest/phone/concurrent_svc_intf_test.cpp b/test/unittest/phone/concurrent_svc_intf_test.cpp index 63098e5..dbb8e64 100644 --- a/test/unittest/phone/concurrent_svc_intf_test.cpp +++ b/test/unittest/phone/concurrent_svc_intf_test.cpp @@ -85,16 +85,6 @@ HWTEST_F(ConcurrentSvcIntfTest, QueryBeforeGetPriv, TestSize.Level1) EXPECT_EQ(grpId, -1); grpId = QueryInterval(QUERY_RENDER_SERVICE_RENDER); EXPECT_EQ(grpId, -1); - grpId = QueryInterval(QUERY_SELF_RENDER_REMOVE_THREAD); - EXPECT_EQ(grpId, -1); - grpId = QueryInterval(QUERY_SELF_RENDER_ADD_THREAD); - EXPECT_EQ(grpId, -1); - grpId = QueryInterval(QUERY_MODIFIER_DRAW); - EXPECT_EQ(grpId, -1); - grpId = QueryInterval(QUERY_SELF_RENDER_FRAME_START); - EXPECT_EQ(grpId, -1); - grpId = QueryInterval(QUERY_SELF_RENDER_FRAME_END); - EXPECT_EQ(grpId, -1); } /** diff --git a/test/unittest/phone/concurrent_task_controller_interface_test.cpp b/test/unittest/phone/concurrent_task_controller_interface_test.cpp index ddce904..232f952 100644 --- a/test/unittest/phone/concurrent_task_controller_interface_test.cpp +++ b/test/unittest/phone/concurrent_task_controller_interface_test.cpp @@ -130,16 +130,6 @@ HWTEST_F(ConcurrentTaskControllerInterfaceTest, QueryIntervalTest, TestSize.Leve queInt.QueryInterval(queryItem, queryRs); queryItem = QUERY_RENDER_SERVICE_RENDER; queInt.QueryInterval(queryItem, queryRs); - queryItem = QUERY_SELF_RENDER_REMOVE_THREAD; - queInt.QueryInterval(queryItem, queryRs); - queryItem = QUERY_SELF_RENDER_ADD_THREAD; - queInt.QueryInterval(queryItem, queryRs); - queryItem = QUERY_MODIFIER_DRAW; - queInt.QueryInterval(queryItem, queryRs); - queryItem = QUERY_SELF_RENDER_FRAME_START; - queInt.QueryInterval(queryItem, queryRs); - queryItem = QUERY_SELF_RENDER_FRAME_END; - queInt.QueryInterval(queryItem, queryRs); queryItem = QURRY_TYPE_MAX; queInt.QueryInterval(queryItem, queryRs); EXPECT_FALSE(queInt.inited_); -- Gitee