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