From 8f68f7c17eb4ccdfe40fa72c461aa3f3f7ade231 Mon Sep 17 00:00:00 2001 From: AXYChen Date: Thu, 31 Jul 2025 21:35:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E5=AE=89=E5=85=A8=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6TDD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: AXYChen Change-Id: I7f670098cd6522e429faa8b31be81c4be233f029 --- .../unittest/src/sec_comp_enhance_test.cpp | 1 + .../test/unittest/src/sec_comp_enhance_test.h | 2 ++ .../unittest/src/location_button_test.cpp | 15 ++++++++++++ .../test/unittest/src/paste_button_test.cpp | 15 ++++++++++++ .../test/unittest/src/save_button_test.cpp | 15 ++++++++++++ .../test/unittest/src/sec_comp_kit_test.cpp | 23 +++++++++++++++++++ 6 files changed, 71 insertions(+) diff --git a/frameworks/inner_api/enhance_kits/test/unittest/src/sec_comp_enhance_test.cpp b/frameworks/inner_api/enhance_kits/test/unittest/src/sec_comp_enhance_test.cpp index e44993e..16135ac 100644 --- a/frameworks/inner_api/enhance_kits/test/unittest/src/sec_comp_enhance_test.cpp +++ b/frameworks/inner_api/enhance_kits/test/unittest/src/sec_comp_enhance_test.cpp @@ -95,6 +95,7 @@ HWTEST_F(SecCompEnhanceTest, GetPoniterEventEnhanceData001, TestSize.Level0) uint8_t* enhanceData = nullptr; uint32_t enHancedataLen = MAX_HMAC_SIZE; + InitSecCompClientEnhance(); int32_t result = SecCompEnhanceKit::GetPointerEventEnhanceData(originData, dataLen, enhanceData, enHancedataLen); if (g_inputEnhanceExist) { EXPECT_EQ(result, SC_SERVICE_ERROR_SERVICE_NOT_EXIST); diff --git a/frameworks/inner_api/enhance_kits/test/unittest/src/sec_comp_enhance_test.h b/frameworks/inner_api/enhance_kits/test/unittest/src/sec_comp_enhance_test.h index deff0d4..8f69a5b 100644 --- a/frameworks/inner_api/enhance_kits/test/unittest/src/sec_comp_enhance_test.h +++ b/frameworks/inner_api/enhance_kits/test/unittest/src/sec_comp_enhance_test.h @@ -19,6 +19,8 @@ #include "sec_comp_enhance_adapter.h" #include "sec_comp_enhance_kit.h" +extern "C" __attribute__((visibility("default"))) void InitSecCompClientEnhance(); + namespace OHOS { namespace Security { namespace SecurityComponent { diff --git a/frameworks/inner_api/security_component/test/unittest/src/location_button_test.cpp b/frameworks/inner_api/security_component/test/unittest/src/location_button_test.cpp index ee2033e..7c0dadf 100644 --- a/frameworks/inner_api/security_component/test/unittest/src/location_button_test.cpp +++ b/frameworks/inner_api/security_component/test/unittest/src/location_button_test.cpp @@ -780,3 +780,18 @@ HWTEST_F(LocationButtonTest, CompareLocationButton003, TestSize.Level1) EXPECT_TRUE(button1.FromJson(jsonComponent, message, isClicked)); EXPECT_FALSE(button1.CompareComponentBasicInfo(&button2, false)); } + +/** + * @tc.name: IsCorrespondenceType001 + * @tc.desc: Test IsCorrespondenceType + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(LocationButtonTest, IsCorrespondenceType001, TestSize.Level1) +{ + LocationButton button; + button.type_ = LOCATION_COMPONENT; + EXPECT_TRUE(button.IsCorrespondenceType()); + button.type_ = SAVE_COMPONENT; + EXPECT_FALSE(button.IsCorrespondenceType()); +} diff --git a/frameworks/inner_api/security_component/test/unittest/src/paste_button_test.cpp b/frameworks/inner_api/security_component/test/unittest/src/paste_button_test.cpp index 389d8fa..217bf3e 100644 --- a/frameworks/inner_api/security_component/test/unittest/src/paste_button_test.cpp +++ b/frameworks/inner_api/security_component/test/unittest/src/paste_button_test.cpp @@ -171,3 +171,18 @@ HWTEST_F(PasteButtonTest, ComparePasteButton003, TestSize.Level0) ASSERT_TRUE(button1.FromJson(jsonComponent, message, isClicked)); ASSERT_FALSE(button1.CompareComponentBasicInfo(&button2, true)); } + +/** + * @tc.name: IsCorrespondenceType001 + * @tc.desc: Test IsCorrespondenceType + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(PasteButtonTest, IsCorrespondenceType001, TestSize.Level1) +{ + PasteButton button; + button.type_ = PASTE_COMPONENT; + EXPECT_TRUE(button.IsCorrespondenceType()); + button.type_ = LOCATION_COMPONENT; + EXPECT_FALSE(button.IsCorrespondenceType()); +} diff --git a/frameworks/inner_api/security_component/test/unittest/src/save_button_test.cpp b/frameworks/inner_api/security_component/test/unittest/src/save_button_test.cpp index 29a3834..23edb3e 100644 --- a/frameworks/inner_api/security_component/test/unittest/src/save_button_test.cpp +++ b/frameworks/inner_api/security_component/test/unittest/src/save_button_test.cpp @@ -175,3 +175,18 @@ HWTEST_F(SaveButtonTest, CompareSaveButton003, TestSize.Level0) ASSERT_TRUE(button1.FromJson(jsonComponent, message, isClicked)); ASSERT_FALSE(button1.CompareComponentBasicInfo(&button2, true)); } + +/** + * @tc.name: IsCorrespondenceType001 + * @tc.desc: Test IsCorrespondenceType + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(SaveButtonTest, IsCorrespondenceType001, TestSize.Level1) +{ + SaveButton button; + button.type_ = SAVE_COMPONENT; + EXPECT_TRUE(button.IsCorrespondenceType()); + button.type_ = PASTE_COMPONENT; + EXPECT_FALSE(button.IsCorrespondenceType()); +} diff --git a/frameworks/inner_api/security_component/test/unittest/src/sec_comp_kit_test.cpp b/frameworks/inner_api/security_component/test/unittest/src/sec_comp_kit_test.cpp index ab248ab..8f5f57f 100644 --- a/frameworks/inner_api/security_component/test/unittest/src/sec_comp_kit_test.cpp +++ b/frameworks/inner_api/security_component/test/unittest/src/sec_comp_kit_test.cpp @@ -263,3 +263,26 @@ HWTEST_F(SecCompKitTest, HasCustomPermissionForSecComp001, TestSize.Level0) { EXPECT_EQ(false, SecCompKit::HasCustomPermissionForSecComp()); } + +/** + * @tc.name: PreRegisterSecCompProcess001 + * @tc.desc: Test PreRegisterSecCompProcess. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(SecCompKitTest, PreRegisterSecCompProcess001, TestSize.Level0) +{ + EXPECT_NE(SC_OK, SecCompKit::PreRegisterSecCompProcess()); +} + +/** + * @tc.name: LoadService001 + * @tc.desc: Test LoadService. + * @tc.type: FUNC + * @tc.require: + */ +HWTEST_F(SecCompKitTest, LoadService001, TestSize.Level0) +{ + EXPECT_EQ(true, SecCompKit::LoadService()); + EXPECT_EQ(true, SecCompKit::IsServiceExist()); +} -- Gitee