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, std::u16string &imei), (override)); 45 MOCK_METHOD(int32_t, GetImeiSv, (int32_t slotId, std::u16string &imeiSv), (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, bool &hasSimCard), (override)); 53 MOCK_METHOD(int32_t, GetSimState, (int32_t slotId, SimState &simState), (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( 57 int32_t, UnlockPin, (int32_t slotId, const std::u16string &pin, LockStatusResponse &response), (override)); 58 MOCK_METHOD(int32_t, UnlockPuk, 59 (int32_t slotId, const std::u16string &newPin, const std::u16string &puk, LockStatusResponse &response), 60 (override)); 61 MOCK_METHOD(int32_t, AlterPin, 62 (int32_t slotId, const std::u16string &newPin, const std::u16string &oldPin, LockStatusResponse &response), 63 (override)); 64 MOCK_METHOD( 65 int32_t, UnlockPin2, (int32_t slotId, const std::u16string &pin2, LockStatusResponse &response), (override)); 66 MOCK_METHOD(int32_t, UnlockPuk2, 67 (int32_t slotId, const std::u16string &newPin2, const std::u16string &puk2, LockStatusResponse &response), 68 (override)); 69 MOCK_METHOD(int32_t, AlterPin2, 70 (int32_t slotId, const std::u16string &newPin2, const std::u16string &oldPin2, LockStatusResponse &response), 71 (override)); 72 MOCK_METHOD( 73 int32_t, SetLockState, (int32_t slotId, const LockInfo &options, LockStatusResponse &response), (override)); 74 MOCK_METHOD(int32_t, GetLockState, (int32_t slotId, LockType lockType, LockState &lockState), (override)); 75 MOCK_METHOD(int32_t, GetSimOperatorNumeric, (int32_t slotId, std::u16string &operatorNumeric), (override)); 76 MOCK_METHOD(int32_t, GetISOCountryCodeForSim, (int32_t slotId, std::u16string &countryCode), (override)); 77 MOCK_METHOD(int32_t, GetSimSpn, (int32_t slotId, std::u16string &spn), (override)); 78 MOCK_METHOD(int32_t, GetSimIccId, (int32_t slotId, std::u16string &iccId), (override)); 79 MOCK_METHOD(int32_t, GetIMSI, (int32_t slotId, std::u16string &imsi), (override)); 80 MOCK_METHOD(int32_t, IsCTSimCard, (int32_t slotId, bool &isCTSimCard), (override)); 81 MOCK_METHOD(bool, IsSimActive, (int32_t slotId), (override)); 82 MOCK_METHOD(int32_t, GetSlotId, (int32_t simId), (override)); 83 MOCK_METHOD(int32_t, GetSimId, (int32_t slotId), (override)); 84 MOCK_METHOD(int32_t, GetNetworkSearchInformation, (int32_t slotId, const sptr<INetworkSearchCallback> &callback), 85 (override)); 86 MOCK_METHOD( 87 int32_t, GetNetworkSelectionMode, (int32_t slotId, const sptr<INetworkSearchCallback> &callback), (override)); 88 MOCK_METHOD(std::u16string, GetLocaleFromDefaultSim, (), (override)); 89 MOCK_METHOD(int32_t, GetSimGid1, (int32_t slotId, std::u16string &gid1), (override)); 90 MOCK_METHOD(std::u16string, GetSimGid2, (int32_t slotId), (override)); 91 MOCK_METHOD(std::u16string, GetSimEons, 92 (int32_t slotId, const std::string &plmn, int32_t lac, bool longNameRequired), (override)); 93 MOCK_METHOD(int32_t, SetNetworkSelectionMode, 94 (int32_t slotId, int32_t selectMode, const sptr<NetworkInformation> &networkInformation, bool resumeSelection, 95 const sptr<INetworkSearchCallback> &callback), 96 (override)); 97 MOCK_METHOD(int32_t, GetIsoCountryCodeForNetwork, (int32_t slotId, std::u16string &countryCode), (override)); 98 MOCK_METHOD(int32_t, GetSimAccountInfo, (int32_t slotId, IccAccountInfo &info), (override)); 99 MOCK_METHOD(int32_t, SetDefaultVoiceSlotId, (int32_t slotId), (override)); 100 MOCK_METHOD(int32_t, GetDefaultVoiceSlotId, (), (override)); 101 MOCK_METHOD(int32_t, GetDefaultVoiceSimId, (int32_t & simId), (override)); 102 MOCK_METHOD(int32_t, SetPrimarySlotId, (int32_t slotId), (override)); 103 MOCK_METHOD(int32_t, GetPrimarySlotId, (int32_t & slotId), (override)); 104 MOCK_METHOD(int32_t, SetShowNumber, (int32_t slotId, const std::u16string &number), (override)); 105 MOCK_METHOD(int32_t, GetShowNumber, (int32_t slotId, std::u16string &showNumber), (override)); 106 MOCK_METHOD(int32_t, SetShowName, (int32_t slotId, const std::u16string &name), (override)); 107 MOCK_METHOD(int32_t, GetShowName, (int32_t slotId, std::u16string &showName), (override)); 108 MOCK_METHOD(int32_t, GetActiveSimAccountInfoList, (std::vector<IccAccountInfo> & iccAccountInfoList), (override)); 109 MOCK_METHOD(int32_t, GetOperatorConfigs, (int32_t slotId, OperatorConfig &poc), (override)); 110 MOCK_METHOD(int32_t, RefreshSimState, (int32_t slotId), (override)); 111 MOCK_METHOD(int32_t, SetActiveSim, (int32_t slotId, int32_t enable), (override)); 112 MOCK_METHOD(int32_t, SetActiveSimSatellite, (int32_t slotId, int32_t enable), (override)); 113 MOCK_METHOD( 114 int32_t, GetPreferredNetwork, (int32_t slotId, const sptr<INetworkSearchCallback> &callback), (override)); 115 MOCK_METHOD(int32_t, SetPreferredNetwork, 116 (int32_t slotId, int32_t networkMode, const sptr<INetworkSearchCallback> &callback), (override)); 117 MOCK_METHOD(int32_t, GetNetworkCapability, 118 (int32_t slotId, int32_t networkCapabilityType, int32_t &networkCapabilityState), (override)); 119 MOCK_METHOD(int32_t, SetNetworkCapability, 120 (int32_t slotId, int32_t networkCapabilityType, int32_t networkCapabilityState), (override)); 121 MOCK_METHOD(int32_t, GetSimTelephoneNumber, (int32_t slotId, std::u16string &telephoneNumber), (override)); 122 MOCK_METHOD(std::u16string, GetSimTeleNumberIdentifier, (const int32_t slotId), (override)); 123 MOCK_METHOD(int32_t, GetVoiceMailIdentifier, (int32_t slotId, std::u16string &voiceMailIdentifier), (override)); 124 MOCK_METHOD(int32_t, GetVoiceMailNumber, (int32_t slotId, std::u16string &voiceMailNumber), (override)); 125 MOCK_METHOD(int32_t, GetVoiceMailCount, (int32_t slotId, int32_t &voiceMailCount), (override)); 126 MOCK_METHOD(int32_t, SetVoiceMailCount, (int32_t slotId, int32_t voiceMailCount), (override)); 127 MOCK_METHOD(int32_t, SetVoiceCallForwarding, (int32_t slotId, bool enable, const std::string &number), (override)); 128 MOCK_METHOD(int32_t, QueryIccDiallingNumbers, 129 (int slotId, int type, std::vector<std::shared_ptr<DiallingNumbersInfo>> &result), (override)); 130 MOCK_METHOD(int32_t, AddIccDiallingNumbers, 131 (int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber), (override)); 132 MOCK_METHOD(int32_t, DelIccDiallingNumbers, 133 (int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber), (override)); 134 MOCK_METHOD(int32_t, UpdateIccDiallingNumbers, 135 (int slotId, int type, const std::shared_ptr<DiallingNumbersInfo> &diallingNumber), (override)); 136 MOCK_METHOD(int32_t, SetVoiceMailInfo, 137 (const int32_t slotId, const std::u16string &mailName, const std::u16string &mailNumber), (override)); 138 MOCK_METHOD(int32_t, GetImsRegStatus, (int32_t slotId, ImsServiceType imsSrvType, ImsRegInfo &info), (override)); 139 MOCK_METHOD(int32_t, GetMaxSimCount, (), (override)); 140 MOCK_METHOD(int32_t, GetOpKey, (int32_t slotId, std::u16string &opkey), (override)); 141 MOCK_METHOD(int32_t, GetOpKeyExt, (int32_t slotId, std::u16string &opkeyExt), (override)); 142 MOCK_METHOD(int32_t, GetOpName, (int32_t slotId, std::u16string &opname), (override)); 143 MOCK_METHOD(int32_t, SendEnvelopeCmd, (int32_t slotId, const std::string &cmd), (override)); 144 MOCK_METHOD(int32_t, SendTerminalResponseCmd, (int32_t slotId, const std::string &cmd), (override)); 145 MOCK_METHOD(int32_t, SendCallSetupRequestResult, (int32_t slotId, bool accept), (override)); 146 MOCK_METHOD(int32_t, UnlockSimLock, (int32_t slotId, const PersoLockInfo &lockInfo, LockStatusResponse &response), 147 (override)); 148 MOCK_METHOD(int32_t, GetCellInfoList, (int32_t slotId, std::vector<sptr<CellInformation>> &cellInfo), (override)); 149 MOCK_METHOD(int32_t, GetNeighboringCellInfoList, (int32_t slotId, std::vector<sptr<CellInformation>> &cellInfo), 150 (override)); 151 MOCK_METHOD(int32_t, SendUpdateCellLocationRequest, (int32_t slotId), (override)); 152 MOCK_METHOD(int32_t, HasOperatorPrivileges, (const int32_t slotId, bool &hasOperatorPrivileges), (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 }; 172 } // namespace Telephony 173 } // namespace OHOS 174 #endif // MOCK_CORE_SERVICE_H