1 /* 2 * Copyright (C) 2021 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 OHOS_RIL_UNITTEST_H 17 #define OHOS_RIL_UNITTEST_H 18 19 #include "event_handler.h" 20 #include "ril_manager_test.h" 21 22 namespace OHOS { 23 namespace Telephony { 24 const int32_t NUM_CIRCLES = 4; 25 namespace { 26 class RilUnitTest { 27 public: 28 RilUnitTest(int32_t opt); 29 ~RilUnitTest(); 30 31 void OnInit(); 32 void OnInitForRegister(const std::unique_ptr<AppExecFwk::EventHandler> &handler); 33 34 void GetImeiStressTest(const AppExecFwk::InnerEvent::Pointer &result); 35 void RilCmDialStressTest(const AppExecFwk::InnerEvent::Pointer &result); 36 void SetRilCmRadioPowerStressTest(const AppExecFwk::InnerEvent::Pointer &result); 37 38 void GetCallListTest(const AppExecFwk::InnerEvent::Pointer &result); 39 void RilCmDialTest(const AppExecFwk::InnerEvent::Pointer &result); 40 void HangupTest(const AppExecFwk::InnerEvent::Pointer &result); 41 void RejectTest(const AppExecFwk::InnerEvent::Pointer &result); 42 void AnswerCallTest(const AppExecFwk::InnerEvent::Pointer &result); 43 void HoldCallTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 44 void UnHoldCallTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 45 void SwitchCallTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 46 void RilCmJoinCallTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 47 void RilCmSplitCallTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 48 void CallSupplementTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 49 void SendDtmfTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 50 void StartDtmfTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 51 void StopDtmfTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 52 void SetUssdCusdTest(const AppExecFwk::InnerEvent::Pointer &result); 53 void GetUssdCusdTest(const AppExecFwk::InnerEvent::Pointer &result); 54 void SetMuteTest(const AppExecFwk::InnerEvent::Pointer &result); 55 void GetMuteTest(const AppExecFwk::InnerEvent::Pointer &result); 56 void GetEmergencyListTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 57 void GetFailReasonTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 58 59 void IccRilSimIoForAppTest(const AppExecFwk::InnerEvent::Pointer &result); 60 void GetRilCmImsiForAppTest(const AppExecFwk::InnerEvent::Pointer &result); 61 void GetRilCmSignalIntensityTest(const AppExecFwk::InnerEvent::Pointer &result); 62 void GetRilCmIccCardStatusTest(const AppExecFwk::InnerEvent::Pointer &result); 63 void GetRilCmCsRegStatusTest(const AppExecFwk::InnerEvent::Pointer &result); 64 void GetRilCmPsRegStatusTest(const AppExecFwk::InnerEvent::Pointer &result); 65 void GetRilCmOperatorTest(const AppExecFwk::InnerEvent::Pointer &result); 66 void SendRilCmSmsTest(const AppExecFwk::InnerEvent::Pointer &result); 67 void SendRilCmSmsMoreModeTest(const AppExecFwk::InnerEvent::Pointer &result); 68 void SendSmsAckTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 69 void GetSmscAddrTest(const AppExecFwk::InnerEvent::Pointer &result); 70 void SetSmscAddrTest(const AppExecFwk::InnerEvent::Pointer &result); 71 void SetRilCmRadioPowerTest(const AppExecFwk::InnerEvent::Pointer &result); 72 void GetRilRadioPowerTest(const AppExecFwk::InnerEvent::Pointer &result); 73 void GetImeiTest(const AppExecFwk::InnerEvent::Pointer &result); 74 void AcknowledgeRilCmLastIncomingGsmSmsTest(const AppExecFwk::InnerEvent::Pointer &result); 75 void GetRilCmCellInfoListTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 76 void GetRilCurrentCellInfoTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 77 void GetRilNetworkSearchInfoTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 78 void GetRilNetworkSelectionModeTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 79 void GetRilPreferredNetwrokTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 80 void GetRilImsRegStatusTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 81 void GetRilImeiTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 82 void GetVoiceRadioTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 83 void GetRilPsAttachStatusTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 84 void SetRilPreferredNetwrokTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 85 void SetRilPsAttachStatusTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 86 void SetRilNetworkSelectionModeTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 87 void SetRilLocationUpdateTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 88 void SetupRilCmDataCallTest(const AppExecFwk::InnerEvent::Pointer &result); 89 void DeactivateRilCmDataCallTest(const AppExecFwk::InnerEvent::Pointer &result); 90 void GetRilCmDataCallListTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 91 void SetInitialApnTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result); 92 void OnProcessInput(int32_t what, const OHOS::AppExecFwk::InnerEvent::Pointer &event); 93 void OnStressInput(int32_t what, const OHOS::AppExecFwk::InnerEvent::Pointer &event); 94 void SimOpenLogicalChannel(const AppExecFwk::InnerEvent::Pointer &result); 95 void SimCloseLogicalChannel(const AppExecFwk::InnerEvent::Pointer &result); 96 void SimTransmitApduLogicalChannel(const AppExecFwk::InnerEvent::Pointer &result); 97 void UnlockSimLock(const AppExecFwk::InnerEvent::Pointer &result); 98 void GetLinkBandwidthInfoTest(const AppExecFwk::InnerEvent::Pointer &result); 99 void OnInitInterface(); 100 void OnInitStressInterface(); 101 void OnInitProcessInterface(); 102 103 class DemoHandler : public AppExecFwk::EventHandler { 104 public: DemoHandler(const std::shared_ptr<AppExecFwk::EventRunner> & runner)105 DemoHandler(const std::shared_ptr<AppExecFwk::EventRunner> &runner) : AppExecFwk::EventHandler(runner) {} ~DemoHandler()106 ~DemoHandler() {} 107 108 void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event) override; 109 }; 110 111 std::unique_ptr<RilManagerTest> mRilManager_; 112 int32_t slotId_; 113 using RilManagerAndResponseTestFun = void (RilUnitTest::*)(const OHOS::AppExecFwk::InnerEvent::Pointer &event); 114 std::map<uint32_t, RilManagerAndResponseTestFun> memberFuncMap_; 115 std::map<uint32_t, RilManagerAndResponseTestFun> stressMemberFuncMap_; 116 }; 117 } // namespace 118 } // namespace Telephony 119 } // namespace OHOS 120 #endif // OHOS_RIL_UNITTEST_H 121