From b9d97f777992835fd0f1bdfdecafb1e4e9502ef7 Mon Sep 17 00:00:00 2001 From: xdongs Date: Tue, 1 Jul 2025 12:02:10 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=96=B0=E5=A2=9EFuzzTest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xdongs --- .../ans/test/unittest/mock/mock_datashare.cpp | 5 ++ ...etnotificationrequestbyhashcode_fuzzer.cpp | 10 ++++ .../service_getslotbybundle_fuzzer.cpp | 12 ++++- ...ncnotificationenabledwithoutapp_fuzzer.cpp | 10 ++++ .../service_publishasbundle_fuzzer.cpp | 10 ++++ .../service_registerpushcallback_fuzzer.cpp | 25 ++++++++- .../service_removenotification_fuzzer.cpp | 14 ++++- ...ice_setbadgenumberfordhbybundle_fuzzer.cpp | 12 ++++- ...e_setdistributedenabledbybundle_fuzzer.cpp | 13 ++++- .../service_setslotflagsasbundle_fuzzer.cpp | 12 ++++- .../service_subscribe_fuzzer.cpp | 46 +++++++++++++++- .../mock/mock_notification_check_request.h | 53 +++++++++++++++++++ 12 files changed, 215 insertions(+), 7 deletions(-) create mode 100644 test/fuzztest/fuzz_common_base/mock/mock_notification_check_request.h diff --git a/services/ans/test/unittest/mock/mock_datashare.cpp b/services/ans/test/unittest/mock/mock_datashare.cpp index 4819c72ca..8f74f2739 100644 --- a/services/ans/test/unittest/mock/mock_datashare.cpp +++ b/services/ans/test/unittest/mock/mock_datashare.cpp @@ -321,6 +321,11 @@ public: { return {}; } + + int OpenFileWithErrCode(Uri &uri, const std::string &mode, int32_t &errCode) override + { + return 0; + } }; std::shared_ptr DataShareHelper::Creator(const sptr &token, const std::string &strUri, diff --git a/test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/service_getnotificationrequestbyhashcode_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/service_getnotificationrequestbyhashcode_fuzzer.cpp index eb3146dfc..592cd5086 100644 --- a/test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/service_getnotificationrequestbyhashcode_fuzzer.cpp +++ b/test/fuzztest/advancednotificationservice/servicegetnotificationrequestbyhashcode_fuzzer/service_getnotificationrequestbyhashcode_fuzzer.cpp @@ -23,6 +23,10 @@ namespace OHOS { namespace Notification { bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) { + auto service = AdvancedNotificationService::GetInstance(); + std::string hashCode = fuzzData->ConsumeRandomLengthString(); + sptr notificationRequest; + service->GetNotificationRequestByHashCode(hashCode, notificationRequest); return true; } } @@ -33,6 +37,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { /* Run your code on data */ FuzzedDataProvider fdp(data, size); + std::vector requestPermission = { + OHOS::Notification::OHOS_PERMISSION_NOTIFICATION_CONTROLLER, + OHOS::Notification::OHOS_PERMISSION_NOTIFICATION_AGENT_CONTROLLER, + OHOS::Notification::OHOS_PERMISSION_SET_UNREMOVABLE_NOTIFICATION + }; + MockRandomToken(&fdp, requestPermission); OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); return 0; } diff --git a/test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/service_getslotbybundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/service_getslotbybundle_fuzzer.cpp index 91f472ca6..a3c1b6d23 100644 --- a/test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/service_getslotbybundle_fuzzer.cpp +++ b/test/fuzztest/advancednotificationservice/servicegetslotbybundle_fuzzer/service_getslotbybundle_fuzzer.cpp @@ -17,12 +17,16 @@ #include #include "advanced_notification_service.h" #include "ans_permission_def.h" -#include "mock_notification_request.h" +#include "mock_notification_bundle_option.h" namespace OHOS { namespace Notification { bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) { + auto service = AdvancedNotificationService::GetInstance(); + sptr bundleOption = ObjectBuilder::Build(fuzzData); + std::vector> slots; + service->GetSlotsByBundle(bundleOption, slots); return true; } } @@ -33,6 +37,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { /* Run your code on data */ FuzzedDataProvider fdp(data, size); + std::vector requestPermission = { + OHOS::Notification::OHOS_PERMISSION_NOTIFICATION_CONTROLLER, + OHOS::Notification::OHOS_PERMISSION_NOTIFICATION_AGENT_CONTROLLER, + OHOS::Notification::OHOS_PERMISSION_SET_UNREMOVABLE_NOTIFICATION + }; + MockRandomToken(&fdp, requestPermission); OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); return 0; } diff --git a/test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/service_getsyncnotificationenabledwithoutapp_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/service_getsyncnotificationenabledwithoutapp_fuzzer.cpp index 216c80c33..02aeac804 100644 --- a/test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/service_getsyncnotificationenabledwithoutapp_fuzzer.cpp +++ b/test/fuzztest/advancednotificationservice/servicegetsyncnotificationenabledwithoutapp_fuzzer/service_getsyncnotificationenabledwithoutapp_fuzzer.cpp @@ -23,6 +23,10 @@ namespace OHOS { namespace Notification { bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) { + auto service = AdvancedNotificationService::GetInstance(); + int32_t userId = fuzzData->ConsumeIntegral(); + bool enabled = fuzzData->ConsumeBool(); + service->GetSyncNotificationEnabledWithoutApp(userId, enabled); return true; } } @@ -33,6 +37,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { /* Run your code on data */ FuzzedDataProvider fdp(data, size); + std::vector requestPermission = { + OHOS::Notification::OHOS_PERMISSION_NOTIFICATION_CONTROLLER, + OHOS::Notification::OHOS_PERMISSION_NOTIFICATION_AGENT_CONTROLLER, + OHOS::Notification::OHOS_PERMISSION_SET_UNREMOVABLE_NOTIFICATION + }; + MockRandomToken(&fdp, requestPermission); OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); return 0; } diff --git a/test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/service_publishasbundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/service_publishasbundle_fuzzer.cpp index 5554a3043..80b24d4e3 100644 --- a/test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/service_publishasbundle_fuzzer.cpp +++ b/test/fuzztest/advancednotificationservice/servicepublishasbundle_fuzzer/service_publishasbundle_fuzzer.cpp @@ -23,6 +23,10 @@ namespace OHOS { namespace Notification { bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) { + auto service = AdvancedNotificationService::GetInstance(); + sptr request = ObjectBuilder::Build(fuzzData); + std::string representativeBundle = fuzzData->ConsumeRandomLengthString(); + service->PublishAsBundle(request, representativeBundle); return true; } } @@ -33,6 +37,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { /* Run your code on data */ FuzzedDataProvider fdp(data, size); + std::vector requestPermission = { + OHOS::Notification::OHOS_PERMISSION_NOTIFICATION_CONTROLLER, + OHOS::Notification::OHOS_PERMISSION_NOTIFICATION_AGENT_CONTROLLER, + OHOS::Notification::OHOS_PERMISSION_SET_UNREMOVABLE_NOTIFICATION + }; + MockRandomToken(&fdp, requestPermission); OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); return 0; } diff --git a/test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/service_registerpushcallback_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/service_registerpushcallback_fuzzer.cpp index 56f10cdda..c9776ac46 100644 --- a/test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/service_registerpushcallback_fuzzer.cpp +++ b/test/fuzztest/advancednotificationservice/serviceregisterpushcallback_fuzzer/service_registerpushcallback_fuzzer.cpp @@ -17,12 +17,29 @@ #include #include "advanced_notification_service.h" #include "ans_permission_def.h" -#include "mock_notification_request.h" +#include "mock_notification_check_request.h" +#include "push_callback_stub.h" namespace OHOS { namespace Notification { + +class FuzzTestPushCallBackStub : public PushCallBackStub { +public: + int32_t OnCheckNotification( + const std::string ¬ificationData, + const std::shared_ptr &pushCallBackParam) override + { + return 0; + } +}; + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) { + auto service = AdvancedNotificationService::GetInstance(); + sptr pushCallback = new (std::nothrow) FuzzTestPushCallBackStub(); + sptr notificationCheckRequest = + ObjectBuilder::Build(fuzzData); + service->RegisterPushCallback(pushCallback, notificationCheckRequest); return true; } } @@ -33,6 +50,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { /* Run your code on data */ FuzzedDataProvider fdp(data, size); + std::vector requestPermission = { + OHOS::Notification::OHOS_PERMISSION_NOTIFICATION_CONTROLLER, + OHOS::Notification::OHOS_PERMISSION_NOTIFICATION_AGENT_CONTROLLER, + OHOS::Notification::OHOS_PERMISSION_SET_UNREMOVABLE_NOTIFICATION + }; + MockRandomToken(&fdp, requestPermission); OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); return 0; } diff --git a/test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/service_removenotification_fuzzer.cpp b/test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/service_removenotification_fuzzer.cpp index c66de57b1..fb3e6c2da 100644 --- a/test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/service_removenotification_fuzzer.cpp +++ b/test/fuzztest/advancednotificationservice/serviceremovenotification_fuzzer/service_removenotification_fuzzer.cpp @@ -17,12 +17,18 @@ #include #include "advanced_notification_service.h" #include "ans_permission_def.h" -#include "mock_notification_request.h" +#include "mock_notification_bundle_option.h" namespace OHOS { namespace Notification { bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) { + auto service = AdvancedNotificationService::GetInstance(); + sptr bundleOption = ObjectBuilder::Build(fuzzData); + std::string label = fuzzData->ConsumeRandomLengthString(); + int32_t notificationId = fuzzData->ConsumeIntegral(); + int32_t removeReason = fuzzData->ConsumeIntegral(); + service->RemoveNotification(bundleOption, notificationId, label, removeReason); return true; } } @@ -33,6 +39,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { /* Run your code on data */ FuzzedDataProvider fdp(data, size); + std::vector requestPermission = { + OHOS::Notification::OHOS_PERMISSION_NOTIFICATION_CONTROLLER, + OHOS::Notification::OHOS_PERMISSION_NOTIFICATION_AGENT_CONTROLLER, + OHOS::Notification::OHOS_PERMISSION_SET_UNREMOVABLE_NOTIFICATION + }; + MockRandomToken(&fdp, requestPermission); OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); return 0; } diff --git a/test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/service_setbadgenumberfordhbybundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/service_setbadgenumberfordhbybundle_fuzzer.cpp index df8ad3cc7..c353508f7 100644 --- a/test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/service_setbadgenumberfordhbybundle_fuzzer.cpp +++ b/test/fuzztest/advancednotificationservice/servicesetbadgenumberfordhbybundle_fuzzer/service_setbadgenumberfordhbybundle_fuzzer.cpp @@ -17,12 +17,16 @@ #include #include "advanced_notification_service.h" #include "ans_permission_def.h" -#include "mock_notification_request.h" +#include "mock_notification_bundle_option.h" namespace OHOS { namespace Notification { bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) { + auto service = AdvancedNotificationService::GetInstance(); + sptr bundleOption = ObjectBuilder::Build(fuzzData); + int32_t badgeNumber = fuzzData->ConsumeIntegral(); + service->SetBadgeNumberForDhByBundle(bundleOption, badgeNumber); return true; } } @@ -33,6 +37,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { /* Run your code on data */ FuzzedDataProvider fdp(data, size); + std::vector requestPermission = { + OHOS::Notification::OHOS_PERMISSION_NOTIFICATION_CONTROLLER, + OHOS::Notification::OHOS_PERMISSION_NOTIFICATION_AGENT_CONTROLLER, + OHOS::Notification::OHOS_PERMISSION_SET_UNREMOVABLE_NOTIFICATION + }; + MockRandomToken(&fdp, requestPermission); OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); return 0; } diff --git a/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/service_setdistributedenabledbybundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/service_setdistributedenabledbybundle_fuzzer.cpp index 466d90492..3b268dc2d 100644 --- a/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/service_setdistributedenabledbybundle_fuzzer.cpp +++ b/test/fuzztest/advancednotificationservice/servicesetdistributedenabledbybundle_fuzzer/service_setdistributedenabledbybundle_fuzzer.cpp @@ -17,12 +17,17 @@ #include #include "advanced_notification_service.h" #include "ans_permission_def.h" -#include "mock_notification_request.h" +#include "mock_notification_bundle_option.h" namespace OHOS { namespace Notification { bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) { + auto service = AdvancedNotificationService::GetInstance(); + sptr bundleOption = ObjectBuilder::Build(fuzzData); + std::string deviceType = fuzzData->ConsumeRandomLengthString(); + bool enabled = fuzzData->ConsumeBool(); + service->SetDistributedEnabledByBundle(bundleOption, deviceType, enabled); return true; } } @@ -33,6 +38,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { /* Run your code on data */ FuzzedDataProvider fdp(data, size); + std::vector requestPermission = { + OHOS::Notification::OHOS_PERMISSION_NOTIFICATION_CONTROLLER, + OHOS::Notification::OHOS_PERMISSION_NOTIFICATION_AGENT_CONTROLLER, + OHOS::Notification::OHOS_PERMISSION_SET_UNREMOVABLE_NOTIFICATION + }; + MockRandomToken(&fdp, requestPermission); OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); return 0; } diff --git a/test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/service_setslotflagsasbundle_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/service_setslotflagsasbundle_fuzzer.cpp index dbf0f5a56..cb84b9cc5 100644 --- a/test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/service_setslotflagsasbundle_fuzzer.cpp +++ b/test/fuzztest/advancednotificationservice/servicesetslotflagsasbundle_fuzzer/service_setslotflagsasbundle_fuzzer.cpp @@ -17,12 +17,16 @@ #include #include "advanced_notification_service.h" #include "ans_permission_def.h" -#include "mock_notification_request.h" +#include "mock_notification_bundle_option.h" namespace OHOS { namespace Notification { bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) { + auto service = AdvancedNotificationService::GetInstance(); + sptr bundleOption = ObjectBuilder::Build(fuzzData); + uint32_t slotFlags = fuzzData->ConsumeIntegral(); + service->SetSlotFlagsAsBundle(bundleOption, slotFlags); return true; } } @@ -33,6 +37,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { /* Run your code on data */ FuzzedDataProvider fdp(data, size); + std::vector requestPermission = { + OHOS::Notification::OHOS_PERMISSION_NOTIFICATION_CONTROLLER, + OHOS::Notification::OHOS_PERMISSION_NOTIFICATION_AGENT_CONTROLLER, + OHOS::Notification::OHOS_PERMISSION_SET_UNREMOVABLE_NOTIFICATION + }; + MockRandomToken(&fdp, requestPermission); OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); return 0; } diff --git a/test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/service_subscribe_fuzzer.cpp b/test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/service_subscribe_fuzzer.cpp index 991515ae6..846207df8 100644 --- a/test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/service_subscribe_fuzzer.cpp +++ b/test/fuzztest/advancednotificationservice/servicesubscribe_fuzzer/service_subscribe_fuzzer.cpp @@ -17,12 +17,50 @@ #include #include "advanced_notification_service.h" #include "ans_permission_def.h" -#include "mock_notification_request.h" +#include "mock_notification_subscribe_info.h" +#include "notification_subscriber.h" +#include "ans_subscriber_listener.h" namespace OHOS { namespace Notification { + +class FuzzTestSubscriber : public NotificationSubscriber { +public: + void OnDisconnected() override + {} + void OnDied() override + {} + void OnUpdate(const std::shared_ptr &sortingMap) override + {} + void OnDoNotDisturbDateChange(const std::shared_ptr &date) override + {} + void OnConnected() override + {} + void OnEnabledNotificationChanged(const std::shared_ptr &callbackData) override + {} + void OnCanceled(const std::shared_ptr &request, + const std::shared_ptr &sortingMap, int deleteReason) override + {} + void OnBadgeChanged(const std::shared_ptr &badgeData) override + {} + void OnBadgeEnabledChanged(const sptr &callbackData) override + {} + void OnConsumed(const std::shared_ptr &request, + const std::shared_ptr &sortingMap) override + {} + + void OnBatchCanceled(const std::vector> &requestList, + const std::shared_ptr &sortingMap, int32_t deleteReason) override + {} +}; + bool DoSomethingInterestingWithMyAPI(FuzzedDataProvider *fuzzData) { + auto service = AdvancedNotificationService::GetInstance(); + std::shared_ptr testSubscriber = std::make_shared(); + sptr subscriber = new (std::nothrow) SubscriberListener(testSubscriber); + sptr info = ObjectBuilder::Build(fuzzData); + service->Subscribe(subscriber, info); return true; } } @@ -33,6 +71,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { /* Run your code on data */ FuzzedDataProvider fdp(data, size); + std::vector requestPermission = { + OHOS::Notification::OHOS_PERMISSION_NOTIFICATION_CONTROLLER, + OHOS::Notification::OHOS_PERMISSION_NOTIFICATION_AGENT_CONTROLLER, + OHOS::Notification::OHOS_PERMISSION_SET_UNREMOVABLE_NOTIFICATION + }; + MockRandomToken(&fdp, requestPermission); OHOS::Notification::DoSomethingInterestingWithMyAPI(&fdp); return 0; } diff --git a/test/fuzztest/fuzz_common_base/mock/mock_notification_check_request.h b/test/fuzztest/fuzz_common_base/mock/mock_notification_check_request.h new file mode 100644 index 000000000..b24314e2c --- /dev/null +++ b/test/fuzztest/fuzz_common_base/mock/mock_notification_check_request.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2025 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. + */ + +#ifndef MOCK_NOTIFICATION_CHECK_REQUEST_BUILDER_H +#define MOCK_NOTIFICATION_CHECK_REQUEST_BUILDER_H + +#include "mock_fuzz_object.h" +#include "notification_check_request.h" + +namespace OHOS { +namespace Notification { + +const int MAX_SLOT_TYPE = 8; +const int MAX_CONTENT_TYPE = 10; +const int MAX_ARRAY_SIZE = 10; +const int MAX_STRING_SIZE = 20; + +template <> +NotificationCheckRequest* ObjectBuilder::Build(FuzzedDataProvider *fdp) +{ + auto checkRequest = new NotificationCheckRequest(); + + checkRequest->SetContentType(static_cast( + fdp->ConsumeIntegralInRange(0, MAX_CONTENT_TYPE))); + + checkRequest->SetSlotType(static_cast( + fdp->ConsumeIntegralInRange(0, MAX_SLOT_TYPE))); + std::vector extraKeys; + for (int i = 0; i < fdp->ConsumeIntegralInRange(0, MAX_ARRAY_SIZE); i++) { + extraKeys.push_back(fdp->ConsumeRandomLengthString(MAX_STRING_SIZE)); + } + checkRequest->SetExtraKeys(extraKeys); + checkRequest->SetUid(fdp->ConsumeIntegral()); + + ANS_LOGE("Build mock veriables"); + return checkRequest; +} +} // namespace Notification +} // namespace OHOS + +#endif // MOCK_NOTIFICATION_CHECK_REQUEST_BUILDER_H \ No newline at end of file -- Gitee From 7c3ef5982099027d6b03ebf45880457ee780f816 Mon Sep 17 00:00:00 2001 From: xdongs2009 Date: Tue, 1 Jul 2025 10:43:10 +0000 Subject: [PATCH 2/2] update services/ans/test/unittest/mock/mock_datashare.cpp. Signed-off-by: xdongs2009 --- services/ans/test/unittest/mock/mock_datashare.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/services/ans/test/unittest/mock/mock_datashare.cpp b/services/ans/test/unittest/mock/mock_datashare.cpp index 8f74f2739..4819c72ca 100644 --- a/services/ans/test/unittest/mock/mock_datashare.cpp +++ b/services/ans/test/unittest/mock/mock_datashare.cpp @@ -321,11 +321,6 @@ public: { return {}; } - - int OpenFileWithErrCode(Uri &uri, const std::string &mode, int32_t &errCode) override - { - return 0; - } }; std::shared_ptr DataShareHelper::Creator(const sptr &token, const std::string &strUri, -- Gitee