• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef OHOS_MULTI_SIM_CONTROLLER_MOCK_H
16 #define OHOS_MULTI_SIM_CONTROLLER_MOCK_H
17 
18 #include <gmock/gmock.h>
19 #include "multi_sim_controller.h"
20 #include "radio_protocol_controller.h"
21 #include "sim_constant.h"
22 #include "sim_file_manager.h"
23 #include "sim_rdb_helper.h"
24 #include "sim_state_manager.h"
25 #include "telephony_errors.h"
26 #include "tel_event_handler.h"
27 
28 namespace OHOS {
29 namespace Telephony {
30 class MultiSimControllerMock : public MultiSimController {
31 public:
32     explicit MultiSimControllerMock(std::shared_ptr<Telephony::ITelRilManager> telRilManager = nullptr,
33         std::vector<std::shared_ptr<Telephony::SimStateManager>> simStateManager = {},
34         std::vector<std::shared_ptr<Telephony::SimFileManager>> simFileManager = {})
MultiSimController(telRilManager,simStateManager,simFileManager)35         : MultiSimController(telRilManager, simStateManager, simFileManager) {
36     }
37 
38     ~MultiSimControllerMock() override = default;
39 
40     MOCK_METHOD2(AddExtraManagers, void(std::shared_ptr<Telephony::SimStateManager> simStateManager,
41         std::shared_ptr<Telephony::SimFileManager> simFileManager));
42 
43     MOCK_METHOD0(Init, void());
44     MOCK_METHOD1(InitData, bool(int32_t slotId));
45     MOCK_METHOD0(GetDefaultVoiceSlotId, int32_t());
46     MOCK_METHOD1(SetDefaultVoiceSlotId, int32_t(int32_t slotId));
47     MOCK_METHOD0(GetDefaultSmsSlotId, int32_t());
48     MOCK_METHOD1(SetDefaultSmsSlotId, int32_t(int32_t slotId));
49     MOCK_METHOD3(GetSimAccountInfo, int32_t(int32_t slotId, bool denied, IccAccountInfo &info));
50     MOCK_METHOD0(GetDefaultCellularDataSlotId, int32_t());
51     MOCK_METHOD1(SetDefaultCellularDataSlotId, int32_t(int32_t slotId));
52     MOCK_METHOD0(GetPrimarySlotId, int32_t());
53     MOCK_METHOD1(SetPrimarySlotId, int32_t(int32_t slotId));
54     MOCK_METHOD2(GetShowNumber, int32_t(int32_t slotId, std::u16string &showNumber));
55     MOCK_METHOD3(SetShowNumber, int32_t(int32_t slotId, std::u16string Number, bool force));
56     MOCK_METHOD2(SetShowNumberToDB, int32_t(int32_t slotId, std::u16string Number));
57     MOCK_METHOD2(GetShowName, int32_t(int32_t slotId, std::u16string &showName));
58     MOCK_METHOD3(SetShowName, int32_t(int32_t slotId, std::u16string name, bool force));
59     MOCK_METHOD2(GetSimTelephoneNumber, int32_t(int32_t slotId, std::u16string &telephoneNumber));
60     MOCK_METHOD1(IsSimActive, bool(int32_t slotId));
61     MOCK_METHOD3(SetActiveSim, int32_t(int32_t slotId, int32_t enable, bool force));
62     MOCK_METHOD3(SetActiveSimSatellite, int32_t(int32_t slotId, int32_t enable, bool force));
63     MOCK_METHOD3(SetActiveSimToRil, bool(int32_t slotId, int32_t type, int32_t enable));
64     MOCK_METHOD0(ForgetAllData, bool());
65     MOCK_METHOD1(ForgetAllData, bool(int32_t slotId));
66     MOCK_METHOD1(ResetSetPrimarySlotRemain, void(int32_t slotId));
67     MOCK_METHOD1(GetSlotId, int32_t(int32_t simId));
68     MOCK_METHOD1(GetSimId, int32_t(int32_t slotId));
69     MOCK_METHOD2(SaveImsSwitch, int32_t(int32_t slotId, int32_t imsSwitchValue));
70     MOCK_METHOD2(QueryImsSwitch, int32_t(int32_t slotId, int32_t &imsSwitchValue));
71     MOCK_METHOD0(GetListFromDataBase, bool());
72     MOCK_METHOD2(GetActiveSimAccountInfoList, int32_t(bool denied, std::vector<IccAccountInfo> &iccAccountInfoList));
73     MOCK_METHOD1(GetRadioProtocolTech, int32_t(int32_t slotId));
74     MOCK_METHOD1(GetRadioProtocol, void(int32_t slotId));
75     MOCK_METHOD1(InitShowName, bool(int slotId));
76     MOCK_METHOD0(ReCheckPrimary, void());
77     MOCK_METHOD0(IsDataShareError, bool());
78     MOCK_METHOD0(ResetDataShareError, void());
79     MOCK_METHOD0(UpdateOpKeyInfo, int32_t());
80     MOCK_METHOD1(IsSetActiveSimInProgress, bool(int32_t slotId));
81     MOCK_METHOD0(IsSetPrimarySlotIdInProgress, bool());
82     MOCK_METHOD1(SavePrimarySlotId, int32_t(int32_t slotId));
83     MOCK_METHOD0(GetDefaultMainSlotByIccId, int32_t());
84     MOCK_METHOD1(IsValidData, bool(int32_t slotId));
85     MOCK_METHOD1(InitIccId, bool(int32_t slotId));
86     MOCK_METHOD2(GetAllSimAccountInfoList, int32_t(bool denied, std::vector<IccAccountInfo> &iccAccountInfoList));
87     MOCK_METHOD3(InsertEsimData, int32_t(const std::string &iccId, int32_t esimLabel, const std::string &operatorName));
88     MOCK_METHOD2(GetSimLabel, int32_t(int32_t slotId, SimLabel &simLabel));
89     MOCK_METHOD2(SetSimLabelIndex, int32_t(const std::string &iccId, int32_t &labelIndex));
90 };
91 } // namespace Telephony
92 } // namespace OHOS
93 
94 #endif // OHOS_MULTI_SIM_CONTROLLER_MOCK_H