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_IMPL_TEST_H 1779a732c7Sopenharmony_ci#define OHOS_DEVICE_MANAGER_IMPL_TEST_H 1879a732c7Sopenharmony_ci 1979a732c7Sopenharmony_ci#include <gtest/gtest.h> 2079a732c7Sopenharmony_ci#include <refbase.h> 2179a732c7Sopenharmony_ci 2279a732c7Sopenharmony_ci#include <memory> 2379a732c7Sopenharmony_ci#include <cstdint> 2479a732c7Sopenharmony_ci#include "mock/mock_ipc_client_proxy.h" 2579a732c7Sopenharmony_ci#include "device_manager.h" 2679a732c7Sopenharmony_ci#include "dm_single_instance.h" 2779a732c7Sopenharmony_ci#include "device_manager_impl.h" 2879a732c7Sopenharmony_ci#include "softbus_error_code.h" 2979a732c7Sopenharmony_ci 3079a732c7Sopenharmony_cinamespace OHOS { 3179a732c7Sopenharmony_cinamespace DistributedHardware { 3279a732c7Sopenharmony_ciclass DeviceManagerImplTest : public testing::Test { 3379a732c7Sopenharmony_cipublic: 3479a732c7Sopenharmony_ci static void SetUpTestCase(); 3579a732c7Sopenharmony_ci static void TearDownTestCase(); 3679a732c7Sopenharmony_ci void SetUp(); 3779a732c7Sopenharmony_ci void TearDown(); 3879a732c7Sopenharmony_ci}; 3979a732c7Sopenharmony_ci 4079a732c7Sopenharmony_ciclass DeviceDiscoveryCallbackTest : public DiscoveryCallback { 4179a732c7Sopenharmony_cipublic: 4279a732c7Sopenharmony_ci DeviceDiscoveryCallbackTest() : DiscoveryCallback() {} 4379a732c7Sopenharmony_ci ~DeviceDiscoveryCallbackTest() {} 4479a732c7Sopenharmony_ci void OnDiscoverySuccess(uint16_t subscribeId) override {} 4579a732c7Sopenharmony_ci void OnDiscoveryFailed(uint16_t subscribeId, int32_t failedReason) override {} 4679a732c7Sopenharmony_ci void OnDeviceFound(uint16_t subscribeId, const DmDeviceInfo &deviceInfo) override {} 4779a732c7Sopenharmony_ci void OnDeviceFound(uint16_t subscribeId, const DmDeviceBasicInfo &deviceBasicInfo) override{} 4879a732c7Sopenharmony_ci}; 4979a732c7Sopenharmony_ci 5079a732c7Sopenharmony_ciclass DevicePublishCallbackTest : public PublishCallback { 5179a732c7Sopenharmony_cipublic: 5279a732c7Sopenharmony_ci DevicePublishCallbackTest() : PublishCallback() {} 5379a732c7Sopenharmony_ci virtual ~DevicePublishCallbackTest() {} 5479a732c7Sopenharmony_ci void OnPublishResult(int32_t publishId, int32_t failedReason) override {} 5579a732c7Sopenharmony_ci}; 5679a732c7Sopenharmony_ci 5779a732c7Sopenharmony_ciclass DmInitCallbackTest : public DmInitCallback { 5879a732c7Sopenharmony_cipublic: 5979a732c7Sopenharmony_ci DmInitCallbackTest() : DmInitCallback() {} 6079a732c7Sopenharmony_ci virtual ~DmInitCallbackTest() {} 6179a732c7Sopenharmony_ci void OnRemoteDied() override {} 6279a732c7Sopenharmony_ci}; 6379a732c7Sopenharmony_ci 6479a732c7Sopenharmony_ciclass DeviceStateCallbackTest : public DeviceStateCallback { 6579a732c7Sopenharmony_cipublic: 6679a732c7Sopenharmony_ci DeviceStateCallbackTest() : DeviceStateCallback() {} 6779a732c7Sopenharmony_ci virtual ~DeviceStateCallbackTest() {} 6879a732c7Sopenharmony_ci void OnDeviceOnline(const DmDeviceInfo &deviceInfo) override {} 6979a732c7Sopenharmony_ci void OnDeviceReady(const DmDeviceInfo &deviceInfo) override {} 7079a732c7Sopenharmony_ci void OnDeviceOffline(const DmDeviceInfo &deviceInfo) override {} 7179a732c7Sopenharmony_ci void OnDeviceChanged(const DmDeviceInfo &deviceInfo) override {} 7279a732c7Sopenharmony_ci}; 7379a732c7Sopenharmony_ci 7479a732c7Sopenharmony_ciclass DeviceManagerFaCallbackTest : public DeviceManagerUiCallback { 7579a732c7Sopenharmony_cipublic: 7679a732c7Sopenharmony_ci DeviceManagerFaCallbackTest() : DeviceManagerUiCallback() {} 7779a732c7Sopenharmony_ci virtual ~DeviceManagerFaCallbackTest() {} 7879a732c7Sopenharmony_ci void OnCall(const std::string ¶mJson) override {} 7979a732c7Sopenharmony_ci}; 8079a732c7Sopenharmony_ci 8179a732c7Sopenharmony_ciclass CredentialCallbackTest : public CredentialCallback { 8279a732c7Sopenharmony_cipublic: 8379a732c7Sopenharmony_ci virtual ~CredentialCallbackTest() {} 8479a732c7Sopenharmony_ci void OnCredentialResult(int32_t &action, const std::string &credentialResult) override {} 8579a732c7Sopenharmony_ci}; 8679a732c7Sopenharmony_ci 8779a732c7Sopenharmony_ciclass DeviceStatusCallbackTest : public DeviceStatusCallback { 8879a732c7Sopenharmony_cipublic: 8979a732c7Sopenharmony_ci ~DeviceStatusCallbackTest() {} 9079a732c7Sopenharmony_ci void OnDeviceOnline(const DmDeviceBasicInfo &deviceBasicInfo) override {} 9179a732c7Sopenharmony_ci void OnDeviceOffline(const DmDeviceBasicInfo &deviceBasicInfo) override {} 9279a732c7Sopenharmony_ci void OnDeviceChanged(const DmDeviceBasicInfo &deviceBasicInfo) override {} 9379a732c7Sopenharmony_ci void OnDeviceReady(const DmDeviceBasicInfo &deviceBasicInfo) override {} 9479a732c7Sopenharmony_ci}; 9579a732c7Sopenharmony_ci 9679a732c7Sopenharmony_ciclass AuthenticateCallbackTest : public AuthenticateCallback { 9779a732c7Sopenharmony_cipublic: 9879a732c7Sopenharmony_ci ~AuthenticateCallbackTest() 9979a732c7Sopenharmony_ci { 10079a732c7Sopenharmony_ci } 10179a732c7Sopenharmony_ci void OnAuthResult(const std::string &deviceId, const std::string &token, int32_t status, 10279a732c7Sopenharmony_ci int32_t reason) override {} 10379a732c7Sopenharmony_ci}; 10479a732c7Sopenharmony_ci 10579a732c7Sopenharmony_ciclass DeviceScreenStatusCallbackTest : public DeviceScreenStatusCallback { 10679a732c7Sopenharmony_cipublic: 10779a732c7Sopenharmony_ci ~DeviceScreenStatusCallbackTest() 10879a732c7Sopenharmony_ci { 10979a732c7Sopenharmony_ci } 11079a732c7Sopenharmony_ci void OnDeviceScreenStatus(const DmDeviceInfo &deviceInfo) override {} 11179a732c7Sopenharmony_ci}; 11279a732c7Sopenharmony_ci 11379a732c7Sopenharmony_ciclass DevTrustChangeCallbackTest : public DevTrustChangeCallback { 11479a732c7Sopenharmony_cipublic: 11579a732c7Sopenharmony_ci virtual ~DevTrustChangeCallbackTest() 11679a732c7Sopenharmony_ci { 11779a732c7Sopenharmony_ci } 11879a732c7Sopenharmony_ci void OnDeviceTrustChange(const std::string &udid, const std::string &uuid, DmAuthForm authForm) override {} 11979a732c7Sopenharmony_ci}; 12079a732c7Sopenharmony_ci 12179a732c7Sopenharmony_ciclass CandidateRestrictStatusCallbackTest : public CredentialAuthStatusCallback { 12279a732c7Sopenharmony_cipublic: 12379a732c7Sopenharmony_ci virtual ~CandidateRestrictStatusCallbackTest() 12479a732c7Sopenharmony_ci { 12579a732c7Sopenharmony_ci } 12679a732c7Sopenharmony_ci void OnCredentialAuthStatus(const std::string &deviceList, uint16_t deviceTypeId, int32_t errcode) override {} 12779a732c7Sopenharmony_ci}; 12879a732c7Sopenharmony_ci} // namespace DistributedHardware 12979a732c7Sopenharmony_ci} // namespace OHOS 13079a732c7Sopenharmony_ci 13179a732c7Sopenharmony_ci#endif // OHOS_DEVICE_MANAGER_IMPL_TEST_H 132