1 /* 2 * Copyright (C) 2025 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_I_CORE_SERVICE_H 17 #define MOCK_I_CORE_SERVICE_H 18 19 #include <gtest/gtest.h> 20 #include <gmock/gmock.h> 21 #include "i_core_service.h" 22 23 namespace OHOS { 24 namespace Telephony { 25 26 class MockICoreService : public ICoreService { 27 public: 28 MOCK_METHOD(sptr<IRemoteObject>, AsObject, (), (override)); 29 MOCK_METHOD(int32_t, GetPsRadioTech, (int32_t slotId, int32_t &psRadioTech), (override)); 30 MOCK_METHOD(int32_t, GetCsRadioTech, (int32_t slotId, int32_t &csRadioTech), (override)); 31 MOCK_METHOD(std::u16string, GetOperatorNumeric, (int32_t slotId), (override)); 32 MOCK_METHOD(std::string, GetResidentNetworkNumeric, (int32_t slotId), (override)); 33 MOCK_METHOD(int32_t, GetOperatorName, (int32_t slotId, std::u16string &operatorName), (override)); 34 MOCK_METHOD(int32_t, GetSignalInfoList, (int32_t slotId, 35 std::vector<sptr<SignalInformation>> &signals), (override)); 36 MOCK_METHOD(int32_t, GetNetworkState, (int32_t slotId, sptr<NetworkState> &networkState), (override)); 37 MOCK_METHOD(int32_t, SetRadioState, (int32_t slotId, bool isOn, 38 const sptr<INetworkSearchCallback> &callback), (override)); 39 MOCK_METHOD(int32_t, GetRadioState, (int32_t slotId, const sptr<INetworkSearchCallback> &callback), (override)); 40 MOCK_METHOD(int32_t, GetImei, (int32_t slotId, const sptr<IRawParcelCallback> &callback), (override)); 41 MOCK_METHOD(int32_t, GetImeiSv, (int32_t slotId, const sptr<IRawParcelCallback> &callback), (override)); 42 MOCK_METHOD(int32_t, GetMeid, (int32_t slotId, std::u16string &meid), (override)); 43 MOCK_METHOD(int32_t, GetUniqueDeviceId, (int32_t slotId, std::u16string &deviceId), (override)); 44 MOCK_METHOD(bool, IsNrSupported, (int32_t slotId), (override)); 45 MOCK_METHOD(int32_t, SetNrOptionMode, (int32_t slotId, int32_t mode, 46 const sptr<INetworkSearchCallback> &callback), (override)); 47 MOCK_METHOD(int32_t, GetNrOptionMode, (int32_t slotId, const sptr<INetworkSearchCallback> &callback), (override)); 48 MOCK_METHOD(int32_t, HasSimCard, (int32_t slotId, const sptr<IRawParcelCallback> &callback), (override)); 49 MOCK_METHOD(int32_t, GetSimState, (int32_t slotId, const sptr<IRawParcelCallback> &callback), (override)); 50 MOCK_METHOD(int32_t, GetDsdsMode, (int32_t &dsdsMode), (override)); 51 MOCK_METHOD(int32_t, GetCardType, (int32_t slotId, CardType &cardType), (override)); 52 MOCK_METHOD(int32_t, UnlockPin, (int32_t slotId, const std::u16string &pin, 53 const sptr<IRawParcelCallback> &callback), (override)); 54 MOCK_METHOD(int32_t, UnlockPuk, (int32_t slotId, const std::u16string &newPin, 55 const std::u16string &puk, const sptr<IRawParcelCallback> &callback), (override)); 56 MOCK_METHOD(int32_t, AlterPin, (int32_t slotId, const std::u16string &newPin, 57 const std::u16string &oldPin, const sptr<IRawParcelCallback> &callback), (override)); 58 MOCK_METHOD(int32_t, UnlockPin2, (int32_t slotId, const std::u16string &pin2, 59 const sptr<IRawParcelCallback> &callback), (override)); 60 MOCK_METHOD(int32_t, UnlockPuk2, (int32_t slotId, const std::u16string &newPin2, 61 const std::u16string &puk2, const sptr<IRawParcelCallback> &callback), (override)); 62 MOCK_METHOD(int32_t, AlterPin2, (int32_t slotId, const std::u16string &newPin2, 63 const std::u16string &oldPin2, const sptr<IRawParcelCallback> &callback), (override)); 64 MOCK_METHOD(int32_t, SetLockState, (int32_t slotId, const LockInfo &options, 65 const sptr<IRawParcelCallback> &callback), (override)); 66 MOCK_METHOD(int32_t, GetLockState, (int32_t slotId, LockType lockType, 67 const sptr<IRawParcelCallback> &callback), (override)); 68 MOCK_METHOD(int32_t, GetSimOperatorNumeric, (int32_t slotId, std::u16string &operatorNumeric), (override)); 69 MOCK_METHOD(int32_t, GetISOCountryCodeForSim, (int32_t slotId, std::u16string &countryCode), (override)); 70 MOCK_METHOD(int32_t, GetSimSpn, (int32_t slotId, std::u16string &spn), (override)); 71 MOCK_METHOD(int32_t, GetSimIccId, (int32_t slotId, std::u16string &iccId), (override)); 72 MOCK_METHOD(int32_t, GetIMSI, (int32_t slotId, std::u16string &imsi), (override)); 73 MOCK_METHOD(int32_t, IsCTSimCard, (int32_t slotId, const sptr<IRawParcelCallback> &callback), (override)); 74 MOCK_METHOD(bool, IsSimActive, (int32_t slotId, const sptr<IRawParcelCallback> &callback), (override)); 75 MOCK_METHOD(int32_t, GetSlotId, (int32_t simId), (override)); 76 MOCK_METHOD(int32_t, GetSimId, (int32_t slotId), (override)); 77 MOCK_METHOD(int32_t, GetNetworkSearchInformation, (int32_t slotId, 78 const sptr<INetworkSearchCallback> &callback), (override)); 79 MOCK_METHOD(int32_t, GetNetworkSelectionMode, (int32_t slotId, 80 const sptr<INetworkSearchCallback> &callback), (override)); 81 MOCK_METHOD(std::u16string, GetLocaleFromDefaultSim, (), (override)); 82 MOCK_METHOD(int32_t, GetSimGid1, (int32_t slotId, std::u16string &gid1), (override)); 83 MOCK_METHOD(std::u16string, GetSimGid2, (int32_t slotId), (override)); 84 MOCK_METHOD(std::u16string, GetSimEons, (int32_t slotId, const std::string &plmn, 85 int32_t lac, bool longNameRequired), (override)); 86 MOCK_METHOD(int32_t, SetNetworkSelectionMode, (int32_t slotId, int32_t selectMode, 87 const sptr<NetworkInformation> &networkInformation, bool resumeSelection, 88 const sptr<INetworkSearchCallback> &callback), (override)); 89 MOCK_METHOD(int32_t, GetIsoCountryCodeForNetwork, (int32_t slotId, std::u16string &countryCode), (override)); 90 MOCK_METHOD(int32_t, GetSimAccountInfo, (int32_t slotId, IccAccountInfo &info), (override)); 91 MOCK_METHOD(int32_t, SetDefaultVoiceSlotId, (int32_t slotId), (override)); 92 MOCK_METHOD(int32_t, GetDefaultVoiceSlotId, (), (override)); 93 MOCK_METHOD(int32_t, GetDefaultVoiceSimId, (const sptr<IRawParcelCallback> &callback), (override)); 94 MOCK_METHOD(int32_t, SetPrimarySlotId, (int32_t slotId), (override)); 95 MOCK_METHOD(int32_t, GetPrimarySlotId, (int32_t &slotId), (override)); 96 MOCK_METHOD(int32_t, SetShowNumber, (int32_t slotId, const std::u16string &number, 97 const sptr<IRawParcelCallback> &callback), (override)); 98 MOCK_METHOD(int32_t, GetShowNumber, (int32_t slotId, const sptr<IRawParcelCallback> &callback), (override)); 99 MOCK_METHOD(int32_t, SetShowName, (int32_t slotId, const std::u16string &name, 100 const sptr<IRawParcelCallback> &callback), (override)); 101 MOCK_METHOD(int32_t, GetShowName, (int32_t slotId, const sptr<IRawParcelCallback> &callback), (override)); 102 MOCK_METHOD(int32_t, GetActiveSimAccountInfoList, (std::vector<IccAccountInfo> &iccAccountInfoList), (override)); 103 MOCK_METHOD(int32_t, GetOperatorConfigs, (int32_t slotId, OperatorConfig &poc), (override)); 104 MOCK_METHOD(int32_t, RefreshSimState, (int32_t slotId), (override)); 105 MOCK_METHOD(int32_t, SetActiveSim, (int32_t slotId, int32_t enable), (override)); 106 MOCK_METHOD(int32_t, SetActiveSimSatellite, (int32_t slotId, int32_t enable), (override)); 107 MOCK_METHOD(int32_t, GetPreferredNetwork, (int32_t slotId, 108 const sptr<INetworkSearchCallback> &callback), (override)); 109 MOCK_METHOD(int32_t, SetPreferredNetwork, (int32_t slotId, int32_t networkMode, 110 const sptr<INetworkSearchCallback> &callback), (override)); 111 MOCK_METHOD(int32_t, GetNetworkCapability, (int32_t slotId, int32_t networkCapabilityType, 112 int32_t &networkCapabilityState), (override)); 113 MOCK_METHOD(int32_t, SetNetworkCapability, (int32_t slotId, int32_t networkCapabilityType, 114 int32_t networkCapabilityState), (override)); 115 MOCK_METHOD(int32_t, GetSimTelephoneNumber, (int32_t slotId, std::u16string &telephoneNumber), (override)); 116 MOCK_METHOD(std::u16string, GetSimTeleNumberIdentifier, (const int32_t slotId), (override)); 117 MOCK_METHOD(int32_t, GetVoiceMailIdentifier, (int32_t slotId, std::u16string &voiceMailIdentifier), (override)); 118 MOCK_METHOD(int32_t, GetVoiceMailNumber, (int32_t slotId, std::u16string &voiceMailNumber), (override)); 119 MOCK_METHOD(int32_t, GetVoiceMailCount, (int32_t slotId, int32_t &voiceMailCount), (override)); 120 MOCK_METHOD(int32_t, SetVoiceMailCount, (int32_t slotId, int32_t voiceMailCount), (override)); 121 MOCK_METHOD(int32_t, SetVoiceCallForwarding, (int32_t slotId, bool enable, const std::string &number), (override)); 122 MOCK_METHOD(int32_t, QueryIccDiallingNumbers, (int slotId, int type, 123 std::vector<std::shared_ptr<DiallingNumbersInfo>> &result), (override)); 124 MOCK_METHOD(int32_t, AddIccDiallingNumbers, (int slotId, int type, 125 const std::shared_ptr<DiallingNumbersInfo> &diallingNumber), (override)); 126 MOCK_METHOD(int32_t, DelIccDiallingNumbers, (int slotId, int type, 127 const std::shared_ptr<DiallingNumbersInfo> &diallingNumber), (override)); 128 MOCK_METHOD(int32_t, UpdateIccDiallingNumbers, (int slotId, int type, 129 const std::shared_ptr<DiallingNumbersInfo> &diallingNumber), (override)); 130 MOCK_METHOD(int32_t, SetVoiceMailInfo, (const int32_t slotId, const std::u16string &mailName, 131 const std::u16string &mailNumber), (override)); 132 MOCK_METHOD(int32_t, GetImsRegStatus, (int32_t slotId, ImsServiceType imsSrvType, ImsRegInfo &info), (override)); 133 MOCK_METHOD(int32_t, GetMaxSimCount, (), (override)); 134 MOCK_METHOD(int32_t, GetOpKey, (int32_t slotId, std::u16string &opkey), (override)); 135 MOCK_METHOD(int32_t, GetOpKeyExt, (int32_t slotId, std::u16string &opkeyExt), (override)); 136 MOCK_METHOD(int32_t, GetOpName, (int32_t slotId, std::u16string &opname), (override)); 137 MOCK_METHOD(int32_t, SendEnvelopeCmd, (int32_t slotId, const std::string &cmd), (override)); 138 MOCK_METHOD(int32_t, SendTerminalResponseCmd, (int32_t slotId, const std::string &cmd), (override)); 139 MOCK_METHOD(int32_t, SendCallSetupRequestResult, (int32_t slotId, bool accept), (override)); 140 MOCK_METHOD(int32_t, UnlockSimLock, (int32_t slotId, const PersoLockInfo &lockInfo, 141 LockStatusResponse &response), (override)); 142 MOCK_METHOD(int32_t, GetCellInfoList, (int32_t slotId, std::vector<sptr<CellInformation>> &cellInfo), (override)); 143 MOCK_METHOD(int32_t, GetNeighboringCellInfoList, (int32_t slotId, 144 std::vector<sptr<CellInformation>> &cellInfo), (override)); 145 MOCK_METHOD(int32_t, SendUpdateCellLocationRequest, (int32_t slotId), (override)); 146 MOCK_METHOD(int32_t, HasOperatorPrivileges, (const int32_t slotId, 147 const sptr<IRawParcelCallback> &callback), (override)); 148 MOCK_METHOD(int32_t, SimAuthentication, (int32_t slotId, AuthType authType, const std::string &authData, 149 SimAuthenticationResponse &response), (override)); 150 MOCK_METHOD(int32_t, RegisterImsRegInfoCallback, (int32_t slotId, ImsServiceType imsSrvType, 151 const sptr<ImsRegInfoCallback> &callback), (override)); 152 MOCK_METHOD(int32_t, UnregisterImsRegInfoCallback, (int32_t slotId, ImsServiceType imsSrvType), (override)); 153 MOCK_METHOD(int32_t, GetBasebandVersion, (int32_t slotId, std::string &version), (override)); 154 MOCK_METHOD(int32_t, FactoryReset, (int32_t slotId), (override)); 155 MOCK_METHOD(int32_t, GetNrSsbIdInfo, (int32_t slotId, 156 const std::shared_ptr<NrSsbInformation> &nrSsbInformation), (override)); 157 MOCK_METHOD(bool, IsAllowedInsertApn, (std::string &value), (override)); 158 MOCK_METHOD(int32_t, GetTargetOpkey, (int32_t slotId, std::u16string &opkey), (override)); 159 MOCK_METHOD(int32_t, GetOpkeyVersion, (std::string &versionInfo), (override)); 160 MOCK_METHOD(int32_t, GetOpnameVersion, (std::string &versionInfo), (override)); 161 MOCK_METHOD(int32_t, GetSimIO, (int32_t slotId, int32_t command, int32_t fileId, const std::string &data, 162 const std::string &path, SimAuthenticationResponse &response), (override)); 163 MOCK_METHOD(int32_t, GetSimLabel, (int32_t slotId, SimLabel &simLabel, const sptr<IRawParcelCallback> &callback), 164 (override)); 165 MOCK_METHOD(int32_t, GetAllSimAccountInfoList, (std::vector<IccAccountInfo> & iccAccountInfoList), (override)); 166 MOCK_METHOD(int32_t, SendApduData, (int32_t slotId, const std::u16string &aid, const EsimApduData &apduData, 167 ResponseEsimResult &responseResult), (override)); 168 }; 169 } // namespace Telephony 170 } // namespace OHOS 171 #endif // MOCK_CORE_SERVICE_H