179a732c7Sopenharmony_ci/* 279a732c7Sopenharmony_ci * Copyright (c) 2022-2024 Huawei Device Co., Ltd. 379a732c7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 479a732c7Sopenharmony_ci * you may not use this file except in compliance with the License. 579a732c7Sopenharmony_ci * You may obtain a copy of the License at 679a732c7Sopenharmony_ci * 779a732c7Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 879a732c7Sopenharmony_ci * 979a732c7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1079a732c7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1179a732c7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1279a732c7Sopenharmony_ci * See the License for the specific language governing permissions and 1379a732c7Sopenharmony_ci * limitations under the License. 1479a732c7Sopenharmony_ci */ 1579a732c7Sopenharmony_ci 1679a732c7Sopenharmony_ci#ifndef OHOS_DEVICE_MANAGER_NOTIFY_TEST_H 1779a732c7Sopenharmony_ci#define OHOS_DEVICE_MANAGER_NOTIFY_TEST_H 1879a732c7Sopenharmony_ci 1979a732c7Sopenharmony_ci#include <gtest/gtest.h> 2079a732c7Sopenharmony_ci#include <mutex> 2179a732c7Sopenharmony_ci#include <map> 2279a732c7Sopenharmony_ci#include <vector> 2379a732c7Sopenharmony_ci#include <string> 2479a732c7Sopenharmony_ci#include <memory> 2579a732c7Sopenharmony_ci#include <list> 2679a732c7Sopenharmony_ci 2779a732c7Sopenharmony_ci#include "dm_device_info.h" 2879a732c7Sopenharmony_ci#include "dm_subscribe_info.h" 2979a732c7Sopenharmony_ci#include "device_manager_callback.h" 3079a732c7Sopenharmony_ci#include "dm_single_instance.h" 3179a732c7Sopenharmony_cinamespace OHOS { 3279a732c7Sopenharmony_cinamespace DistributedHardware { 3379a732c7Sopenharmony_ciclass DeviceManagerNotifyTest : public testing::Test { 3479a732c7Sopenharmony_cipublic: 3579a732c7Sopenharmony_ci static void SetUpTestCase(); 3679a732c7Sopenharmony_ci static void TearDownTestCase(); 3779a732c7Sopenharmony_ci void SetUp(); 3879a732c7Sopenharmony_ci void TearDown(); 3979a732c7Sopenharmony_ci}; 4079a732c7Sopenharmony_ci 4179a732c7Sopenharmony_ciclass DmInitCallbackTest : public DmInitCallback { 4279a732c7Sopenharmony_cipublic: 4379a732c7Sopenharmony_ci explicit DmInitCallbackTest(int &count); 4479a732c7Sopenharmony_ci virtual ~DmInitCallbackTest() {} 4579a732c7Sopenharmony_ci void OnRemoteDied() override; 4679a732c7Sopenharmony_ciprivate: 4779a732c7Sopenharmony_ci int *count_ = nullptr; 4879a732c7Sopenharmony_ci}; 4979a732c7Sopenharmony_ci 5079a732c7Sopenharmony_ciclass DeviceStateCallbackTest : public DeviceStateCallback { 5179a732c7Sopenharmony_cipublic: 5279a732c7Sopenharmony_ci explicit DeviceStateCallbackTest(int &count); 5379a732c7Sopenharmony_ci virtual ~DeviceStateCallbackTest() {} 5479a732c7Sopenharmony_ci void OnDeviceOnline(const DmDeviceInfo &deviceInfo) override; 5579a732c7Sopenharmony_ci void OnDeviceReady(const DmDeviceInfo &deviceInfo) override; 5679a732c7Sopenharmony_ci void OnDeviceOffline(const DmDeviceInfo &deviceInfo) override; 5779a732c7Sopenharmony_ci void OnDeviceChanged(const DmDeviceInfo &deviceInfo) override; 5879a732c7Sopenharmony_ciprivate: 5979a732c7Sopenharmony_ci int *count_ = nullptr; 6079a732c7Sopenharmony_ci}; 6179a732c7Sopenharmony_ci 6279a732c7Sopenharmony_ciclass DiscoveryCallbackTest : public DiscoveryCallback { 6379a732c7Sopenharmony_cipublic: 6479a732c7Sopenharmony_ci explicit DiscoveryCallbackTest(int &count); 6579a732c7Sopenharmony_ci virtual ~DiscoveryCallbackTest() {} 6679a732c7Sopenharmony_ci void OnDiscoverySuccess(uint16_t subscribeId) override; 6779a732c7Sopenharmony_ci void OnDiscoveryFailed(uint16_t subscribeId, int32_t failedReason) override; 6879a732c7Sopenharmony_ci void OnDeviceFound(uint16_t subscribeId, const DmDeviceInfo &deviceInfo) override; 6979a732c7Sopenharmony_ciprivate: 7079a732c7Sopenharmony_ci int *count_ = nullptr; 7179a732c7Sopenharmony_ci}; 7279a732c7Sopenharmony_ci 7379a732c7Sopenharmony_ciclass PublishCallbackTest : public PublishCallback { 7479a732c7Sopenharmony_cipublic: 7579a732c7Sopenharmony_ci explicit PublishCallbackTest(int &count); 7679a732c7Sopenharmony_ci virtual ~PublishCallbackTest() {} 7779a732c7Sopenharmony_ci void OnPublishResult(int32_t publishId, int32_t failedReason) override; 7879a732c7Sopenharmony_ciprivate: 7979a732c7Sopenharmony_ci int *count_ = nullptr; 8079a732c7Sopenharmony_ci}; 8179a732c7Sopenharmony_ci 8279a732c7Sopenharmony_ciclass AuthenticateCallbackTest : public AuthenticateCallback { 8379a732c7Sopenharmony_cipublic: 8479a732c7Sopenharmony_ci explicit AuthenticateCallbackTest(int &count); 8579a732c7Sopenharmony_ci virtual ~AuthenticateCallbackTest() {} 8679a732c7Sopenharmony_ci void OnAuthResult(const std::string &deviceId, const std::string &token, int32_t status, 8779a732c7Sopenharmony_ci int32_t reason) override; 8879a732c7Sopenharmony_ciprivate: 8979a732c7Sopenharmony_ci int *count_ = nullptr; 9079a732c7Sopenharmony_ci}; 9179a732c7Sopenharmony_ci 9279a732c7Sopenharmony_ciclass DeviceManagerFaCallbackTest : public DeviceManagerUiCallback { 9379a732c7Sopenharmony_cipublic: 9479a732c7Sopenharmony_ci explicit DeviceManagerFaCallbackTest(int &count); 9579a732c7Sopenharmony_ci virtual ~DeviceManagerFaCallbackTest() {} 9679a732c7Sopenharmony_ci void OnCall(const std::string ¶mJson) override; 9779a732c7Sopenharmony_ciprivate: 9879a732c7Sopenharmony_ci int *count_ = nullptr; 9979a732c7Sopenharmony_ci}; 10079a732c7Sopenharmony_ci 10179a732c7Sopenharmony_ciclass CredentialCallbackTest : public CredentialCallback { 10279a732c7Sopenharmony_cipublic: 10379a732c7Sopenharmony_ci void OnCredentialResult(int32_t &action, const std::string &credentialResult) override {} 10479a732c7Sopenharmony_ci}; 10579a732c7Sopenharmony_ci 10679a732c7Sopenharmony_ciclass DeviceStatusCallbackTest : public DeviceStatusCallback { 10779a732c7Sopenharmony_cipublic: 10879a732c7Sopenharmony_ci void OnDeviceOnline(const DmDeviceBasicInfo &deviceBasicInfo) override {} 10979a732c7Sopenharmony_ci void OnDeviceOffline(const DmDeviceBasicInfo &deviceBasicInfo) override {} 11079a732c7Sopenharmony_ci void OnDeviceChanged(const DmDeviceBasicInfo &deviceBasicInfo) override {} 11179a732c7Sopenharmony_ci void OnDeviceReady(const DmDeviceBasicInfo &deviceBasicInfo) override {} 11279a732c7Sopenharmony_ci}; 11379a732c7Sopenharmony_ci 11479a732c7Sopenharmony_ciclass PinHolderCallbackTest : public PinHolderCallback { 11579a732c7Sopenharmony_cipublic: 11679a732c7Sopenharmony_ci void OnPinHolderCreate(const std::string &deviceId, DmPinType pinType, const std::string &payload) {} 11779a732c7Sopenharmony_ci void OnPinHolderDestroy(DmPinType pinType, const std::string &payload) {} 11879a732c7Sopenharmony_ci void OnCreateResult(int32_t result) {} 11979a732c7Sopenharmony_ci void OnDestroyResult(int32_t result) {} 12079a732c7Sopenharmony_ci void OnPinHolderEvent(DmPinHolderEvent event, int32_t result, const std::string &content) {} 12179a732c7Sopenharmony_ci}; 12279a732c7Sopenharmony_ci} // namespace DistributedHardware 12379a732c7Sopenharmony_ci} // namespace OHOS 12479a732c7Sopenharmony_ci 12579a732c7Sopenharmony_ci#endif // OHOS_DEVICE_MANAGER_NOTIFY_TEST_H 126