From 10017cc9d9733f62eafcd454acda8a0d53300b27 Mon Sep 17 00:00:00 2001 From: guoyi Date: Mon, 4 Aug 2025 21:02:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=A7=8B=E7=BB=88=E4=BF=A1?= =?UTF-8?q?=E4=BB=BB=E5=90=8E=E4=BC=9A=E8=87=AA=E5=8A=A8unBindDevice?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: guoyi --- .../include/deviceprofile_connector.h | 3 + .../src/deviceprofile_connector.cpp | 16 ++++ .../auth_stages/auth_acl.cpp | 6 +- ...Test_dm_deviceprofile_connector_second.cpp | 62 +++++++++++++++ test/unittest/BUILD.gn | 5 +- test/unittest/UTTest_auth_negotiate.cpp | 4 + test/unittest/UTTest_dm_softbus_cache.cpp | 77 ++++++++++++------- test/unittest/UTTest_dm_softbus_cache.h | 6 +- ...distributed_device_profile_client_mock.cpp | 7 +- .../distributed_device_profile_client_mock.h | 4 +- 10 files changed, 155 insertions(+), 35 deletions(-) diff --git a/commondependency/include/deviceprofile_connector.h b/commondependency/include/deviceprofile_connector.h index b6e6df3ec..3923a314d 100644 --- a/commondependency/include/deviceprofile_connector.h +++ b/commondependency/include/deviceprofile_connector.h @@ -328,6 +328,9 @@ public: const DmAccessCallee &callee, const std::string &sinkUdid); DM_EXPORT void DeleteHoDevice(const std::string &peerUdid, const std::vector &foreGroundUserIds, const std::vector &backGroundUserIds); + DM_EXPORT bool IsAllowAuthAlways(const std::string &localUdid, int32_t userId, const std::string &peerUdid, + const std::string &pkgName, int64_t tokenId); + private: int32_t HandleDmAuthForm(DistributedDeviceProfile::AccessControlProfile profiles, DmDiscoveryInfo discoveryInfo); void GetParamBindTypeVec(DistributedDeviceProfile::AccessControlProfile profiles, std::string requestDeviceId, diff --git a/commondependency/src/deviceprofile_connector.cpp b/commondependency/src/deviceprofile_connector.cpp index f10d9dd62..b43bd68c1 100644 --- a/commondependency/src/deviceprofile_connector.cpp +++ b/commondependency/src/deviceprofile_connector.cpp @@ -3486,6 +3486,22 @@ bool DeviceProfileConnector::CheckExtWhiteList(const std::string &pkgName) return false; } +bool DeviceProfileConnector::IsAllowAuthAlways(const std::string &localUdid, int32_t userId, + const std::string &peerUdid, const std::string &pkgName, int64_t tokenId) +{ + auto acls = GetAclProfileByDeviceIdAndUserId(localUdid, userId, peerUdid); + for (const auto &item : acls) { + auto accesser = item.GetAccesser(); + auto accessee = item.GetAccessee(); + if (item.GetAuthenticationType() == ALLOW_AUTH_ALWAYS && + ((accesser.GetAccesserBundleName() == pkgName && accesser.GetAccesserTokenId() == tokenId) || + (accessee.GetAccesseeBundleName() == pkgName && accessee.GetAccesseeTokenId() == tokenId))) { + return true; + } + } + return false; +} + IDeviceProfileConnector *CreateDpConnectorInstance() { return &DeviceProfileConnector::GetInstance(); diff --git a/services/implementation/src/authentication_v2/auth_stages/auth_acl.cpp b/services/implementation/src/authentication_v2/auth_stages/auth_acl.cpp index eff5dd6d6..a4581ac99 100644 --- a/services/implementation/src/authentication_v2/auth_stages/auth_acl.cpp +++ b/services/implementation/src/authentication_v2/auth_stages/auth_acl.cpp @@ -240,9 +240,13 @@ int32_t AuthSrcFinishState::Action(std::shared_ptr context) context->state = static_cast(GetStateType()); } context->isNeedJoinLnn = true; - SourceFinish(context); std::string peerDeviceId = ""; GetPeerDeviceId(context, peerDeviceId); + if (DeviceProfileConnector::GetInstance().IsAllowAuthAlways(context->accesser.deviceId, context->accesser.userId, + peerDeviceId, context->pkgName, context->accesser.tokenId)) { + context->confirmOperation = UiAction::USER_OPERATION_TYPE_ALLOW_AUTH_ALWAYS; + } + SourceFinish(context); bool isNeedJoinLnn = context->softbusConnector->CheckIsNeedJoinLnn(peerDeviceId, context->accessee.addr); // Trigger networking if (context->reason == DM_BIND_TRUST_TARGET && (!context->accesser.isOnline || isNeedJoinLnn)) { diff --git a/test/commonunittest/UTTest_dm_deviceprofile_connector_second.cpp b/test/commonunittest/UTTest_dm_deviceprofile_connector_second.cpp index 632006963..00961abec 100644 --- a/test/commonunittest/UTTest_dm_deviceprofile_connector_second.cpp +++ b/test/commonunittest/UTTest_dm_deviceprofile_connector_second.cpp @@ -1717,5 +1717,67 @@ HWTEST_F(DeviceProfileConnectorSecondTest, GetDeviceIdAndUdidListByTokenId_004, auto result = DeviceProfileConnector::GetInstance().GetDeviceIdAndUdidListByTokenId(userIds, localUdid, tokenId); EXPECT_TRUE(result.empty()); } + +HWTEST_F(DeviceProfileConnectorSecondTest, IsAllowAuthAlways_001, testing::ext::TestSize.Level1) +{ + std::vector acls; + AddAccessControlProfile(acls); + auto &item = acls[0]; + item.SetAuthenticationType(ALLOW_AUTH_ALWAYS); + std::string localUdid = item.GetAccesser().GetAccesserDeviceId(); + int32_t userId = item.GetAccesser().GetAccesserUserId(); + std::string peerUdid = item.GetAccessee().GetAccesseeDeviceId(); + std::string pkgName = item.GetAccesser().GetAccesserBundleName(); + uint64_t tokenId = item.GetAccesser().GetAccesserTokenId(); + EXPECT_CALL(*distributedDeviceProfileClientMock_, GetAllAclIncludeLnnAcl(_)) + .WillOnce(DoAll(SetArgReferee<0>(acls), Return(0))); + bool result = DeviceProfileConnector::GetInstance().IsAllowAuthAlways(localUdid, userId, peerUdid, + pkgName, tokenId); + EXPECT_TRUE(result); + + localUdid = item.GetAccessee().GetAccesseeDeviceId(); + userId = item.GetAccessee().GetAccesseeUserId(); + peerUdid = item.GetAccesser().GetAccesserDeviceId(); + pkgName = item.GetAccessee().GetAccesseeBundleName(); + tokenId = item.GetAccessee().GetAccesseeTokenId(); + EXPECT_CALL(*distributedDeviceProfileClientMock_, GetAllAclIncludeLnnAcl(_)) + .WillOnce(DoAll(SetArgReferee<0>(acls), Return(0))); + result = DeviceProfileConnector::GetInstance().IsAllowAuthAlways(localUdid, userId, peerUdid, + pkgName, tokenId); + EXPECT_TRUE(result); +} + +HWTEST_F(DeviceProfileConnectorSecondTest, IsAllowAuthAlways_002, testing::ext::TestSize.Level1) +{ + std::vector acls; + AddAccessControlProfile(acls); + auto &item = acls[0]; + std::string localUdid = item.GetAccesser().GetAccesserDeviceId(); + int32_t userId = item.GetAccesser().GetAccesserUserId(); + std::string peerUdid = item.GetAccessee().GetAccesseeDeviceId(); + std::string pkgName = item.GetAccesser().GetAccesserBundleName(); + uint64_t tokenId = item.GetAccesser().GetAccesserTokenId(); + item.SetAuthenticationType(ALLOW_AUTH_ONCE); + EXPECT_CALL(*distributedDeviceProfileClientMock_, GetAllAclIncludeLnnAcl((_))) + .WillOnce(DoAll(SetArgReferee<0>(acls), Return(0))); + bool result = DeviceProfileConnector::GetInstance().IsAllowAuthAlways(localUdid, userId, peerUdid, + pkgName, tokenId); + EXPECT_FALSE(result); +} + +HWTEST_F(DeviceProfileConnectorSecondTest, IsAllowAuthAlways_003, testing::ext::TestSize.Level1) +{ + std::vector acls; + std::string localUdid = "localUdid3"; + int32_t userId = 3; + std::string peerUdid = "peerUdid3"; + std::string pkgName = "com.example.app3"; + uint64_t tokenId = 123458; + EXPECT_CALL(*distributedDeviceProfileClientMock_, GetAllAclIncludeLnnAcl((_))) + .WillOnce(DoAll(SetArgReferee<0>(acls), Return(0))); + bool result = DeviceProfileConnector::GetInstance().IsAllowAuthAlways(localUdid, userId, peerUdid, + pkgName, tokenId); + EXPECT_FALSE(result); +} } // namespace DistributedHardware } // namespace OHOS diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index b405c21c9..a12e0cfdc 100644 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -474,7 +474,10 @@ ohos_unittest("UTTest_device_manager_service") { ohos_unittest("UTTest_dm_softbus_cache") { module_out_path = module_out_path - sources = [ "UTTest_dm_softbus_cache.cpp" ] + sources = [ + "mock/softbus_center_mock.cpp", + "UTTest_dm_softbus_cache.cpp" + ] deps = [ ":device_manager_test_common" ] diff --git a/test/unittest/UTTest_auth_negotiate.cpp b/test/unittest/UTTest_auth_negotiate.cpp index 8bc9f6123..c1a8ddabc 100644 --- a/test/unittest/UTTest_auth_negotiate.cpp +++ b/test/unittest/UTTest_auth_negotiate.cpp @@ -15,6 +15,7 @@ #include "device_manager_service_listener.h" #include "dm_crypto.h" +#include "dm_auth_context.h" #include "dm_auth_state.h" #include "UTTest_auth_negotiate.h" @@ -169,17 +170,20 @@ HWTEST_F(AuthNegotiateTest, AuthSinkNegotiateStateMachine_005, testing::ext::Tes accessee.SetAccesseeTokenId(456); profile.SetAccesser(accesser); profile.SetAccessee(accessee); + profile.SetBindLevel(1); JsonObject credIdJson; credIdJson[FILED_CRED_TYPE] = DM_POINT_TO_POINT; std::vector appList = {"123", "456"}; credIdJson[FILED_AUTHORIZED_APP_LIST] = appList; + credIdJson[FILED_AUTHORIZED_SCOPE] = DM_AUTH_SCOPE_USER; JsonObject credInfo; std::string test_cred_id = "123"; credInfo.Insert(test_cred_id, credIdJson); bool checkResult = false; authState->CheckCredIdInAclForP2P(context, test_cred_id, profile, credInfo, DM_POINT_TO_POINT, checkResult); + GTEST_LOG_(INFO) << "checkResult=" << checkResult; EXPECT_TRUE(checkResult); } diff --git a/test/unittest/UTTest_dm_softbus_cache.cpp b/test/unittest/UTTest_dm_softbus_cache.cpp index 46167427a..8f35ee466 100644 --- a/test/unittest/UTTest_dm_softbus_cache.cpp +++ b/test/unittest/UTTest_dm_softbus_cache.cpp @@ -65,20 +65,17 @@ void DMSoftbusCacheTest::TearDown() void DMSoftbusCacheTest::SetUpTestCase() { + SoftbusCenterInterface::softbusCenterInterface_ = softbusCenterMock_; } void DMSoftbusCacheTest::TearDownTestCase() { + SoftbusCenterInterface::softbusCenterInterface_ = nullptr; + softbusCenterMock_ = nullptr; } namespace { -bool CheckSoftbusRes(int32_t ret) -{ - return ret == SOFTBUS_INVALID_PARAM || ret == SOFTBUS_NETWORK_NOT_INIT || ret == SOFTBUS_NETWORK_LOOPER_ERR || - ret == SOFTBUS_IPC_ERR || ret == ERR_DM_FAILED || ret == SOFTBUS_NETWORK_GET_NODE_INFO_ERR; -} - HWTEST_F(DMSoftbusCacheTest, GetDeviceInfoFromCache_001, testing::ext::TestSize.Level1) { DmDeviceInfo deviceInfo = { @@ -86,20 +83,18 @@ HWTEST_F(DMSoftbusCacheTest, GetDeviceInfoFromCache_001, testing::ext::TestSize. .deviceName = "deviceNameTest", .deviceTypeId = 1 }; - { std::lock_guard mutexLock(SoftbusCache::GetInstance().deviceInfosMutex_); + SoftbusCache::GetInstance().deviceInfo_.clear(); SoftbusCache::GetInstance().deviceInfo_["udid"] = std::pair("uuid", deviceInfo); } - std::string networkId = "networkidc08647073e02e7a78f09473aa122ff57fc81c00"; - strncpy_s(deviceInfo.networkId, DM_MAX_DEVICE_ID_LEN, networkId.c_str(), networkId.length()); - { - std::lock_guard mutexLock(SoftbusCache::GetInstance().deviceInfosMutex_); - SoftbusCache::GetInstance().deviceInfo_["udid1"] = std::pair("uuid1", deviceInfo); - } DeviceManagerService::GetInstance().softbusListener_ = std::make_shared(); DeviceManagerService::GetInstance().UninitSoftbusListener(); EXPECT_EQ(DeviceManagerService::GetInstance().softbusListener_, nullptr); + std::vector deviceInfoList; + int32_t ret = SoftbusCache::GetInstance().GetDeviceInfoFromCache(deviceInfoList); + EXPECT_EQ(ret, DM_OK); + SoftbusCache::GetInstance().DeleteDeviceInfo(); } HWTEST_F(DMSoftbusCacheTest, CheckIsOnline_001, testing::ext::TestSize.Level1) @@ -109,13 +104,14 @@ HWTEST_F(DMSoftbusCacheTest, CheckIsOnline_001, testing::ext::TestSize.Level1) .deviceName = "deviceNameTest", .deviceTypeId = 1, }; - { std::lock_guard mutexLock(SoftbusCache::GetInstance().deviceInfosMutex_); + SoftbusCache::GetInstance().deviceInfo_.clear(); SoftbusCache::GetInstance().deviceInfo_["udid"] = std::pair("uuid", deviceInfo); } - EXPECT_EQ(SoftbusCache::GetInstance().CheckIsOnline("deviceIdTest"), true); - EXPECT_EQ(SoftbusCache::GetInstance().CheckIsOnline("deviceIdTest1"), false); + EXPECT_TRUE(SoftbusCache::GetInstance().CheckIsOnline("deviceIdTest")); + EXPECT_FALSE(SoftbusCache::GetInstance().CheckIsOnline("deviceIdTest1")); + SoftbusCache::GetInstance().DeleteDeviceInfo(); } HWTEST_F(DMSoftbusCacheTest, GetUuidByUdid_001, testing::ext::TestSize.Level1) @@ -126,15 +122,18 @@ HWTEST_F(DMSoftbusCacheTest, GetUuidByUdid_001, testing::ext::TestSize.Level1) .deviceTypeId = 1, .networkId = "networkid" }; - { std::lock_guard mutexLock(SoftbusCache::GetInstance().deviceInfosMutex_); + SoftbusCache::GetInstance().deviceInfo_.clear(); SoftbusCache::GetInstance().deviceInfo_["udid"] = std::pair("uuid", deviceInfo); } std::string uuid = ""; EXPECT_EQ(SoftbusCache::GetInstance().GetUuidByUdid("udid", uuid), DM_OK); - int32_t ret = SoftbusCache::GetInstance().GetUuidByUdid("test", uuid); - EXPECT_EQ(true, CheckSoftbusRes(ret)); + EXPECT_EQ(uuid, "uuid"); + uuid = ""; + EXPECT_NE(SoftbusCache::GetInstance().GetUuidByUdid("test", uuid), DM_OK); + EXPECT_TRUE(uuid.empty()); + SoftbusCache::GetInstance().DeleteDeviceInfo(); } HWTEST_F(DMSoftbusCacheTest, GetNetworkIdFromCache_001, testing::ext::TestSize.Level1) @@ -145,15 +144,18 @@ HWTEST_F(DMSoftbusCacheTest, GetNetworkIdFromCache_001, testing::ext::TestSize.L .deviceTypeId = 1, .networkId = "networkid" }; - { std::lock_guard mutexLock(SoftbusCache::GetInstance().deviceInfosMutex_); + SoftbusCache::GetInstance().deviceInfo_.clear(); SoftbusCache::GetInstance().deviceInfo_["udid"] = std::pair("uuid", deviceInfo); } std::string networkId = ""; EXPECT_EQ(SoftbusCache::GetInstance().GetNetworkIdFromCache("udid", networkId), DM_OK); - int32_t ret = SoftbusCache::GetInstance().GetNetworkIdFromCache("test", networkId); - EXPECT_EQ(true, CheckSoftbusRes(ret)); + EXPECT_EQ(networkId, deviceInfo.networkId); + networkId = ""; + EXPECT_NE(SoftbusCache::GetInstance().GetNetworkIdFromCache("test", networkId), DM_OK); + EXPECT_TRUE(networkId.empty()); + SoftbusCache::GetInstance().DeleteDeviceInfo(); } HWTEST_F(DMSoftbusCacheTest, GetUdidByUdidHash_001, testing::ext::TestSize.Level1) @@ -167,12 +169,16 @@ HWTEST_F(DMSoftbusCacheTest, GetUdidByUdidHash_001, testing::ext::TestSize.Level { std::lock_guard mutexLock(SoftbusCache::GetInstance().deviceInfosMutex_); + SoftbusCache::GetInstance().deviceInfo_.clear(); SoftbusCache::GetInstance().deviceInfo_["udid"] = std::pair("uuid", deviceInfo); } std::string udid = ""; EXPECT_EQ(SoftbusCache::GetInstance().GetUdidByUdidHash("deviceIdTest", udid), DM_OK); - int32_t ret = SoftbusCache::GetInstance().GetUdidByUdidHash("test", udid); - EXPECT_EQ(true, CheckSoftbusRes(ret)); + EXPECT_EQ(udid, "udid"); + udid = ""; + EXPECT_NE(SoftbusCache::GetInstance().GetUdidByUdidHash("test", udid), DM_OK); + EXPECT_TRUE(udid.empty()); + SoftbusCache::GetInstance().DeleteDeviceInfo(); } HWTEST_F(DMSoftbusCacheTest, GetDevInfoByNetworkId_001, testing::ext::TestSize.Level1) @@ -183,26 +189,36 @@ HWTEST_F(DMSoftbusCacheTest, GetDevInfoByNetworkId_001, testing::ext::TestSize.L .deviceTypeId = 1, .networkId = "networkid" }; - { std::lock_guard mutexLock(SoftbusCache::GetInstance().deviceInfosMutex_); + SoftbusCache::GetInstance().deviceInfo_.clear(); SoftbusCache::GetInstance().deviceInfo_["udid"] = std::pair("uuid", deviceInfo); } DmDeviceInfo nodeInfo; EXPECT_EQ(SoftbusCache::GetInstance().GetDevInfoByNetworkId("networkid", nodeInfo), DM_OK); + EXPECT_CALL(*softbusCenterMock_, GetAllNodeDeviceInfo(_, _, _)).Times(::testing::AtLeast(1)) + .WillOnce(Return(ERR_DM_FAILED)); + EXPECT_NE(SoftbusCache::GetInstance().GetDevInfoByNetworkId("test", nodeInfo), DM_OK); + SoftbusCache::GetInstance().DeleteDeviceInfo(); } HWTEST_F(DMSoftbusCacheTest, GetSecurityDeviceLevel_001, testing::ext::TestSize.Level1) { { std::lock_guard mutexLock(SoftbusCache::GetInstance().deviceSecurityLevelMutex_); + SoftbusCache::GetInstance().deviceSecurityLevel_.clear(); SoftbusCache::GetInstance().deviceSecurityLevel_["networkid"] = 1; } int32_t securityLevel = 0; EXPECT_EQ(SoftbusCache::GetInstance().GetSecurityDeviceLevel("networkid", securityLevel), DM_OK); EXPECT_EQ(securityLevel, 1); - int32_t ret = SoftbusCache::GetInstance().GetSecurityDeviceLevel("test", securityLevel); - EXPECT_EQ(true, CheckSoftbusRes(ret)); + EXPECT_CALL(*softbusCenterMock_, GetNodeKeyInfo(_, _, _, _, _)).Times(::testing::AtLeast(1)) + .WillOnce(Return(ERR_DM_FAILED)); + EXPECT_NE(SoftbusCache::GetInstance().GetSecurityDeviceLevel("test", securityLevel), DM_OK); + { + std::lock_guard mutexLock(SoftbusCache::GetInstance().deviceSecurityLevelMutex_); + SoftbusCache::GetInstance().deviceSecurityLevel_.clear(); + } } HWTEST_F(DMSoftbusCacheTest, GetUuidFromCache_001, testing::ext::TestSize.Level1) @@ -231,6 +247,7 @@ HWTEST_F(DMSoftbusCacheTest, GetUuidFromCache_001, testing::ext::TestSize.Level1 std::string uuid = ""; EXPECT_EQ(SoftbusCache::GetInstance().GetUuidFromCache("networkid", uuid), DM_OK); EXPECT_EQ(uuid, "uuid"); + SoftbusCache::GetInstance().DeleteDeviceInfo(); } HWTEST_F(DMSoftbusCacheTest, GetUdidFromCache_001, testing::ext::TestSize.Level1) @@ -244,13 +261,15 @@ HWTEST_F(DMSoftbusCacheTest, GetUdidFromCache_001, testing::ext::TestSize.Level1 { std::lock_guard mutexLock(SoftbusCache::GetInstance().deviceInfosMutex_); + SoftbusCache::GetInstance().deviceInfo_.clear(); SoftbusCache::GetInstance().deviceInfo_["udid"] = std::pair("uuid", deviceInfo); } std::string udid = ""; EXPECT_EQ(SoftbusCache::GetInstance().GetUdidFromCache("networkid", udid), DM_OK); EXPECT_EQ(udid, "udid"); - int32_t ret = SoftbusCache::GetInstance().GetUdidFromCache("test", udid); - EXPECT_NE(CheckSoftbusRes(ret), true); + EXPECT_CALL(*softbusCenterMock_, GetNodeKeyInfo(_, _, _, _, _)).WillOnce(Return(ERR_DM_FAILED)); + EXPECT_NE(SoftbusCache::GetInstance().GetUdidFromCache("test", udid), DM_OK); + SoftbusCache::GetInstance().DeleteDeviceInfo(); } } // namespace } // namespace DistributedHardware diff --git a/test/unittest/UTTest_dm_softbus_cache.h b/test/unittest/UTTest_dm_softbus_cache.h index 997023803..0bd52ced9 100644 --- a/test/unittest/UTTest_dm_softbus_cache.h +++ b/test/unittest/UTTest_dm_softbus_cache.h @@ -22,11 +22,12 @@ #include #include +#include "common_event_support.h" #include "device_manager_service.h" -#include "device_manager_service_listener.h" #include "device_manager_service_impl.h" -#include "common_event_support.h" +#include "device_manager_service_listener.h" #include "dm_softbus_error_code.h" +#include "softbus_center_mock.h" namespace OHOS { namespace DistributedHardware { @@ -36,6 +37,7 @@ public: static void TearDownTestCase(); void SetUp(); void TearDown(); + static inline std::shared_ptr softbusCenterMock_ = std::make_shared(); }; } // namespace DistributedHardware } // namespace OHOS diff --git a/test/unittest/mock/distributed_device_profile_client_mock.cpp b/test/unittest/mock/distributed_device_profile_client_mock.cpp index c67eda3c1..6f14d36c0 100644 --- a/test/unittest/mock/distributed_device_profile_client_mock.cpp +++ b/test/unittest/mock/distributed_device_profile_client_mock.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 Huawei Device Co., Ltd. + * Copyright (c) 2023-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 @@ -96,5 +96,10 @@ int32_t DistributedDeviceProfileClient::PutBusinessEvent(const DistributedDevice { return DpDistributedDeviceProfileClient::dpDistributedDeviceProfileClient->PutBusinessEvent(event); } + +int32_t DistributedDeviceProfileClient::GetAllAclIncludeLnnAcl(std::vector& profiles) +{ + return DpDistributedDeviceProfileClient::dpDistributedDeviceProfileClient->GetAllAclIncludeLnnAcl(profiles); +} } // namespace DistributedHardware } // namespace OHOS \ No newline at end of file diff --git a/test/unittest/mock/distributed_device_profile_client_mock.h b/test/unittest/mock/distributed_device_profile_client_mock.h index 13495ff3a..7f8f45eb1 100644 --- a/test/unittest/mock/distributed_device_profile_client_mock.h +++ b/test/unittest/mock/distributed_device_profile_client_mock.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Huawei Device Co., Ltd. + * Copyright (C) 2024-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 @@ -42,6 +42,7 @@ public: int32_t pinExchangeType, LocalServiceInfo& localServiceInfo) = 0; virtual int32_t GetBusinessEvent(BusinessEvent &event) = 0; virtual int32_t PutBusinessEvent(const DistributedDeviceProfile::BusinessEvent &event) = 0; + virtual int32_t GetAllAclIncludeLnnAcl(std::vector& profiles) = 0; public: static inline std::shared_ptr dpDistributedDeviceProfileClient = nullptr; }; @@ -62,6 +63,7 @@ public: MOCK_METHOD(int32_t, GetLocalServiceInfoByBundleAndPinType, (const std::string&, int32_t, LocalServiceInfo&)); MOCK_METHOD(int32_t, GetBusinessEvent, (BusinessEvent &event)); MOCK_METHOD(int32_t, PutBusinessEvent, (const DistributedDeviceProfile::BusinessEvent &event)); + MOCK_METHOD(int32_t, GetAllAclIncludeLnnAcl, (std::vector&)); }; } } -- Gitee