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 23 namespace OHOS { 24 namespace Telephony { 25 26 class MockNetworkSearchManager : public INetworkSearch { 27 public: 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_METHOD2(SetPreferredNetwork, bool(int32_t, int32_t)); 58 MOCK_METHOD2(SetForcePreferredNetwork, bool(int32_t, int32_t)); 59 MOCK_METHOD1(GetPsRegState, int32_t(int32_t slotId)); 60 MOCK_METHOD1(GetCsRegState, int32_t(int32_t slotId)); 61 MOCK_METHOD1(GetPsRoamingState, int32_t(int32_t slotId)); 62 MOCK_METHOD2(GetImei, int32_t(int32_t slotId, std::u16string &imei)); 63 MOCK_METHOD2(GetImeiSv, int32_t(int32_t slotId, std::u16string &imeiSv)); 64 MOCK_METHOD3(GetImsRegStatus, int32_t(int32_t slotId, ImsServiceType imsSrvType, ImsRegInfo &info)); 65 MOCK_METHOD2(GetCellInfoList, int32_t(int32_t slotId, std::vector<sptr<CellInformation>> &cellInfo)); 66 MOCK_METHOD2(GetNeighboringCellInfoList, int32_t(int32_t slotId, std::vector<sptr<CellInformation>> &cellInfo)); 67 MOCK_METHOD1(SendUpdateCellLocationRequest, int32_t(int32_t slotId)); 68 MOCK_METHOD1(GetCellLocation, sptr<CellLocation>(int32_t slotId)); 69 MOCK_METHOD2(GetMeid, int32_t(int32_t slotId, std::u16string &meid)); 70 MOCK_METHOD2(GetUniqueDeviceId, int32_t(int32_t slotId, std::u16string &deviceId)); 71 MOCK_METHOD1(GetPhoneType, PhoneType(int32_t slotId)); 72 MOCK_METHOD2(SetNrOptionMode, int32_t(int32_t slotId, int32_t mode)); 73 MOCK_METHOD3(SetNrOptionMode, int32_t(int32_t slotId, int32_t mode, NSCALLBACK &callback)); 74 MOCK_METHOD2(GetNrOptionMode, int32_t(int32_t slotId, NrMode &mode)); 75 MOCK_METHOD2(GetNrOptionMode, int32_t(int32_t slotId, NSCALLBACK &callback)); 76 MOCK_METHOD1(GetFrequencyType, FrequencyType(int32_t slotId)); 77 MOCK_METHOD1(GetNrState, NrState(int32_t slotId)); 78 MOCK_METHOD4(RegisterImsRegInfoCallback, int32_t(int32_t slotId, ImsServiceType imsSrvType, const int32_t tokenId, 79 const sptr<ImsRegInfoCallback> &callback)); 80 MOCK_METHOD3(UnregisterImsRegInfoCallback, int32_t(int32_t slotId, ImsServiceType imsSrvType, 81 const int32_t tokenId)); 82 MOCK_METHOD2(GetBasebandVersion, int32_t(int32_t slotId, std::string &version)); 83 MOCK_METHOD1(InitAirplaneMode, void(int32_t slotId)); 84 MOCK_METHOD1(GetAirplaneMode, int32_t(bool &airplaneMode)); 85 MOCK_METHOD3(GetNetworkCapability, int32_t(int32_t slotId, int32_t networkCapabilityType, 86 int32_t &networkCapabilityState)); 87 MOCK_METHOD3(SetNetworkCapability, int32_t(int32_t slotId, int32_t networkCapabilityType, 88 int32_t networkCapabilityState)); 89 MOCK_METHOD1(UpdateRadioOn, int32_t(int32_t slotId)); 90 MOCK_METHOD2(GetRrcConnectionState, int32_t(int32_t slotId, int32_t &status)); 91 MOCK_METHOD1(FactoryReset, int32_t(int32_t slotId)); 92 MOCK_METHOD2(GetNrSsbId, int32_t(int32_t slotId, const std::shared_ptr<NrSsbInformation> &nrSsbInformation)); 93 MOCK_METHOD1(IsNrSupported, bool(int32_t slotId)); 94 MOCK_METHOD0(IsSatelliteEnabled, bool()); 95 MOCK_METHOD2(DcPhysicalLinkActiveUpdate, void(int32_t slotId, bool isActive)); 96 MOCK_METHOD2(NotifyCallStatusToNetworkSearch, int32_t(int32_t slotId, int32_t callStatus)); 97 MOCK_METHOD2(HandleNotifyStateChangeWithDelay, int32_t(int32_t slotId, bool isNeedDelay)); 98 MOCK_METHOD1(StartRadioOnState, int32_t(int32_t slotId)); 99 MOCK_METHOD1(StartGetRilSignalIntensity, int32_t(int32_t slotId)); 100 MOCK_METHOD2(ProcessSignalIntensity, int32_t(int32_t slotId, const struct Rssi &signalIntensity)); 101 MOCK_METHOD2(IsGsm, int32_t(int32_t slotId, bool &isGsm)); 102 MOCK_METHOD2(IsCdma, int32_t(int32_t slotId, bool &isCdma)); 103 MOCK_METHOD1(UpdateOperatorName, int32_t(int32_t slotId)); 104 }; 105 106 } // namespace Telephony 107 } // namespace OHOS 108 #endif // MOCK_NETWORK_SEARCH_H