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_NETWORK_SEARCH_H 17#define MOCK_NETWORK_SEARCH_H 18 19#include <gtest/gtest.h> 20#include <gmock/gmock.h> 21#include "i_network_search.h" 22 23namespace OHOS { 24namespace Telephony { 25 26class MockNetworkSearchManager : public INetworkSearch { 27public: 28 MockNetworkSearchManager() = default; 29 virtual ~MockNetworkSearchManager() = default; 30 31 MOCK_METHOD0(OnInit, bool()); 32 MOCK_METHOD1(InitTelExtraModule, int32_t(int32_t slotId)); 33 MOCK_METHOD2(GetPsRadioTech, int32_t(int32_t slotId, int32_t &psRadioTech)); 34 MOCK_METHOD2(GetCsRadioTech, int32_t(int32_t slotId, int32_t &csRadioTech)); 35 MOCK_METHOD1(GetOperatorNumeric, std::u16string(int32_t slotId)); 36 MOCK_METHOD1(GetResidentNetworkNumeric, std::string(int32_t slotId)); 37 MOCK_METHOD2(GetOperatorName, int32_t(int32_t slotId, std::u16string &operatorName)); 38 MOCK_METHOD2(GetNetworkStatus, int32_t(int32_t slotId, sptr<NetworkState> &networkState)); 39 MOCK_METHOD1(GetRadioState, int32_t(int32_t slotId)); 40 MOCK_METHOD2(GetRadioState, int32_t(int32_t slotId, NSCALLBACK &callback)); 41 MOCK_METHOD3(SetRadioState, void(int32_t slotId, bool isOn, int32_t rst)); 42 MOCK_METHOD4(SetRadioState, int32_t(int32_t slotId, bool isOn, int32_t rst, NSCALLBACK &callback)); 43 MOCK_METHOD2(GetSignalInfoList, int32_t(int32_t slotId, std::vector<sptr<SignalInformation>> &signals)); 44 MOCK_METHOD3(RegisterCoreNotify, void(int32_t slotId, HANDLE &handler, int32_t what)); 45 MOCK_METHOD3(UnRegisterCoreNotify, void(int32_t slotId, HANDLE &handler, int32_t what)); 46 MOCK_METHOD1(RegisterCellularDataObject, void(const sptr<NetworkSearchCallBackBase> &callback)); 47 MOCK_METHOD1(UnRegisterCellularDataObject, void(const sptr<NetworkSearchCallBackBase> &callback)); 48 MOCK_METHOD1(RegisterCellularCallObject, void(const sptr<NetworkSearchCallBackBase> &callback)); 49 MOCK_METHOD1(UnRegisterCellularCallObject, void(const sptr<NetworkSearchCallBackBase> &callback)); 50 MOCK_METHOD2(GetNetworkSearchInformation, int32_t(int32_t slotId, NSCALLBACK &callback)); 51 MOCK_METHOD2(GetNetworkSelectionMode, int32_t(int32_t slotId, NSCALLBACK &callback)); 52 MOCK_METHOD5(SetNetworkSelectionMode, int32_t(int32_t slotId, int32_t selectMode, 53 const sptr<NetworkInformation> &networkInformation, bool resumeSelection, NSCALLBACK &callback)); 54 MOCK_METHOD2(GetIsoCountryCodeForNetwork, int32_t(int32_t slotId, std::u16string &countryCode)); 55 MOCK_METHOD2(GetPreferredNetwork, int32_t(int32_t slotId, NSCALLBACK &callback)); 56 MOCK_METHOD3(SetPreferredNetwork, int32_t(int32_t slotId, int32_t networkMode, NSCALLBACK &callback)); 57 MOCK_METHOD1(GetPsRegState, int32_t(int32_t slotId)); 58 MOCK_METHOD1(GetCsRegState, int32_t(int32_t slotId)); 59 MOCK_METHOD1(GetPsRoamingState, int32_t(int32_t slotId)); 60 MOCK_METHOD2(GetImei, int32_t(int32_t slotId, std::u16string &imei)); 61 MOCK_METHOD2(GetImeiSv, int32_t(int32_t slotId, std::u16string &imeiSv)); 62 MOCK_METHOD3(GetImsRegStatus, int32_t(int32_t slotId, ImsServiceType imsSrvType, ImsRegInfo &info)); 63 MOCK_METHOD2(GetCellInfoList, int32_t(int32_t slotId, std::vector<sptr<CellInformation>> &cellInfo)); 64 MOCK_METHOD1(SendUpdateCellLocationRequest, int32_t(int32_t slotId)); 65 MOCK_METHOD1(GetCellLocation, sptr<CellLocation>(int32_t slotId)); 66 MOCK_METHOD2(GetMeid, int32_t(int32_t slotId, std::u16string &meid)); 67 MOCK_METHOD2(GetUniqueDeviceId, int32_t(int32_t slotId, std::u16string &deviceId)); 68 MOCK_METHOD1(GetPhoneType, PhoneType(int32_t slotId)); 69 MOCK_METHOD3(SetNrOptionMode, int32_t(int32_t slotId, int32_t mode, NSCALLBACK &callback)); 70 MOCK_METHOD2(GetNrOptionMode, int32_t(int32_t slotId, NrMode &mode)); 71 MOCK_METHOD2(GetNrOptionMode, int32_t(int32_t slotId, NSCALLBACK &callback)); 72 MOCK_METHOD1(GetFrequencyType, FrequencyType(int32_t slotId)); 73 MOCK_METHOD1(GetNrState, NrState(int32_t slotId)); 74 MOCK_METHOD4(RegisterImsRegInfoCallback, int32_t(int32_t slotId, ImsServiceType imsSrvType, const int32_t tokenId, 75 const sptr<ImsRegInfoCallback> &callback)); 76 MOCK_METHOD3(UnregisterImsRegInfoCallback, int32_t(int32_t slotId, ImsServiceType imsSrvType, 77 const int32_t tokenId)); 78 MOCK_METHOD2(GetBasebandVersion, int32_t(int32_t slotId, std::string &version)); 79 MOCK_METHOD1(InitAirplaneMode, void(int32_t slotId)); 80 MOCK_METHOD1(GetAirplaneMode, int32_t(bool &airplaneMode)); 81 MOCK_METHOD3(GetNetworkCapability, int32_t(int32_t slotId, int32_t networkCapabilityType, 82 int32_t &networkCapabilityState)); 83 MOCK_METHOD3(SetNetworkCapability, int32_t(int32_t slotId, int32_t networkCapabilityType, 84 int32_t networkCapabilityState)); 85 MOCK_METHOD1(UpdateRadioOn, int32_t(int32_t slotId)); 86 MOCK_METHOD2(GetRrcConnectionState, int32_t(int32_t slotId, int32_t &status)); 87 MOCK_METHOD1(FactoryReset, int32_t(int32_t slotId)); 88 MOCK_METHOD2(GetNrSsbId, int32_t(int32_t slotId, const std::shared_ptr<NrSsbInformation> &nrSsbInformation)); 89 MOCK_METHOD1(IsNrSupported, bool(int32_t slotId)); 90 MOCK_METHOD0(IsSatelliteEnabled, bool()); 91 MOCK_METHOD2(DcPhysicalLinkActiveUpdate, void(int32_t slotId, bool isActive)); 92 MOCK_METHOD2(NotifyCallStatusToNetworkSearch, int32_t(int32_t slotId, int32_t callStatus)); 93 MOCK_METHOD2(HandleNotifyStateChangeWithDelay, int32_t(int32_t slotId, bool isNeedDelay)); 94 MOCK_METHOD1(StartRadioOnState, int32_t(int32_t slotId)); 95 MOCK_METHOD1(StartGetRilSignalIntensity, int32_t(int32_t slotId)); 96 MOCK_METHOD2(ProcessSignalIntensity, int32_t(int32_t slotId, const struct Rssi &signalIntensity)); 97 MOCK_METHOD2(IsGsm, int32_t(int32_t slotId, bool &isGsm)); 98 MOCK_METHOD2(IsCdma, int32_t(int32_t slotId, bool &isCdma)); 99}; 100 101} // namespace Telephony 102} // namespace OHOS 103#endif // MOCK_NETWORK_SEARCH_H