1/* 2 * Copyright (c) 2022-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16#ifndef OHOS_DEVICE_MANAGER_IMPL_TEST_H 17#define OHOS_DEVICE_MANAGER_IMPL_TEST_H 18 19#include <gtest/gtest.h> 20#include <refbase.h> 21 22#include <memory> 23#include <cstdint> 24#include "mock/mock_ipc_client_proxy.h" 25#include "device_manager.h" 26#include "dm_single_instance.h" 27#include "device_manager_impl.h" 28#include "softbus_error_code.h" 29 30namespace OHOS { 31namespace DistributedHardware { 32class DeviceManagerImplTest : public testing::Test { 33public: 34 static void SetUpTestCase(); 35 static void TearDownTestCase(); 36 void SetUp(); 37 void TearDown(); 38}; 39 40class DeviceDiscoveryCallbackTest : public DiscoveryCallback { 41public: 42 DeviceDiscoveryCallbackTest() : DiscoveryCallback() {} 43 ~DeviceDiscoveryCallbackTest() {} 44 void OnDiscoverySuccess(uint16_t subscribeId) override {} 45 void OnDiscoveryFailed(uint16_t subscribeId, int32_t failedReason) override {} 46 void OnDeviceFound(uint16_t subscribeId, const DmDeviceInfo &deviceInfo) override {} 47 void OnDeviceFound(uint16_t subscribeId, const DmDeviceBasicInfo &deviceBasicInfo) override{} 48}; 49 50class DevicePublishCallbackTest : public PublishCallback { 51public: 52 DevicePublishCallbackTest() : PublishCallback() {} 53 virtual ~DevicePublishCallbackTest() {} 54 void OnPublishResult(int32_t publishId, int32_t failedReason) override {} 55}; 56 57class DmInitCallbackTest : public DmInitCallback { 58public: 59 DmInitCallbackTest() : DmInitCallback() {} 60 virtual ~DmInitCallbackTest() {} 61 void OnRemoteDied() override {} 62}; 63 64class DeviceStateCallbackTest : public DeviceStateCallback { 65public: 66 DeviceStateCallbackTest() : DeviceStateCallback() {} 67 virtual ~DeviceStateCallbackTest() {} 68 void OnDeviceOnline(const DmDeviceInfo &deviceInfo) override {} 69 void OnDeviceReady(const DmDeviceInfo &deviceInfo) override {} 70 void OnDeviceOffline(const DmDeviceInfo &deviceInfo) override {} 71 void OnDeviceChanged(const DmDeviceInfo &deviceInfo) override {} 72}; 73 74class DeviceManagerFaCallbackTest : public DeviceManagerUiCallback { 75public: 76 DeviceManagerFaCallbackTest() : DeviceManagerUiCallback() {} 77 virtual ~DeviceManagerFaCallbackTest() {} 78 void OnCall(const std::string ¶mJson) override {} 79}; 80 81class CredentialCallbackTest : public CredentialCallback { 82public: 83 virtual ~CredentialCallbackTest() {} 84 void OnCredentialResult(int32_t &action, const std::string &credentialResult) override {} 85}; 86 87class DeviceStatusCallbackTest : public DeviceStatusCallback { 88public: 89 ~DeviceStatusCallbackTest() {} 90 void OnDeviceOnline(const DmDeviceBasicInfo &deviceBasicInfo) override {} 91 void OnDeviceOffline(const DmDeviceBasicInfo &deviceBasicInfo) override {} 92 void OnDeviceChanged(const DmDeviceBasicInfo &deviceBasicInfo) override {} 93 void OnDeviceReady(const DmDeviceBasicInfo &deviceBasicInfo) override {} 94}; 95 96class AuthenticateCallbackTest : public AuthenticateCallback { 97public: 98 ~AuthenticateCallbackTest() 99 { 100 } 101 void OnAuthResult(const std::string &deviceId, const std::string &token, int32_t status, 102 int32_t reason) override {} 103}; 104 105class DeviceScreenStatusCallbackTest : public DeviceScreenStatusCallback { 106public: 107 ~DeviceScreenStatusCallbackTest() 108 { 109 } 110 void OnDeviceScreenStatus(const DmDeviceInfo &deviceInfo) override {} 111}; 112 113class DevTrustChangeCallbackTest : public DevTrustChangeCallback { 114public: 115 virtual ~DevTrustChangeCallbackTest() 116 { 117 } 118 void OnDeviceTrustChange(const std::string &udid, const std::string &uuid, DmAuthForm authForm) override {} 119}; 120 121class CandidateRestrictStatusCallbackTest : public CredentialAuthStatusCallback { 122public: 123 virtual ~CandidateRestrictStatusCallbackTest() 124 { 125 } 126 void OnCredentialAuthStatus(const std::string &deviceList, uint16_t deviceTypeId, int32_t errcode) override {} 127}; 128} // namespace DistributedHardware 129} // namespace OHOS 130 131#endif // OHOS_DEVICE_MANAGER_IMPL_TEST_H 132