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 MOCK_NETWORKVPN_SERVICE_STUB_TEST_H 17 #define MOCK_NETWORKVPN_SERVICE_STUB_TEST_H 18 19 #include "inetwork_vpn_service.h" 20 #include "network_vpn_service_stub.h" 21 22 namespace OHOS { 23 namespace NetManagerStandard { 24 class MockNetworkVpnServiceStub : public NetworkVpnServiceStub { 25 public: Prepare(bool & isExistVpn,bool & isRun,std::string & pkg)26 int32_t Prepare(bool &isExistVpn, bool &isRun, std::string &pkg) override 27 { 28 return 0; 29 } 30 31 int32_t SetUpVpn(const VpnConfig &config, bool isVpnExtCall = false) override 32 { 33 return 0; 34 } 35 36 int32_t Protect(bool isVpnExtCall = false) override 37 { 38 return 0; 39 } 40 41 int32_t DestroyVpn(bool isVpnExtCall = false) override 42 { 43 return 0; 44 } 45 46 #ifdef SUPPORT_SYSVPN GetVpnCertData(const int32_t certType,std::vector<int8_t> & certData)47 int32_t GetVpnCertData(const int32_t certType, std::vector<int8_t> &certData) override 48 { 49 return 0; 50 } 51 52 int32_t SetUpSysVpn(const sptr<SysVpnConfig> &config, bool isVpnExtCall = false) override 53 { 54 return 0; 55 } 56 AddSysVpnConfig(const sptr<SysVpnConfig> & config)57 int32_t AddSysVpnConfig(const sptr<SysVpnConfig> &config) override 58 { 59 return 0; 60 } 61 DeleteSysVpnConfig(const std::string & vpnId)62 int32_t DeleteSysVpnConfig(const std::string &vpnId) override 63 { 64 return 0; 65 } 66 GetSysVpnConfigList(std::vector<sptr<SysVpnConfig>> & vpnList)67 int32_t GetSysVpnConfigList(std::vector<sptr<SysVpnConfig>> &vpnList) override 68 { 69 return 0; 70 } 71 GetSysVpnConfig(sptr<SysVpnConfig> & config,const std::string & vpnId)72 int32_t GetSysVpnConfig(sptr<SysVpnConfig> &config, const std::string &vpnId) override 73 { 74 return 0; 75 } 76 GetConnectedSysVpnConfig(sptr<SysVpnConfig> & config)77 int32_t GetConnectedSysVpnConfig(sptr<SysVpnConfig> &config) override 78 { 79 return 0; 80 } 81 NotifyConnectStage(const std::string & stage,const int32_t errorCode)82 int32_t NotifyConnectStage(const std::string &stage, const int32_t errorCode) override 83 { 84 return 0; 85 } 86 GetSysVpnCertUri(const int32_t certType,std::string & certUri)87 int32_t GetSysVpnCertUri(const int32_t certType, std::string &certUri) override 88 { 89 return 0; 90 } 91 GetConnectedVpnAppInfo(std::vector<std::string> & bundleNameList)92 int32_t GetConnectedVpnAppInfo(std::vector<std::string> &bundleNameList) override 93 { 94 return 0; 95 } 96 DestroyVpn(const std::string & vpnId)97 int32_t DestroyVpn(const std::string &vpnId) override 98 { 99 return 0; 100 } 101 RegisterMultiVpnEvent(const sptr<IVpnEventCallback> & callback)102 int32_t RegisterMultiVpnEvent(const sptr<IVpnEventCallback> &callback) override 103 { 104 return 0; 105 } 106 UnregisterMultiVpnEvent(const sptr<IVpnEventCallback> & callback)107 int32_t UnregisterMultiVpnEvent(const sptr<IVpnEventCallback> &callback) override 108 { 109 return 0; 110 } 111 #endif // SUPPORT_SYSVPN 112 RegisterVpnEvent(const sptr<IVpnEventCallback> & callback)113 int32_t RegisterVpnEvent(const sptr<IVpnEventCallback>& callback) override 114 { 115 return 0; 116 } 117 UnregisterVpnEvent(const sptr<IVpnEventCallback> & callback)118 int32_t UnregisterVpnEvent(const sptr<IVpnEventCallback>& callback) override 119 { 120 return 0; 121 } 122 123 int32_t CreateVpnConnection(bool isVpnExtCall = false) override 124 { 125 return 0; 126 } 127 Dump(int32_t fd,const std::vector<std::u16string> & args)128 int32_t Dump(int32_t fd, const std::vector<std::u16string> &args) override 129 { 130 return 0; 131 } 132 FactoryResetVpn()133 int32_t FactoryResetVpn() override 134 { 135 return 0; 136 } 137 RegisterBundleName(const std::string & bundleName,const std::string & abilityName)138 int32_t RegisterBundleName(const std::string &bundleName, const std::string &abilityName) override 139 { 140 return 0; 141 } 142 GetSelfAppName(std::string & selfAppName,std::string & selfBundleName)143 int32_t GetSelfAppName(std::string &selfAppName, std::string &selfBundleName) override 144 { 145 return 0; 146 } 147 SetSelfVpnPid()148 int32_t SetSelfVpnPid() override 149 { 150 return 0; 151 } 152 }; 153 } // namespace NetManagerStandard 154 } // namespace OHOS 155 #endif // MOCK_NETWORKVPN_SERVICE_STUB_TEST_H 156