1 /* 2 * Copyright (c) 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 COMMON_NET_CONN_CALLBACK_TEST_H 17 #define COMMON_NET_CONN_CALLBACK_TEST_H 18 19 #include "i_net_conn_callback.h" 20 #include "iremote_object.h" 21 #include "net_conn_callback_stub.h" 22 #include "net_manager_constants.h" 23 #include "net_supplier_callback_base.h" 24 #include "net_supplier_callback_stub.h" 25 26 namespace OHOS { 27 namespace NetManagerStandard { 28 class INetConnCallbackTest : public IRemoteStub<INetConnCallback> { 29 public: NetAvailable(sptr<NetHandle> & netHandle)30 int32_t NetAvailable(sptr<NetHandle> &netHandle) 31 { 32 return NETMANAGER_SUCCESS; 33 } 34 NetCapabilitiesChange(sptr<NetHandle> & netHandle,const sptr<NetAllCapabilities> & netAllCap)35 int32_t NetCapabilitiesChange(sptr<NetHandle> &netHandle, const sptr<NetAllCapabilities> &netAllCap) 36 { 37 return NETMANAGER_SUCCESS; 38 } 39 NetConnectionPropertiesChange(sptr<NetHandle> & netHandle,const sptr<NetLinkInfo> & info)40 int32_t NetConnectionPropertiesChange(sptr<NetHandle> &netHandle, const sptr<NetLinkInfo> &info) 41 { 42 return NETMANAGER_SUCCESS; 43 } 44 NetLost(sptr<NetHandle> & netHandle)45 int32_t NetLost(sptr<NetHandle> &netHandle) 46 { 47 return NETMANAGER_SUCCESS; 48 } 49 NetUnavailable()50 int32_t NetUnavailable() 51 { 52 return NETMANAGER_SUCCESS; 53 } 54 NetBlockStatusChange(sptr<NetHandle> & netHandle,bool blocked)55 int32_t NetBlockStatusChange(sptr<NetHandle> &netHandle, bool blocked) 56 { 57 return NETMANAGER_SUCCESS; 58 } 59 }; 60 61 class NetSupplierCallbackBaseTestCb : public NetSupplierCallbackBase { 62 public: 63 virtual ~NetSupplierCallbackBaseTestCb() = default; 64 RequestNetwork(const std::string & ident,const std::set<NetCap> & netCaps)65 int32_t RequestNetwork(const std::string &ident, const std::set<NetCap> &netCaps) override 66 { 67 return NETMANAGER_SUCCESS; 68 }; 69 ReleaseNetwork(const std::string & ident,const std::set<NetCap> & netCaps)70 int32_t ReleaseNetwork(const std::string &ident, const std::set<NetCap> &netCaps) override 71 { 72 return NETMANAGER_SUCCESS; 73 }; 74 }; 75 76 class NetSupplierCallbackStubTestCb : public NetSupplierCallbackStub { 77 public: 78 NetSupplierCallbackStubTestCb() = default; ~NetSupplierCallbackStubTestCb()79 ~NetSupplierCallbackStubTestCb() {} 80 RequestNetwork(const std::string & ident,const std::set<NetCap> & netCaps)81 int32_t RequestNetwork(const std::string &ident, const std::set<NetCap> &netCaps) override 82 { 83 return NETMANAGER_SUCCESS; 84 } 85 ReleaseNetwork(const std::string & ident,const std::set<NetCap> & netCaps)86 int32_t ReleaseNetwork(const std::string &ident, const std::set<NetCap> &netCaps) override 87 { 88 return NETMANAGER_SUCCESS; 89 } 90 }; 91 92 class NetConnCallbackStubCb : public NetConnCallbackStub { NetAvailable(sptr<NetHandle> & netHandle)93 int32_t NetAvailable(sptr<NetHandle> &netHandle) override 94 { 95 return NETMANAGER_SUCCESS; 96 } 97 NetCapabilitiesChange(sptr<NetHandle> & netHandle,const sptr<NetAllCapabilities> & netAllCap)98 int32_t NetCapabilitiesChange(sptr<NetHandle> &netHandle, const sptr<NetAllCapabilities> &netAllCap) override 99 { 100 return NETMANAGER_SUCCESS; 101 } 102 NetConnectionPropertiesChange(sptr<NetHandle> & netHandle,const sptr<NetLinkInfo> & info)103 int32_t NetConnectionPropertiesChange(sptr<NetHandle> &netHandle, const sptr<NetLinkInfo> &info) override 104 { 105 return NETMANAGER_SUCCESS; 106 } 107 NetLost(sptr<NetHandle> & netHandle)108 int32_t NetLost(sptr<NetHandle> &netHandle) override 109 { 110 return NETMANAGER_SUCCESS; 111 } 112 NetUnavailable()113 int32_t NetUnavailable() override 114 { 115 return NETMANAGER_SUCCESS; 116 } 117 NetBlockStatusChange(sptr<NetHandle> & netHandle,bool blocked)118 int32_t NetBlockStatusChange(sptr<NetHandle> &netHandle, bool blocked) override 119 { 120 return NETMANAGER_SUCCESS; 121 } 122 }; 123 } // namespace NetManagerStandard 124 } // namespace OHOS 125 #endif // COMMON_NET_CONN_CALLBACK_TEST_H 126