From 8234b9c5d6c1701db7bb1a65418045b26f110423 Mon Sep 17 00:00:00 2001 From: zhouyan Date: Thu, 25 Aug 2022 18:58:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=AF=E6=80=BB=E7=BA=BF=E4=B8=8EDM=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E4=B8=8A=E4=B8=8B=E7=BA=BF=E5=BD=92=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhouyan Change-Id: I55385847ab8ad1916987e10002412fd672e743e3 --- .../test/mock/src/soft_bus_center_mock.cpp | 33 ------------------- 1 file changed, 33 deletions(-) diff --git a/services/tokensyncmanager/test/mock/src/soft_bus_center_mock.cpp b/services/tokensyncmanager/test/mock/src/soft_bus_center_mock.cpp index 42045285b..946472495 100644 --- a/services/tokensyncmanager/test/mock/src/soft_bus_center_mock.cpp +++ b/services/tokensyncmanager/test/mock/src/soft_bus_center_mock.cpp @@ -26,45 +26,12 @@ static constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, SECURITY_DOMAIN_ static const int REG_COUNT_LIMIT = 10; } // namespace static int regCount_ = -1; -static INodeStateCb *callback_ = nullptr; bool IsRegCountOK() { return regCount_ >= 0 && regCount_ < REG_COUNT_LIMIT; } -int32_t RegNodeDeviceStateCb(const char *pkgName, INodeStateCb *callback) -{ - regCount_++; - // reg:0-9 - if (IsRegCountOK()) { - callback_ = const_cast(callback); - ACCESSTOKEN_LOG_DEBUG(LABEL, "success, pkg:%{public}s, count: %{public}d", pkgName, regCount_); - return Constant::SUCCESS; - } - - // count 10 above alway return failure for retry. - ACCESSTOKEN_LOG_DEBUG(LABEL, "failure, count: %{public}d", regCount_); - return Constant::FAILURE; -} - -int32_t UnregNodeDeviceStateCb(INodeStateCb *callback) -{ - // unreg: 0-9 - if (IsRegCountOK()) { - regCount_--; - callback_ = nullptr; - ACCESSTOKEN_LOG_DEBUG(LABEL, "success, count: %{public}d", regCount_); - return Constant::SUCCESS; - } - - if (regCount_ >= 0) { - regCount_--; - } - ACCESSTOKEN_LOG_DEBUG(LABEL, "failure, count: %{public}d", regCount_); - return Constant::SUCCESS; -} - int32_t GetLocalNodeDeviceInfo(const char *pkgName, NodeBasicInfo *info) { strcpy_s(info->deviceName, sizeof(info->deviceName), "local"); -- Gitee