1 /* 2 * Copyright (C) 2021-2022 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 TELEPHONY_IMS_UNIT_TEST_H 17 #define TELEPHONY_IMS_UNIT_TEST_H 18 19 #include <map> 20 21 #include "ims_call_interface.h" 22 #include "ims_core_service_interface.h" 23 #include "ims_sms_interface.h" 24 #include "singleton.h" 25 26 namespace OHOS { 27 namespace Telephony { 28 class ImsUnitTest { 29 public: 30 static void SetUpTestCase(); 31 static void TearDownTestCase(); 32 void SetUp(); 33 void TearDown(); 34 35 /****************** basic ******************/ 36 int32_t Dial(const sptr<ImsCallInterface> &imsCallSerivce) const; 37 int32_t HangUp(const sptr<ImsCallInterface> &imsCallSerivce) const; 38 int32_t RejectWithReason(const sptr<ImsCallInterface> &imsCallSerivce) const; 39 int32_t Answer(const sptr<ImsCallInterface> &imsCallSerivce) const; 40 int32_t HoldCall(const sptr<ImsCallInterface> &imsCallSerivce) const; 41 int32_t UnHoldCall(const sptr<ImsCallInterface> &imsCallSerivce) const; 42 int32_t SwitchCall(const sptr<ImsCallInterface> &imsCallSerivce) const; 43 int32_t CombineConference(const sptr<ImsCallInterface> &imsCallSerivce) const; 44 int32_t InviteToConference(const sptr<ImsCallInterface> &imsCallSerivce) const; 45 int32_t KickOutFromConference(const sptr<ImsCallInterface> &imsCallSerivce) const; 46 int32_t UpdateImsCallMode(const sptr<ImsCallInterface> &imsCallSerivce) const; 47 int32_t GetImsCallsDataRequest(const sptr<ImsCallInterface> &imsCallSerivce) const; 48 int32_t GetLastCallFailReason(const sptr<ImsCallInterface> &imsCallSerivce) const; 49 int32_t StartDtmf(const sptr<ImsCallInterface> &imsCallSerivce) const; 50 int32_t SendDtmf(const sptr<ImsCallInterface> &imsCallSerivce) const; 51 int32_t StopDtmf(const sptr<ImsCallInterface> &imsCallSerivce) const; 52 int32_t StartRtt(const sptr<ImsCallInterface> &imsCallSerivce) const; 53 int32_t StopRtt(const sptr<ImsCallInterface> &imsCallSerivce) const; 54 55 /****************** ims config ******************/ 56 int32_t SetDomainPreferenceMode(const sptr<ImsCallInterface> &imsCallSerivce) const; 57 int32_t GetDomainPreferenceMode(const sptr<ImsCallInterface> &imsCallSerivce) const; 58 int32_t SetImsSwitchStatus(const sptr<ImsCallInterface> &imsCallSerivce) const; 59 int32_t GetImsSwitchStatus(const sptr<ImsCallInterface> &imsCallSerivce) const; 60 int32_t SetImsConfigString(const sptr<ImsCallInterface> &imsCallSerivce) const; 61 int32_t SetImsConfigInt(const sptr<ImsCallInterface> &imsCallSerivce) const; 62 int32_t GetImsConfig(const sptr<ImsCallInterface> &imsCallSerivce) const; 63 int32_t SetImsFeatureValue(const sptr<ImsCallInterface> &imsCallSerivce) const; 64 int32_t GetImsFeatureValue(const sptr<ImsCallInterface> &imsCallSerivce) const; 65 int32_t SetMute(const sptr<ImsCallInterface> &imsCallSerivce) const; 66 int32_t GetMute(const sptr<ImsCallInterface> &imsCallSerivce) const; 67 68 /****************** video call ******************/ 69 int32_t CtrlCamera(const sptr<ImsCallInterface> &imsCallSerivce) const; 70 int32_t SetPreviewWindow(const sptr<ImsCallInterface> &imsCallSerivce) const; 71 int32_t SetDisplayWindow(const sptr<ImsCallInterface> &imsCallSerivce) const; 72 int32_t SetCameraZoom(const sptr<ImsCallInterface> &imsCallSerivce) const; 73 int32_t SetPauseImage(const sptr<ImsCallInterface> &imsCallSerivce) const; 74 int32_t SetDeviceDirection(const sptr<ImsCallInterface> &imsCallSerivce) const; 75 76 /****************** supplement ******************/ 77 int32_t GetClip(const sptr<ImsCallInterface> &imsCallSerivce) const; 78 int32_t SetClir(const sptr<ImsCallInterface> &imsCallSerivce) const; 79 int32_t GetClir(const sptr<ImsCallInterface> &imsCallSerivce) const; 80 int32_t SetCallTransfer(const sptr<ImsCallInterface> &imsCallSerivce) const; 81 int32_t GetCallTransfer(const sptr<ImsCallInterface> &imsCallSerivce) const; 82 int32_t SetCallRestriction(const sptr<ImsCallInterface> &imsCallSerivce) const; 83 int32_t GetCallRestriction(const sptr<ImsCallInterface> &imsCallSerivce) const; 84 int32_t SetCallWaiting(const sptr<ImsCallInterface> &imsCallSerivce) const; 85 int32_t GetCallWaiting(const sptr<ImsCallInterface> &imsCallSerivce) const; 86 87 // sms & core_service 88 int32_t SetSmsConfig(const sptr<ImsSmsInterface> &imsSmsSerivce) const; 89 int32_t GetSmsConfig(const sptr<ImsSmsInterface> &imsSmsSerivce) const; 90 int32_t SendMessage(const sptr<ImsSmsInterface> &imsSmsSerivce) const; 91 int32_t GetImsRegistrationStatus(const sptr<ImsCoreServiceInterface> &imsCoreSerivce) const; 92 93 int32_t ImsCallTest() const; 94 int32_t ImsSmsTest() const; 95 int32_t ImsCoreServiceTest() const; 96 97 private: 98 /** 99 * InitBasicFuncMap 100 */ 101 void InitBasicFuncMap(); 102 103 /** 104 * InitConfigFuncMap 105 */ 106 void InitConfigFuncMap(); 107 108 /** 109 * InitVideoCallFuncMap 110 */ 111 void InitVideoCallFuncMap(); 112 113 /** 114 * InitSupplementFuncMap 115 */ 116 void InitSupplementFuncMap(); 117 118 /** 119 * InitSmsFuncMap 120 */ 121 void InitSmsFuncMap(); 122 123 /** 124 * InitCoreServiceFuncMap 125 */ 126 void InitCoreServiceFuncMap(); 127 128 private: 129 using RequestCallFuncType = int32_t (ImsUnitTest::*)(const sptr<ImsCallInterface> &imsCallSerivce) const; 130 using RequestSmsFuncType = int32_t (ImsUnitTest::*)(const sptr<ImsSmsInterface> &imsCallSerivce) const; 131 using RequestCoreServiceFuncType = int32_t (ImsUnitTest::*)( 132 const sptr<ImsCoreServiceInterface> &imsCallSerivce) const; 133 std::map<int32_t, RequestCallFuncType> requestCallFuncMap_; 134 std::map<int32_t, RequestSmsFuncType> requestSmsFuncMap_; 135 std::map<int32_t, RequestCoreServiceFuncType> requestCoreServiceFuncMap_; 136 }; 137 } // namespace Telephony 138 } // namespace OHOS 139 #endif // TELEPHONY_IMS_UNIT_TEST_H 140