• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 ESIM_CORE_SERVICE_STUB_TEST_H
17 #define ESIM_CORE_SERVICE_STUB_TEST_H
18 
19 #include "i_core_service.h"
20 #include "core_service_stub.h"
21 
22 #include "gmock/gmock.h"
23 
24 #define private public
25 #define protected public
26 
27 namespace OHOS {
28 namespace Telephony {
29 class MockCoreServiceStub : public CoreServiceStub {
30 public:
31     MockCoreServiceStub() = default;
~MockCoreServiceStub()32     ~MockCoreServiceStub() override {};
33 
GetPsRadioTech(int32_t slotId,int32_t & psRadioTech)34     int32_t GetPsRadioTech(int32_t slotId, int32_t &psRadioTech) override
35     {
36         return 0;
37     }
38 
GetCsRadioTech(int32_t slotId,int32_t & csRadioTech)39     int32_t GetCsRadioTech(int32_t slotId, int32_t &csRadioTech) override
40     {
41         return 0;
42     }
43 
GetOperatorNumeric(int32_t slotId)44     std::u16string GetOperatorNumeric(int32_t slotId) override
45     {
46         return u"";
47     }
48 
GetResidentNetworkNumeric(int32_t slotId)49     std::string GetResidentNetworkNumeric(int32_t slotId) override
50     {
51         return "";
52     }
53 
GetOperatorName(int32_t slotId,std::u16string & operatorName)54     int32_t GetOperatorName(int32_t slotId, std::u16string &operatorName) override
55     {
56         return 0;
57     }
58 
GetSignalInfoList(int32_t slotId,std::vector<sptr<SignalInformation>> & signals)59     int32_t GetSignalInfoList(int32_t slotId, std::vector<sptr<SignalInformation>> &signals) override
60     {
61         return 0;
62     }
63 
GetNetworkState(int32_t slotId,sptr<NetworkState> & networkState)64     int32_t GetNetworkState(int32_t slotId, sptr<NetworkState> &networkState) override
65     {
66         return 0;
67     }
68 
SetRadioState(int32_t slotId,bool isOn,const sptr<INetworkSearchCallback> & callback)69     int32_t SetRadioState(int32_t slotId, bool isOn, const sptr<INetworkSearchCallback> &callback) override
70     {
71         return 0;
72     }
73 
GetRadioState(int32_t slotId,const sptr<INetworkSearchCallback> & callback)74     int32_t GetRadioState(int32_t slotId, const sptr<INetworkSearchCallback> &callback) override
75     {
76         return 0;
77     }
78 
GetImei(int32_t slotId,std::u16string & imei)79     int32_t GetImei(int32_t slotId, std::u16string &imei) override
80     {
81         return 0;
82     }
83 
GetImeiSv(int32_t slotId,std::u16string & imeiSv)84     int32_t GetImeiSv(int32_t slotId, std::u16string &imeiSv) override
85     {
86         return 0;
87     }
88 
GetMeid(int32_t slotId,std::u16string & meid)89     int32_t GetMeid(int32_t slotId, std::u16string &meid) override
90     {
91         return 0;
92     }
93 
GetUniqueDeviceId(int32_t slotId,std::u16string & deviceId)94     int32_t GetUniqueDeviceId(int32_t slotId, std::u16string &deviceId) override
95     {
96         return 0;
97     }
98 
IsNrSupported(int32_t slotId)99     bool IsNrSupported(int32_t slotId) override
100     {
101         return true;
102     }
103 
SetNrOptionMode(int32_t slotId,int32_t mode,const sptr<INetworkSearchCallback> & callback)104     int32_t SetNrOptionMode(int32_t slotId, int32_t mode, const sptr<INetworkSearchCallback> &callback) override
105     {
106         return 0;
107     }
108 
GetNrOptionMode(int32_t slotId,const sptr<INetworkSearchCallback> & callback)109     int32_t GetNrOptionMode(int32_t slotId, const sptr<INetworkSearchCallback> &callback) override
110     {
111         return 0;
112     }
113 
HasSimCard(int32_t slotId,bool & hasSimCard)114     int32_t HasSimCard(int32_t slotId, bool &hasSimCard) override
115     {
116         return 0;
117     }
118 
GetSimState(int32_t slotId,SimState & simState)119     int32_t GetSimState(int32_t slotId, SimState &simState) override
120     {
121         return 0;
122     }
123 
GetDsdsMode(int32_t & dsdsMode)124     int32_t GetDsdsMode(int32_t &dsdsMode) override
125     {
126         return 0;
127     }
128 
GetCardType(int32_t slotId,CardType & cardType)129     int32_t GetCardType(int32_t slotId, CardType &cardType) override
130     {
131         return 0;
132     }
133 
UnlockPin(int32_t slotId,const std::u16string & pin,LockStatusResponse & response)134     int32_t UnlockPin(int32_t slotId, const std::u16string &pin, LockStatusResponse &response) override
135     {
136         return 0;
137     }
138 
UnlockPuk(int32_t slotId,const std::u16string & newPin,const std::u16string & puk,LockStatusResponse & response)139     int32_t UnlockPuk(
140         int32_t slotId, const std::u16string &newPin, const std::u16string &puk, LockStatusResponse &response) override
141     {
142         return 0;
143     }
144 
AlterPin(int32_t slotId,const std::u16string & newPin,const std::u16string & oldPin,LockStatusResponse & response)145     int32_t AlterPin(int32_t slotId, const std::u16string &newPin,
146         const std::u16string &oldPin, LockStatusResponse &response) override
147     {
148         return 0;
149     }
150 
UnlockPin2(int32_t slotId,const std::u16string & pin2,LockStatusResponse & response)151     int32_t UnlockPin2(int32_t slotId, const std::u16string &pin2, LockStatusResponse &response) override
152     {
153         return 0;
154     }
155 
UnlockPuk2(int32_t slotId,const std::u16string & newPin2,const std::u16string & puk2,LockStatusResponse & response)156     int32_t UnlockPuk2(int32_t slotId, const std::u16string &newPin2,
157         const std::u16string &puk2, LockStatusResponse &response) override
158     {
159         return 0;
160     }
161 
AlterPin2(int32_t slotId,const std::u16string & newPin2,const std::u16string & oldPin2,LockStatusResponse & response)162     int32_t AlterPin2(int32_t slotId, const std::u16string &newPin2,
163         const std::u16string &oldPin2, LockStatusResponse &response) override
164     {
165         return 0;
166     }
167 
SetLockState(int32_t slotId,const LockInfo & options,LockStatusResponse & response)168     int32_t SetLockState(int32_t slotId, const LockInfo &options, LockStatusResponse &response) override
169     {
170         return 0;
171     }
172 
GetLockState(int32_t slotId,LockType lockType,LockState & lockState)173     int32_t GetLockState(int32_t slotId, LockType lockType, LockState &lockState) override
174     {
175         return 0;
176     }
177 
GetSimOperatorNumeric(int32_t slotId,std::u16string & operatorNumeric)178     int32_t GetSimOperatorNumeric(int32_t slotId, std::u16string &operatorNumeric) override
179     {
180         return 0;
181     }
182 
GetISOCountryCodeForSim(int32_t slotId,std::u16string & countryCode)183     int32_t GetISOCountryCodeForSim(int32_t slotId, std::u16string &countryCode) override
184     {
185         return 0;
186     }
187 
GetSimSpn(int32_t slotId,std::u16string & spn)188     int32_t GetSimSpn(int32_t slotId, std::u16string &spn) override
189     {
190         return 0;
191     }
192 
GetSimIccId(int32_t slotId,std::u16string & iccId)193     int32_t GetSimIccId(int32_t slotId, std::u16string &iccId) override
194     {
195         return 0;
196     }
197 
GetIMSI(int32_t slotId,std::u16string & imsi)198     int32_t GetIMSI(int32_t slotId, std::u16string &imsi) override
199     {
200         return 0;
201     }
202 
IsCTSimCard(int32_t slotId,bool & isCTSimCard)203     int32_t IsCTSimCard(int32_t slotId, bool &isCTSimCard) override
204     {
205         return 0;
206     }
207 
IsSimActive(int32_t slotId)208     bool IsSimActive(int32_t slotId) override
209     {
210         return true;
211     }
212 
GetSlotId(int32_t simId)213     int32_t GetSlotId(int32_t simId) override
214     {
215         return 0;
216     }
217 
GetSimId(int32_t slotId)218     int32_t GetSimId(int32_t slotId) override
219     {
220         return 0;
221     }
222 
GetNetworkSearchInformation(int32_t slotId,const sptr<INetworkSearchCallback> & callback)223     int32_t GetNetworkSearchInformation(int32_t slotId, const sptr<INetworkSearchCallback> &callback) override
224     {
225         return 0;
226     }
227 
GetNetworkSelectionMode(int32_t slotId,const sptr<INetworkSearchCallback> & callback)228     int32_t GetNetworkSelectionMode(int32_t slotId, const sptr<INetworkSearchCallback> &callback) override
229     {
230         return 0;
231     }
232 
GetLocaleFromDefaultSim()233     std::u16string GetLocaleFromDefaultSim() override
234     {
235         return 0;
236     }
237 
GetSimGid1(int32_t slotId,std::u16string & gid1)238     int32_t GetSimGid1(int32_t slotId, std::u16string &gid1) override
239     {
240         return 0;
241     }
242 
GetSimGid2(int32_t slotId)243     std::u16string GetSimGid2(int32_t slotId) override
244     {
245         return u"";
246     }
247 
GetSimEons(int32_t slotId,const std::string & plmn,int32_t lac,bool longNameRequired)248     std::u16string GetSimEons(int32_t slotId, const std::string &plmn, int32_t lac, bool longNameRequired) override
249     {
250         return u"";
251     }
252 
SetNetworkSelectionMode(int32_t slotId,int32_t selectMode,const sptr<NetworkInformation> & networkInformation,bool resumeSelection,const sptr<INetworkSearchCallback> & callback)253     int32_t SetNetworkSelectionMode(int32_t slotId, int32_t selectMode,
254         const sptr<NetworkInformation> &networkInformation, bool resumeSelection,
255         const sptr<INetworkSearchCallback> &callback) override
256     {
257         return 0;
258     }
259 
GetIsoCountryCodeForNetwork(int32_t slotId,std::u16string & countryCode)260     int32_t GetIsoCountryCodeForNetwork(int32_t slotId, std::u16string &countryCode) override
261     {
262         return 0;
263     }
264 
GetSimAccountInfo(int32_t slotId,IccAccountInfo & info)265     int32_t GetSimAccountInfo(int32_t slotId, IccAccountInfo &info) override
266     {
267         return 0;
268     }
269 
SetDefaultVoiceSlotId(int32_t slotId)270     int32_t SetDefaultVoiceSlotId(int32_t slotId) override
271     {
272         return 0;
273     }
274 
GetDefaultVoiceSlotId()275     int32_t GetDefaultVoiceSlotId() override
276     {
277         return 0;
278     }
279 
GetDefaultVoiceSimId(int32_t & simId)280     int32_t GetDefaultVoiceSimId(int32_t &simId) override
281     {
282         return 0;
283     }
284 
SetPrimarySlotId(int32_t slotId)285     int32_t SetPrimarySlotId(int32_t slotId) override
286     {
287         return 0;
288     }
289 
GetPrimarySlotId(int32_t & slotId)290     int32_t GetPrimarySlotId(int32_t &slotId) override
291     {
292         return 0;
293     }
294 
SetShowNumber(int32_t slotId,const std::u16string & number)295     int32_t SetShowNumber(int32_t slotId, const std::u16string &number) override
296     {
297         return 0;
298     }
299 
GetShowNumber(int32_t slotId,std::u16string & showNumber)300     int32_t GetShowNumber(int32_t slotId, std::u16string &showNumber) override
301     {
302         return 0;
303     }
304 
SetShowName(int32_t slotId,const std::u16string & name)305     int32_t SetShowName(int32_t slotId, const std::u16string &name) override
306     {
307         return 0;
308     }
309 
GetShowName(int32_t slotId,std::u16string & showName)310     int32_t GetShowName(int32_t slotId, std::u16string &showName) override
311     {
312         return 0;
313     }
314 
GetActiveSimAccountInfoList(std::vector<IccAccountInfo> & iccAccountInfoList)315     int32_t GetActiveSimAccountInfoList(std::vector<IccAccountInfo> &iccAccountInfoList) override
316     {
317         return 0;
318     }
319 
GetOperatorConfigs(int32_t slotId,OperatorConfig & poc)320     int32_t GetOperatorConfigs(int32_t slotId, OperatorConfig &poc) override
321     {
322         return 0;
323     }
324 
RefreshSimState(int32_t slotId)325     int32_t RefreshSimState(int32_t slotId) override
326     {
327         return 0;
328     }
329 
SetActiveSim(int32_t slotId,int32_t enable)330     int32_t SetActiveSim(int32_t slotId, int32_t enable) override
331     {
332         return 0;
333     }
334 
GetPreferredNetwork(int32_t slotId,const sptr<INetworkSearchCallback> & callback)335     int32_t GetPreferredNetwork(int32_t slotId, const sptr<INetworkSearchCallback> &callback) override
336     {
337         return 0;
338     }
339 
SetPreferredNetwork(int32_t slotId,int32_t networkMode,const sptr<INetworkSearchCallback> & callback)340     int32_t SetPreferredNetwork(
341         int32_t slotId, int32_t networkMode, const sptr<INetworkSearchCallback> &callback) override
342     {
343         return 0;
344     }
345 
GetNetworkCapability(int32_t slotId,int32_t networkCapabilityType,int32_t & networkCapabilityState)346     int32_t GetNetworkCapability(
347         int32_t slotId, int32_t networkCapabilityType, int32_t &networkCapabilityState) override
348     {
349         return 0;
350     }
351 
SetNetworkCapability(int32_t slotId,int32_t networkCapabilityType,int32_t networkCapabilityState)352     int32_t SetNetworkCapability(
353         int32_t slotId, int32_t networkCapabilityType, int32_t networkCapabilityState) override
354     {
355         return 0;
356     }
357 
GetSimTelephoneNumber(int32_t slotId,std::u16string & telephoneNumber)358     int32_t GetSimTelephoneNumber(int32_t slotId, std::u16string &telephoneNumber) override
359     {
360         return 0;
361     }
362 
GetSimTeleNumberIdentifier(const int32_t slotId)363     std::u16string GetSimTeleNumberIdentifier(const int32_t slotId) override
364     {
365         return u"";
366     }
367 
GetVoiceMailIdentifier(int32_t slotId,std::u16string & voiceMailIdentifier)368     int32_t GetVoiceMailIdentifier(int32_t slotId, std::u16string &voiceMailIdentifier) override
369     {
370         return 0;
371     }
372 
GetVoiceMailNumber(int32_t slotId,std::u16string & voiceMailNumber)373     int32_t GetVoiceMailNumber(int32_t slotId, std::u16string &voiceMailNumber) override
374     {
375         return 0;
376     }
377 
GetVoiceMailCount(int32_t slotId,int32_t & voiceMailCount)378     int32_t GetVoiceMailCount(int32_t slotId, int32_t &voiceMailCount) override
379     {
380         return 0;
381     }
382 
SetVoiceMailCount(int32_t slotId,int32_t voiceMailCount)383     int32_t SetVoiceMailCount(int32_t slotId, int32_t voiceMailCount) override
384     {
385         return 0;
386     }
387 
SetVoiceCallForwarding(int32_t slotId,bool enable,const std::string & number)388     int32_t SetVoiceCallForwarding(int32_t slotId, bool enable, const std::string &number) override
389     {
390         return 0;
391     }
392 
QueryIccDiallingNumbers(int slotId,int type,std::vector<std::shared_ptr<DiallingNumbersInfo>> & result)393     int32_t QueryIccDiallingNumbers(
394         int slotId, int type, std::vector<std::shared_ptr<DiallingNumbersInfo>> &result) override
395     {
396         return 0;
397     }
398 
AddIccDiallingNumbers(int slotId,int type,const std::shared_ptr<DiallingNumbersInfo> & diallingNumber)399     int32_t AddIccDiallingNumbers(
400         int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber) override
401     {
402         return 0;
403     }
404 
DelIccDiallingNumbers(int slotId,int type,const std::shared_ptr<DiallingNumbersInfo> & diallingNumber)405     int32_t DelIccDiallingNumbers(
406         int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber) override
407     {
408         return 0;
409     }
410 
UpdateIccDiallingNumbers(int slotId,int type,const std::shared_ptr<DiallingNumbersInfo> & diallingNumber)411     int32_t UpdateIccDiallingNumbers(
412         int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber) override
413     {
414         return 0;
415     }
416 
SetVoiceMailInfo(const int32_t slotId,const std::u16string & mailName,const std::u16string & mailNumber)417     int32_t SetVoiceMailInfo(
418         const int32_t slotId, const std::u16string &mailName, const std::u16string &mailNumber) override
419     {
420         return 0;
421     }
422 
GetImsRegStatus(int32_t slotId,ImsServiceType imsSrvType,ImsRegInfo & info)423     int32_t GetImsRegStatus(int32_t slotId, ImsServiceType imsSrvType, ImsRegInfo &info) override
424     {
425         return 0;
426     }
427 
GetMaxSimCount()428     int32_t GetMaxSimCount() override
429     {
430         return 0;
431     }
432 
GetOpKey(int32_t slotId,std::u16string & opkey)433     int32_t GetOpKey(int32_t slotId, std::u16string &opkey) override
434     {
435         return 0;
436     }
437 
GetOpKeyExt(int32_t slotId,std::u16string & opkeyExt)438     int32_t GetOpKeyExt(int32_t slotId, std::u16string &opkeyExt) override
439     {
440         return 0;
441     }
442 
GetOpName(int32_t slotId,std::u16string & opname)443     int32_t GetOpName(int32_t slotId, std::u16string &opname) override
444     {
445         return 0;
446     }
447 
SendEnvelopeCmd(int32_t slotId,const std::string & cmd)448     int32_t SendEnvelopeCmd(int32_t slotId, const std::string &cmd) override
449     {
450         return 0;
451     }
452 
SendTerminalResponseCmd(int32_t slotId,const std::string & cmd)453     int32_t SendTerminalResponseCmd(int32_t slotId, const std::string &cmd) override
454     {
455         return 0;
456     }
457 
SendCallSetupRequestResult(int32_t slotId,bool accept)458     int32_t SendCallSetupRequestResult(int32_t slotId, bool accept) override
459     {
460         return 0;
461     }
462 
UnlockSimLock(int32_t slotId,const PersoLockInfo & lockInfo,LockStatusResponse & response)463     int32_t UnlockSimLock(int32_t slotId, const PersoLockInfo &lockInfo, LockStatusResponse &response) override
464     {
465         return 0;
466     }
467 
GetCellInfoList(int32_t slotId,std::vector<sptr<CellInformation>> & cellInfo)468     int32_t GetCellInfoList(int32_t slotId, std::vector<sptr<CellInformation>> &cellInfo) override
469     {
470         return 0;
471     }
472 
GetNeighboringCellInfoList(int32_t slotId,std::vector<sptr<CellInformation>> & cellInfo)473     int32_t GetNeighboringCellInfoList(int32_t slotId, std::vector<sptr<CellInformation>> &cellInfo) override
474     {
475         return 0;
476     }
477 
SendUpdateCellLocationRequest(int32_t slotId)478     int32_t SendUpdateCellLocationRequest(int32_t slotId) override
479     {
480         return 0;
481     }
482 
HasOperatorPrivileges(const int32_t slotId,bool & hasOperatorPrivileges)483     int32_t HasOperatorPrivileges(const int32_t slotId, bool &hasOperatorPrivileges) override
484     {
485         return 0;
486     }
487 
SimAuthentication(int32_t slotId,AuthType authType,const std::string & authData,SimAuthenticationResponse & response)488     int32_t SimAuthentication(
489         int32_t slotId, AuthType authType, const std::string &authData, SimAuthenticationResponse &response) override
490     {
491         return 0;
492     }
493 
RegisterImsRegInfoCallback(int32_t slotId,ImsServiceType imsSrvType,const sptr<ImsRegInfoCallback> & callback)494     int32_t RegisterImsRegInfoCallback(
495         int32_t slotId, ImsServiceType imsSrvType, const sptr<ImsRegInfoCallback> &callback) override
496     {
497         return 0;
498     }
499 
UnregisterImsRegInfoCallback(int32_t slotId,ImsServiceType imsSrvType)500     int32_t UnregisterImsRegInfoCallback(int32_t slotId, ImsServiceType imsSrvType) override
501     {
502         return 0;
503     }
504 
GetBasebandVersion(int32_t slotId,std::string & version)505     int32_t GetBasebandVersion(int32_t slotId, std::string &version) override
506     {
507         return 0;
508     }
509 
FactoryReset(int32_t slotId)510     int32_t FactoryReset(int32_t slotId) override
511     {
512         return 0;
513     }
514 
GetNrSsbIdInfo(int32_t slotId,const std::shared_ptr<NrSsbInformation> & nrSsbInformation)515     int32_t GetNrSsbIdInfo(int32_t slotId, const std::shared_ptr<NrSsbInformation> &nrSsbInformation) override
516     {
517         return 0;
518     }
519 
IsAllowedInsertApn(std::string & value)520     bool IsAllowedInsertApn(std::string &value) override
521     {
522         return true;
523     }
524 
GetTargetOpkey(int32_t slotId,std::u16string & opkey)525     int32_t GetTargetOpkey(int32_t slotId, std::u16string &opkey) override
526     {
527         return 0;
528     }
529 
GetOpkeyVersion(std::string & versionInfo)530     int32_t GetOpkeyVersion(std::string &versionInfo) override
531     {
532         return 0;
533     }
534 
GetSimIO(int32_t slotId,int32_t command,int32_t fileId,const std::string & data,const std::string & path,SimAuthenticationResponse & response)535     int32_t GetSimIO(int32_t slotId, int32_t command,
536         int32_t fileId, const std::string &data, const std::string &path, SimAuthenticationResponse &response) override
537     {
538         return 0;
539     }
540 
SetActiveSimSatellite(int32_t slotId,int32_t enable)541     int32_t SetActiveSimSatellite(int32_t slotId, int32_t enable) override
542     {
543         return 0;
544     }
545 
GetOpnameVersion(std::string & versionInfo)546     int32_t GetOpnameVersion(std::string &versionInfo) override
547     {
548         return 0;
549     }
550 
SendApduData(int32_t slotId,const std::u16string & aid,const EsimApduData & apduData,ResponseEsimResult & responseResult)551     int32_t SendApduData(int32_t slotId, const std::u16string &aid,
552         const EsimApduData &apduData, ResponseEsimResult &responseResult) override
553     {
554         return 0;
555     }
556 };
557 } // namespace Telephony
558 } // namespace OHOS
559 #endif // ESIM_CORE_SERVICE_STUB_TEST_H