• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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 #define private public
16 #define protected public
17 
18 #include "cellular_call_config.h"
19 #include "cellular_call_connection_ims.h"
20 #include "cellular_call_handler.h"
21 #include "cellular_call_proxy.h"
22 #include "cellular_call_register.h"
23 #include "cellular_call_service.h"
24 #include "cellular_call_supplement.h"
25 #include "config_request.h"
26 #include "control_base.h"
27 #include "cs_control.h"
28 #include "gtest/gtest.h"
29 #include "tel_ril_call_parcel.h"
30 #include "ims_call_callback_proxy.h"
31 #include "ims_call_callback_stub.h"
32 #include "ims_call_client.h"
33 #include "ims_control.h"
34 #include "ims_error.h"
35 #include "token.h"
36 #include "securec.h"
37 #include "cellular_call_hisysevent.h"
38 #include "standardize_utils.h"
39 #include "cellular_call_rdb_helper.h"
40 #include "cellular_call_dump_helper.h"
41 #include "emergency_utils.h"
42 #include "satellite_call_client.h"
43 
44 namespace OHOS {
45 namespace Telephony {
46 using namespace testing::ext;
47 
48 #ifdef CALL_MANAGER_AUTO_START_OPTIMIZE
49 static const int32_t INVALID_VALUE = -1;
50 #endif
51 
52 namespace {
53 const int32_t INVALID_SLOTID = 2;
54 const int32_t SIM1_SLOTID = 0;
55 const int32_t SIM2_SLOTID = 1;
56 const int32_t ACTIVATE_ACTION = 1;
57 const std::string PHONE_NUMBER = "00000000";
58 const int32_t DEFAULT_INDEX = 1;
59 } // namespace
60 
61 class DemoHandler : public AppExecFwk::EventHandler {
62 public:
DemoHandler(std::shared_ptr<AppExecFwk::EventRunner> & runner)63     explicit DemoHandler(std::shared_ptr<AppExecFwk::EventRunner> &runner) : AppExecFwk::EventHandler(runner) {}
~DemoHandler()64     virtual ~DemoHandler() {}
ProcessEvent(const AppExecFwk::InnerEvent::Pointer & event)65     void ProcessEvent(const AppExecFwk::InnerEvent::Pointer &event) {}
66 };
67 
68 class ZeroBranch1Test : public testing::Test {
69 public:
70     static void SetUpTestCase();
71     static void TearDownTestCase();
72     void SetUp();
73     void TearDown();
74     int32_t InitCellularCallInfo(int32_t accountId, std::string phonenumber, CellularCallInfo &callInfo);
75     void InitImsCallInfoList(ImsCurrentCallList &callInfoList, int32_t num);
76     void InitCsCallInfoList(CallInfoList &callInfoList, int32_t num);
77     void MakeCallInfoParcelData(bool isError, MessageParcel &data);
78 };
79 
SetUpTestCase()80 void ZeroBranch1Test::SetUpTestCase()
81 {
82     std::cout << "---------- CellularCallService start ------------" << std::endl;
83     DelayedSingleton<CellularCallService>::GetInstance()->Init();
84     DelayedSingleton<ImsCallClient>::GetInstance()->Init();
85 }
86 
TearDownTestCase()87 void ZeroBranch1Test::TearDownTestCase() {}
88 
SetUp()89 void ZeroBranch1Test::SetUp() {}
90 
TearDown()91 void ZeroBranch1Test::TearDown() {}
92 
InitCellularCallInfo(int32_t accountId,std::string phonenumber,CellularCallInfo & callInfo)93 int32_t ZeroBranch1Test::InitCellularCallInfo(int32_t accountId, std::string phonenumber, CellularCallInfo &callInfo)
94 {
95     callInfo.accountId = accountId;
96     callInfo.slotId = accountId;
97     callInfo.index = accountId;
98     callInfo.callType = CallType::TYPE_IMS;
99     callInfo.videoState = 0; // 0 means audio
100     if (memset_s(callInfo.phoneNum, kMaxNumberLen, 0, kMaxNumberLen) != EOK) {
101         return TELEPHONY_ERR_MEMSET_FAIL;
102     }
103     if (phonenumber.length() > static_cast<size_t>(kMaxNumberLen)) {
104         return CALL_ERR_NUMBER_OUT_OF_RANGE;
105     }
106     if (memcpy_s(callInfo.phoneNum, kMaxNumberLen, phonenumber.c_str(), phonenumber.length()) != EOK) {
107         return TELEPHONY_ERR_MEMCPY_FAIL;
108     }
109     return TELEPHONY_SUCCESS;
110 }
111 
InitImsCallInfoList(ImsCurrentCallList & callInfoList,int32_t num)112 void ZeroBranch1Test::InitImsCallInfoList(ImsCurrentCallList &callInfoList, int32_t num)
113 {
114     callInfoList.callSize = num;
115     ImsCurrentCall call;
116     int32_t callStateSum = 6;
117     for (int32_t i = 0; i < num; ++i) {
118         call.index = i;
119         call.state = i % callStateSum;
120         callInfoList.calls.push_back(call);
121     }
122 }
123 
MakeCallInfoParcelData(bool isError,MessageParcel & data)124 void ZeroBranch1Test::MakeCallInfoParcelData(bool isError, MessageParcel &data)
125 {
126     if (isError) {
127         int32_t errorSize = 0;
128         data.WriteInt32(errorSize);
129     } else {
130         CellularCallInfo callInfo;
131         callInfo.slotId = -1;
132         int32_t size = 1;
133         data.WriteInt32(size);
134         data.WriteRawData(static_cast<const void *>(&callInfo), sizeof(CellularCallInfo));
135     }
136 }
137 
InitCsCallInfoList(CallInfoList & callInfoList,int32_t num)138 void ZeroBranch1Test::InitCsCallInfoList(CallInfoList &callInfoList, int32_t num)
139 {
140     callInfoList.callSize = num;
141     CallInfo call;
142     int32_t callStateSum = 9;
143     for (int32_t i = 0; i < num; ++i) {
144         call.index = i;
145         call.state = i % callStateSum;
146         callInfoList.calls.push_back(call);
147     }
148 }
149 
150 /**
151  * @tc.number   Telephony_CellularCallStub_001
152  * @tc.name     Test error branch
153  * @tc.desc     Function test
154  */
155 HWTEST_F(ZeroBranch1Test, Telephony_CellularCallStub_001, Function | MediumTest | Level3)
156 {
157     AccessToken token;
158     CellularCallService callStub;
159     MessageParcel reply;
160 
161     MessageParcel dialErrorData;
162     MakeCallInfoParcelData(true, dialErrorData);
163     callStub.OnDialInner(dialErrorData, reply);
164     MessageParcel dialData;
165     MakeCallInfoParcelData(false, dialData);
166     callStub.OnDialInner(dialData, reply);
167 
168     MessageParcel hangUpErrorData;
169     MakeCallInfoParcelData(true, hangUpErrorData);
170     callStub.OnHangUpInner(hangUpErrorData, reply);
171     MessageParcel hangUpData;
172     MakeCallInfoParcelData(false, hangUpData);
173     hangUpData.WriteInt32(1);
174     callStub.OnHangUpInner(hangUpData, reply);
175 
176     MessageParcel rejectErrorData;
177     MakeCallInfoParcelData(true, rejectErrorData);
178     callStub.OnRejectInner(rejectErrorData, reply);
179     MessageParcel rejectData;
180     MakeCallInfoParcelData(false, rejectData);
181     callStub.OnRejectInner(rejectData, reply);
182 
183     MessageParcel answerErrorData;
184     MakeCallInfoParcelData(true, answerErrorData);
185     callStub.OnAnswerInner(answerErrorData, reply);
186     MessageParcel answerData;
187     MakeCallInfoParcelData(false, answerData);
188     callStub.OnAnswerInner(answerData, reply);
189 
190     MessageParcel holdErrorData;
191     MakeCallInfoParcelData(true, holdErrorData);
192     callStub.OnHoldCallInner(holdErrorData, reply);
193     MessageParcel holdData;
194     MakeCallInfoParcelData(false, answerData);
195     callStub.OnHoldCallInner(holdData, reply);
196 
197     MessageParcel unholdErrorData;
198     MakeCallInfoParcelData(true, unholdErrorData);
199     callStub.OnUnHoldCallInner(unholdErrorData, reply);
200     MessageParcel unholdData;
201     MakeCallInfoParcelData(false, unholdData);
202     callStub.OnUnHoldCallInner(unholdData, reply);
203 
204     MessageParcel switchCallErrorData;
205     MakeCallInfoParcelData(true, switchCallErrorData);
206     callStub.OnSwitchCallInner(switchCallErrorData, reply);
207     MessageParcel switchCallData;
208     MakeCallInfoParcelData(false, switchCallData);
209     ASSERT_EQ(callStub.OnSwitchCallInner(switchCallData, reply), TELEPHONY_SUCCESS);
210 }
211 
212 /**
213  * @tc.number   Telephony_CellularCallStub_002
214  * @tc.name     Test error branch
215  * @tc.desc     Function test
216  */
217 HWTEST_F(ZeroBranch1Test, Telephony_CellularCallStub_002, Function | MediumTest | Level3)
218 {
219     AccessToken token;
220     CellularCallService callStub;
221     MessageParcel reply;
222     int32_t size = 1;
223 
224     MessageParcel combineErrorData;
225     MakeCallInfoParcelData(true, combineErrorData);
226     callStub.OnCombineConferenceInner(combineErrorData, reply);
227     MessageParcel combineData;
228     MakeCallInfoParcelData(false, combineData);
229     callStub.OnCombineConferenceInner(combineData, reply);
230 
231     MessageParcel separateErrorData;
232     MakeCallInfoParcelData(true, separateErrorData);
233     callStub.OnSeparateConferenceInner(separateErrorData, reply);
234     MessageParcel separateData;
235     MakeCallInfoParcelData(false, separateData);
236     callStub.OnSeparateConferenceInner(separateData, reply);
237 
238     MessageParcel kickOutErrorData;
239     MakeCallInfoParcelData(true, kickOutErrorData);
240     callStub.OnKickOutFromConferenceInner(kickOutErrorData, reply);
241     MessageParcel kickOutData;
242     MakeCallInfoParcelData(false, kickOutData);
243     callStub.OnKickOutFromConferenceInner(kickOutData, reply);
244 
245     MessageParcel stopDtmfErrorData;
246     MakeCallInfoParcelData(true, stopDtmfErrorData);
247     callStub.OnStopDtmfInner(stopDtmfErrorData, reply);
248     MessageParcel stopDtmfData;
249     MakeCallInfoParcelData(false, stopDtmfData);
250     callStub.OnStopDtmfInner(stopDtmfData, reply);
251 
252     MessageParcel postDialErrorData;
253     MakeCallInfoParcelData(true, postDialErrorData);
254     callStub.OnPostDialProceedInner(postDialErrorData, reply);
255     MessageParcel postDialData;
256     MakeCallInfoParcelData(false, postDialData);
257     postDialData.WriteBool(false);
258     callStub.OnPostDialProceedInner(postDialData, reply);
259 
260     MessageParcel cameraData;
261     cameraData.WriteInt32(size);
262     ASSERT_EQ(callStub.OnControlCameraInner(cameraData, reply), TELEPHONY_SUCCESS);
263 }
264 
265 /**
266  * @tc.number   Telephony_CellularCallStub_003
267  * @tc.name     Test error branch
268  * @tc.desc     Function test
269  */
270 HWTEST_F(ZeroBranch1Test, Telephony_CellularCallStub_003, Function | MediumTest | Level3)
271 {
272     AccessToken token;
273     CellularCallService callStub;
274     CellularCallInfo callInfo;
275     callInfo.slotId = -1;
276     int32_t errorSize = -1;
277     int32_t size = 1;
278     MessageParcel reply;
279 
280     MessageParcel hangUpAllData;
281     hangUpAllData.WriteInt32(size);
282     callStub.OnHangUpAllConnectionInner(hangUpAllData, reply);
283     MessageParcel startDtmfData;
284     startDtmfData.WriteInt32(size);
285     startDtmfData.WriteInt8('1');
286     startDtmfData.WriteRawData((const void *)&callInfo, sizeof(CellularCallInfo));
287     callStub.OnStartDtmfInner(startDtmfData, reply);
288     MessageParcel sendDtmfData;
289     sendDtmfData.WriteInt32(size);
290     sendDtmfData.WriteInt8('1');
291     sendDtmfData.WriteRawData((const void *)&callInfo, sizeof(CellularCallInfo));
292     callStub.OnSendDtmfInner(sendDtmfData, reply);
293     MessageParcel emergencyData;
294     emergencyData.WriteInt32(size);
295     emergencyData.WriteInt32(errorSize);
296     callStub.OnIsEmergencyPhoneNumberInner(emergencyData, reply);
297     MessageParcel setReadyData;
298     setReadyData.WriteInt32(errorSize);
299     callStub.OnSetReadyToCallInner(setReadyData, reply);
300     MessageParcel setCallTransferData;
301     setCallTransferData.WriteInt32(size);
302     setCallTransferData.WriteInt32(errorSize);
303     callStub.OnSetCallTransferInner(setCallTransferData, reply);
304     MessageParcel canSetTimerData;
305     canSetTimerData.WriteInt32(size);
306     canSetTimerData.WriteInt32(errorSize);
307     callStub.OnCanSetCallTransferTimeInner(canSetTimerData, reply);
308     MessageParcel getCallTransferData;
309     getCallTransferData.WriteInt32(size);
310     getCallTransferData.WriteInt32(errorSize);
311     callStub.OnGetCallTransferInner(getCallTransferData, reply);
312     MessageParcel setCallWaitData;
313     setCallWaitData.WriteInt32(size);
314     setCallWaitData.WriteInt32(errorSize);
315     callStub.OnSetCallWaitingInner(setCallWaitData, reply);
316     MessageParcel getCallWaitData;
317     getCallWaitData.WriteInt32(size);
318     getCallWaitData.WriteInt32(errorSize);
319     ASSERT_EQ(callStub.OnGetCallWaitingInner(getCallWaitData, reply), TELEPHONY_SUCCESS);
320 }
321 
322 /**
323  * @tc.number   Telephony_CellularCallStub_004
324  * @tc.name     Test error branch
325  * @tc.desc     Function test
326  */
327 HWTEST_F(ZeroBranch1Test, Telephony_CellularCallStub_004, Function | MediumTest | Level3)
328 {
329     AccessToken token;
330     CellularCallService callStub;
331     int32_t errorSize = -1;
332     int32_t size = 1;
333     MessageParcel reply;
334 
335     MessageParcel setCallRestData;
336     setCallRestData.WriteInt32(size);
337     setCallRestData.WriteInt32(errorSize);
338     callStub.OnSetCallRestrictionInner(setCallRestData, reply);
339     MessageParcel getCallRestData;
340     getCallRestData.WriteInt32(size);
341     getCallRestData.WriteInt32(errorSize);
342     callStub.OnGetCallRestrictionInner(getCallRestData, reply);
343     MessageParcel setCallRestPwdData;
344     setCallRestPwdData.WriteInt32(size);
345     setCallRestPwdData.WriteInt32(errorSize);
346     callStub.OnSetCallRestrictionPasswordInner(setCallRestPwdData, reply);
347     MessageParcel setDomainData;
348     setDomainData.WriteInt32(size);
349     setDomainData.WriteInt32(errorSize);
350     callStub.OnSetDomainPreferenceModeInner(setDomainData, reply);
351     MessageParcel getDomainData;
352     getDomainData.WriteInt32(size);
353     getDomainData.WriteInt32(errorSize);
354     callStub.OnGetDomainPreferenceModeInner(getDomainData, reply);
355     MessageParcel setImsSwitchData;
356     setImsSwitchData.WriteInt32(size);
357     setImsSwitchData.WriteInt32(errorSize);
358     callStub.OnSetImsSwitchStatusInner(setImsSwitchData, reply);
359     MessageParcel getImsSwitchData;
360     getImsSwitchData.WriteInt32(size);
361     getImsSwitchData.WriteInt32(errorSize);
362     callStub.OnGetImsSwitchStatusInner(getImsSwitchData, reply);
363     MessageParcel setVonrData;
364     setVonrData.WriteInt32(size);
365     setVonrData.WriteInt32(errorSize);
366     callStub.OnSetVoNRStateInner(setVonrData, reply);
367     MessageParcel getVonrData;
368     getVonrData.WriteInt32(size);
369     getVonrData.WriteInt32(errorSize);
370     callStub.OnGetVoNRStateInner(getVonrData, reply);
371     MessageParcel setconfigData;
372     setconfigData.WriteInt32(size);
373     setconfigData.WriteInt32(errorSize);
374     ASSERT_EQ(callStub.OnSetImsConfigStringInner(setconfigData, reply), TELEPHONY_SUCCESS);
375 }
376 
377 /**
378  * @tc.number   Telephony_CellularCallStub_005
379  * @tc.name     Test error branch
380  * @tc.desc     Function test
381  */
382 HWTEST_F(ZeroBranch1Test, Telephony_CellularCallStub_005, Function | MediumTest | Level3)
383 {
384     AccessToken token;
385     CellularCallService callStub;
386     int32_t errorSize = -1;
387     int32_t size = 1;
388     MessageParcel reply;
389 
390     MessageParcel setconfigData;
391     setconfigData.WriteInt32(size);
392     setconfigData.WriteInt32(errorSize);
393     callStub.OnSetImsConfigIntInner(setconfigData, reply);
394     MessageParcel getconfigData;
395     getconfigData.WriteInt32(size);
396     getconfigData.WriteInt32(errorSize);
397     callStub.OnGetImsConfigInner(getconfigData, reply);
398     MessageParcel setFeatureData;
399     setFeatureData.WriteInt32(size);
400     setFeatureData.WriteInt32(errorSize);
401     callStub.OnSetImsFeatureValueInner(setFeatureData, reply);
402     MessageParcel getFeatureData;
403     getFeatureData.WriteInt32(size);
404     getFeatureData.WriteInt32(errorSize);
405     callStub.OnGetImsFeatureValueInner(getFeatureData, reply);
406     MessageParcel setMuteData;
407     setMuteData.WriteInt32(size);
408     setMuteData.WriteInt32(errorSize);
409     callStub.OnSetMuteInner(setMuteData, reply);
410     MessageParcel getMuteData;
411     getMuteData.WriteInt32(size);
412     getMuteData.WriteInt32(errorSize);
413     callStub.OnGetMuteInner(getMuteData, reply);
414     MessageParcel closeUssdData;
415     closeUssdData.WriteInt32(size);
416     closeUssdData.WriteInt32(errorSize);
417     callStub.OnCloseUnFinishedUssdInner(closeUssdData, reply);
418     MessageParcel clearCallsData;
419     MakeCallInfoParcelData(false, clearCallsData);
420     ASSERT_EQ(callStub.OnClearAllCallsInner(clearCallsData, reply), TELEPHONY_SUCCESS);
421     MessageParcel ussdData;
422     ussdData.WriteInt32(0);
423     ussdData.WriteString("1");
424     ASSERT_EQ(callStub.OnSendUssdResponse(ussdData, reply), TELEPHONY_SUCCESS);
425 }
426 
427 /**
428  * @tc.number   Telephony_CellularCallStub_006
429  * @tc.name     Test error branch
430  * @tc.desc     Function test
431  */
432 HWTEST_F(ZeroBranch1Test, Telephony_CellularCallStub_006, Function | MediumTest | Level3)
433 {
434     AccessToken token;
435     CellularCallService callStub;
436     int32_t errorSize = -1;
437     int32_t size = 1;
438     MessageParcel reply;
439     MessageParcel setPreviewData;
440     setPreviewData.WriteInt32(errorSize);
441     callStub.OnSetPreviewWindowInner(setPreviewData, reply);
442     MessageParcel setDisplayData;
443     setDisplayData.WriteInt32(errorSize);
444     callStub.OnSetDisplayWindowInner(setDisplayData, reply);
445     MessageParcel setCameraData;
446     setCameraData.WriteInt32(errorSize);
447     callStub.OnSetCameraZoomInner(setCameraData, reply);
448     MessageParcel setImageData;
449     setImageData.WriteInt32(errorSize);
450     callStub.OnSetPausePictureInner(setImageData, reply);
451     MessageParcel setDirectionData;
452     setDirectionData.WriteInt32(errorSize);
453     callStub.OnSetDeviceDirectionInner(setDirectionData, reply);
454 
455     MessageParcel setEmergencyData;
456     setEmergencyData.WriteInt32(size);
457     setEmergencyData.WriteInt32(errorSize);
458     setEmergencyData.WriteInt32(size);
459     if (setEmergencyData.WriteString("123") && setEmergencyData.WriteString("456") &&
460         setEmergencyData.WriteInt32(size) && setEmergencyData.WriteInt32(size) && setEmergencyData.WriteInt32(size)) {
461         callStub.OnSetEmergencyCallList(setEmergencyData, reply);
462     }
463 
464     MessageParcel registerData;
465     registerData.WriteInt32(size);
466     callStub.OnRegisterCallBackInner(registerData, reply);
467     MessageParcel unRegisterData;
468     unRegisterData.WriteInt32(errorSize);
469     callStub.OnUnRegisterCallBackInner(unRegisterData, reply);
470     MessageParcel inviteData;
471     registerData.WriteInt32(size);
472     inviteData.WriteInt32(errorSize);
473     callStub.OnInviteToConferenceInner(inviteData, reply);
474     MessageParcel startRttData;
475     startRttData.WriteInt32(size);
476     startRttData.WriteInt32(errorSize);
477     startRttData.WriteString("1");
478     callStub.OnStartRttInner(startRttData, reply);
479     MessageParcel stopRttData;
480     stopRttData.WriteInt32(size);
481     stopRttData.WriteInt32(errorSize);
482     ASSERT_EQ(callStub.OnStopRttInner(stopRttData, reply), TELEPHONY_SUCCESS);
483 }
484 
485 /**
486  * @tc.number   Telephony_CellularCallStub_007
487  * @tc.name     Test error branch
488  * @tc.desc     Function test
489  */
490 HWTEST_F(ZeroBranch1Test, Telephony_CellularCallStub_007, Function | MediumTest | Level3)
491 {
492     AccessToken token;
493     CellularCallService callStub;
494     int32_t size = 1;
495     MessageParcel reply;
496     MessageParcel callMediaModeRequestData;
497     MakeCallInfoParcelData(false, callMediaModeRequestData);
498     ImsCallMode requestMode = ImsCallMode::CALL_MODE_AUDIO_ONLY;
499     callMediaModeRequestData.WriteInt32(static_cast<int32_t>(requestMode));
500     callStub.OnSendUpdateCallMediaModeRequestInner(callMediaModeRequestData, reply);
501 
502     MessageParcel callMediaModeResponseData;
503     MakeCallInfoParcelData(false, callMediaModeResponseData);
504     ImsCallMode responseMode = ImsCallMode::CALL_MODE_AUDIO_ONLY;
505     callMediaModeResponseData.WriteInt32(static_cast<int32_t>(responseMode));
506     callStub.OnSendUpdateCallMediaModeResponseInner(callMediaModeResponseData, reply);
507 
508     MessageParcel callUpgradeData;
509     callUpgradeData.WriteInt32(size);
510     callUpgradeData.WriteInt32(SIM1_SLOTID);
511     callUpgradeData.WriteInt32(DEFAULT_INDEX);
512     callStub.OnCancelCallUpgradeInner(callUpgradeData, reply);
513 
514     MessageParcel cameraCapabilitiesData;
515     cameraCapabilitiesData.WriteInt32(size);
516     cameraCapabilitiesData.WriteInt32(SIM1_SLOTID);
517     cameraCapabilitiesData.WriteInt32(DEFAULT_INDEX);
518     ASSERT_EQ(callStub.OnRequestCameraCapabilitiesInner(cameraCapabilitiesData, reply), TELEPHONY_SUCCESS);
519 }
520 
521 /**
522  * @tc.number   Telephony_CellularCallService_001
523  * @tc.name     Test error branch
524  * @tc.desc     Function test
525  */
526 HWTEST_F(ZeroBranch1Test, Telephony_CellularCallService_001, Function | MediumTest | Level3)
527 {
528     // AccessToken token;
529     CellularCallService cellularCall;
530     std::vector<std::u16string> args = { u"1", u"2" };
531     cellularCall.Dump(-1, args);
532     cellularCall.Dump(1, args);
533     cellularCall.GetServiceRunningState();
534     cellularCall.GetBindTime();
535     cellularCall.GetEndTime();
536     cellularCall.GetSpendTime();
537 
538     CellularCallInfo csCallInfo = { .callType = CallType::TYPE_CS };
539     CellularCallInfo imsCallInfo = { .callType = CallType::TYPE_IMS };
540     CellularCallInfo errCallInfo = { .callType = CallType::TYPE_ERR_CALL };
541     cellularCall.Dial(csCallInfo);
542     cellularCall.Dial(imsCallInfo);
543     cellularCall.Dial(errCallInfo);
544 
545     cellularCall.HangUp(csCallInfo, CallSupplementType::TYPE_HANG_UP_HOLD_WAIT);
546     cellularCall.HangUp(imsCallInfo, CallSupplementType::TYPE_HANG_UP_HOLD_WAIT);
547     cellularCall.HangUp(errCallInfo, CallSupplementType::TYPE_HANG_UP_HOLD_WAIT);
548 
549     cellularCall.Reject(csCallInfo);
550     cellularCall.Reject(imsCallInfo);
551     cellularCall.Reject(errCallInfo);
552 
553     cellularCall.Answer(csCallInfo);
554     cellularCall.Answer(imsCallInfo);
555     cellularCall.Answer(errCallInfo);
556 
557     cellularCall.HoldCall(csCallInfo);
558     cellularCall.HoldCall(imsCallInfo);
559     cellularCall.HoldCall(errCallInfo);
560 
561     cellularCall.UnHoldCall(csCallInfo);
562     cellularCall.UnHoldCall(imsCallInfo);
563     cellularCall.UnHoldCall(errCallInfo);
564 
565     cellularCall.SwitchCall(csCallInfo);
566     cellularCall.SwitchCall(imsCallInfo);
567     cellularCall.SwitchCall(errCallInfo);
568 
569     bool enabled = false;
570     std::string phoneNum = "000";
571     cellularCall.IsEmergencyPhoneNumber(INVALID_SLOTID, phoneNum, enabled);
572     ASSERT_EQ(cellularCall.IsEmergencyPhoneNumber(SIM1_SLOTID, phoneNum, enabled), TELEPHONY_SUCCESS);
573 }
574 
575 /**
576  * @tc.number   Telephony_CellularCallService_002
577  * @tc.name     Test error branch
578  * @tc.desc     Function test
579  */
580 HWTEST_F(ZeroBranch1Test, Telephony_CellularCallService_002, Function | MediumTest | Level3)
581 {
582     // AccessToken token;
583     CellularCallService cellularCall;
584     CellularCallInfo csCallInfo = { .callType = CallType::TYPE_CS };
585     CellularCallInfo imsCallInfo = { .callType = CallType::TYPE_IMS };
586     CellularCallInfo errCallInfo = { .callType = CallType::TYPE_ERR_CALL };
587     EmergencyCall ecc;
588     std::vector<EmergencyCall> eccVec;
589     eccVec.push_back(ecc);
590     cellularCall.SetEmergencyCallList(SIM1_SLOTID, eccVec);
591     cellularCall.CombineConference(csCallInfo);
592     cellularCall.CombineConference(imsCallInfo);
593     cellularCall.CombineConference(errCallInfo);
594 
595     cellularCall.SeparateConference(csCallInfo);
596     cellularCall.SeparateConference(imsCallInfo);
597     cellularCall.SeparateConference(errCallInfo);
598 
599     std::vector<std::string> numberList = { "111", "222" };
600     cellularCall.InviteToConference(SIM1_SLOTID, numberList);
601     cellularCall.KickOutFromConference(csCallInfo);
602     cellularCall.KickOutFromConference(imsCallInfo);
603     cellularCall.KickOutFromConference(errCallInfo);
604     cellularCall.HangUpAllConnection();
605     cellularCall.HangUpAllConnection(SIM1_SLOTID);
606 
607     cellularCall.SetReadyToCall(SIM1_SLOTID, 0, true);
608     cellularCall.SetReadyToCall(SIM1_SLOTID, 1, true);
609     cellularCall.SetReadyToCall(SIM1_SLOTID, 3, true);
610     cellularCall.StartDtmf('*', csCallInfo);
611     cellularCall.StartDtmf('*', imsCallInfo);
612     cellularCall.StartDtmf('*', errCallInfo);
613     cellularCall.StopDtmf(csCallInfo);
614     cellularCall.StopDtmf(imsCallInfo);
615     cellularCall.StopDtmf(errCallInfo);
616 
617     cellularCall.PostDialProceed(csCallInfo, true);
618     cellularCall.PostDialProceed(imsCallInfo, true);
619     cellularCall.PostDialProceed(errCallInfo, true);
620     cellularCall.SendDtmf('*', csCallInfo);
621     cellularCall.SendDtmf('*', imsCallInfo);
622     cellularCall.SendDtmf('*', errCallInfo);
623     std::string msg = "";
624     cellularCall.StartRtt(SIM1_SLOTID, msg);
625     ASSERT_NE(cellularCall.StopRtt(SIM1_SLOTID), TELEPHONY_SUCCESS);
626 }
627 
628 /**
629  * @tc.number   Telephony_CellularCallService_003
630  * @tc.name     Test error branch
631  * @tc.desc     Function test
632  */
633 HWTEST_F(ZeroBranch1Test, Telephony_CellularCallService_003, Function | MediumTest | Level3)
634 {
635     AccessToken token;
636     CellularCallService cellularCall;
637     CallTransferInfo cTInfoDisable = { .settingType = CallTransferSettingType::CALL_TRANSFER_DISABLE };
638     CallTransferInfo cTInfoEnable = { .settingType = CallTransferSettingType::CALL_TRANSFER_ENABLE };
639     cellularCall.SetCallTransferInfo(SIM1_SLOTID, cTInfoDisable);
640     cellularCall.SetCallTransferInfo(SIM1_SLOTID, cTInfoEnable);
641     bool result = false;
642     cellularCall.CanSetCallTransferTime(SIM1_SLOTID, result);
643     cellularCall.GetCallTransferInfo(SIM1_SLOTID, CallTransferType::TRANSFER_TYPE_UNCONDITIONAL);
644     cellularCall.SetCallWaiting(SIM1_SLOTID, true);
645     cellularCall.GetCallWaiting(SIM1_SLOTID);
646     CallRestrictionInfo crInfo;
647     cellularCall.SetCallRestriction(SIM1_SLOTID, crInfo);
648     cellularCall.GetCallRestriction(SIM1_SLOTID, CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING);
649     std::string password = "1111";
650     cellularCall.SetCallRestrictionPassword(
651         SIM1_SLOTID, CallRestrictionType::RESTRICTION_TYPE_ALL_INCOMING, password.c_str(), password.c_str());
652     cellularCall.SetDomainPreferenceMode(SIM1_SLOTID, 1);
653     cellularCall.GetDomainPreferenceMode(SIM1_SLOTID);
654     cellularCall.SetImsSwitchStatus(SIM1_SLOTID, true);
655     bool enabled = false;
656     cellularCall.GetImsSwitchStatus(SIM1_SLOTID, enabled);
657     std::string value = "";
658     cellularCall.SetImsConfig(SIM1_SLOTID, ImsConfigItem::ITEM_VIDEO_QUALITY, value);
659     int32_t state = 0;
660     cellularCall.SetVoNRState(SIM1_SLOTID, state);
661     cellularCall.GetVoNRState(SIM1_SLOTID, state);
662     cellularCall.SetImsConfig(SIM1_SLOTID, ImsConfigItem::ITEM_VIDEO_QUALITY, 1);
663     cellularCall.GetImsConfig(SIM1_SLOTID, ImsConfigItem::ITEM_VIDEO_QUALITY);
664     cellularCall.SetImsFeatureValue(SIM1_SLOTID, FeatureType::TYPE_VOICE_OVER_LTE, 1);
665     cellularCall.GetImsFeatureValue(SIM1_SLOTID, FeatureType::TYPE_VOICE_OVER_LTE);
666     std::string cameraId = "";
667     cellularCall.ControlCamera(SIM1_SLOTID, DEFAULT_INDEX, cameraId);
668     std::string surfaceId = "";
669     cellularCall.SetPreviewWindow(SIM1_SLOTID, DEFAULT_INDEX, surfaceId, nullptr);
670     cellularCall.SetDisplayWindow(SIM1_SLOTID, DEFAULT_INDEX, surfaceId, nullptr);
671     cellularCall.SetCameraZoom(1.0);
672     std::string path = "";
673     cellularCall.SetPausePicture(SIM1_SLOTID, DEFAULT_INDEX, path);
674     cellularCall.SetDeviceDirection(SIM1_SLOTID, DEFAULT_INDEX, 0);
675     CellularCallInfo cellularCallInfo;
676     InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, cellularCallInfo);
677     cellularCall.SendUpdateCallMediaModeRequest(cellularCallInfo, ImsCallMode::CALL_MODE_AUDIO_ONLY);
678     cellularCall.SendUpdateCallMediaModeResponse(cellularCallInfo, ImsCallMode::CALL_MODE_AUDIO_ONLY);
679     cellularCall.CancelCallUpgrade(SIM1_SLOTID, DEFAULT_INDEX);
680 }
681 
682 /**
683  * @tc.number   Telephony_CellularCallService_004
684  * @tc.name     Test error branch
685  * @tc.desc     Function test
686  */
687 HWTEST_F(ZeroBranch1Test, Telephony_CellularCallService_004, Function | MediumTest | Level3)
688 {
689     AccessToken token;
690     CellularCallService cellularCall;
691     cellularCall.SetMute(SIM1_SLOTID, 0);
692     cellularCall.GetMute(SIM1_SLOTID);
693     cellularCall.CloseUnFinishedUssd(SIM1_SLOTID);
694     std::vector<CellularCallInfo> infos = {};
695     cellularCall.ClearAllCalls(infos);
696     cellularCall.IsNeedIms(SIM1_SLOTID);
697     cellularCall.GetCsControl(SIM1_SLOTID);
698     cellularCall.GetImsControl(SIM1_SLOTID);
699     std::shared_ptr<CSControl> csControl;
700     cellularCall.SetCsControl(SIM1_SLOTID, csControl);
701     std::shared_ptr<IMSControl> imsControl;
702     cellularCall.SetImsControl(SIM1_SLOTID, imsControl);
703     cellularCall.GetHandler(SIM1_SLOTID);
704     cellularCall.SetSrvccState(SrvccState::SRVCC_NONE);
705     cellularCall.GetSrvccState();
706     cellularCall.RegisterHandler();
707 #ifdef CALL_MANAGER_AUTO_START_OPTIMIZE
708     cellularCall.StartCallManagerService();
709     ASSERT_EQ(cellularCall.RequestCameraCapabilities(SIM1_SLOTID, DEFAULT_INDEX), INVALID_VALUE);
710 #else
711     ASSERT_EQ(cellularCall.RequestCameraCapabilities(SIM1_SLOTID, DEFAULT_INDEX), TELEPHONY_SUCCESS);
712 #endif
713     cellularCall.Init();
714     cellularCall.RegisterCoreServiceHandler();
715     cellularCall.CreateHandler();
716     cellularCall.SendEventRegisterHandler();
717     cellularCall.IsValidSlotId(SIM1_SLOTID);
718     CellularCallInfo imsCallInfo = { .callType = CallType::TYPE_IMS };
719     CellularCallInfo csCallInfo = { .callType = CallType::TYPE_CS };
720     cellularCall.UseImsForEmergency(imsCallInfo, true);
721     cellularCall.HandleCallManagerException();
722     cellularCall.HandleCellularControlException(imsCallInfo);
723     cellularCall.HandleCellularControlException(csCallInfo);
724     cellularCall.HangUpWithCellularCallRestart(infos);
725     cellularCall.SetControl(imsCallInfo);
726     cellularCall.SetControl(csCallInfo);
727     sptr<ICallStatusCallback> callback;
728     cellularCall.RegisterCallManagerCallBack(callback);
729     cellularCall.UnRegisterCallManagerCallBack();
730     cellularCall.HandlerResetUnRegister();
731     cellularCall.OnStop();
732     cellularCall.SendUssdResponse(0, "1");
733     ASSERT_EQ(callback, nullptr);
734 }
735 
736 /**
737  * @tc.number	Telephony_CellularCallSupplementRequestIms_001
738  * @tc.name 	Test error branch
739  * @tc.desc 	Function test
740  */
741 HWTEST_F(ZeroBranch1Test, Telephony_CellularCallSupplementRequestIms_001, Function | MediumTest | Level3)
742 {
743     SupplementRequestIms SRequestIms;
744     CallTransferInfo CTransferInfo;
745     std::string fac = "";
746     SRequestIms.SetClipRequest(SIM1_SLOTID, ACTIVATE_ACTION, 0);
747     SRequestIms.GetClipRequest(SIM1_SLOTID, 0);
748     SRequestIms.SetClirRequest(SIM1_SLOTID, ACTIVATE_ACTION, 0);
749     SRequestIms.GetClirRequest(SIM1_SLOTID, 0);
750     SRequestIms.GetCallTransferRequest(SIM1_SLOTID, 0, 0);
751     SRequestIms.SetCallTransferRequest(SIM1_SLOTID, CTransferInfo, ACTIVATE_ACTION, 0);
752     bool enable = false;
753     SRequestIms.CanSetCallTransferTime(SIM1_SLOTID, enable);
754     SRequestIms.GetCallRestrictionRequest(SIM1_SLOTID, fac, 0);
755     std::string pw = "";
756     SRequestIms.SetCallRestrictionRequest(SIM1_SLOTID, fac, 0, pw, 0);
757     SRequestIms.SetCallWaitingRequest(SIM1_SLOTID, true, 0, 0);
758     SRequestIms.GetCallWaitingRequest(SIM1_SLOTID, 0);
759     SRequestIms.SetColrRequest(SIM1_SLOTID, 0, 0);
760     SRequestIms.GetColrRequest(SIM1_SLOTID, 0);
761     SRequestIms.SetColpRequest(SIM1_SLOTID, 0, 0);
762     SRequestIms.GetMMIHandler(SIM1_SLOTID);
763     ASSERT_NE(SRequestIms.GetColpRequest(SIM1_SLOTID, 0), TELEPHONY_SUCCESS);
764 }
765 
766 /**
767  * @tc.number   Telephony_CellularCallHiSysEvent_001
768  * @tc.name     Test error branch
769  * @tc.desc     Function test
770  */
771 HWTEST_F(ZeroBranch1Test, Telephony_CellularCallHiSysEvent_001, Function | MediumTest | Level3)
772 {
773     // AccessToken token;
774     std::shared_ptr<CellularCallHiSysEvent> cellularCallHiSysEvent = std::make_shared<CellularCallHiSysEvent>();
775     std::string desc;
776     cellularCallHiSysEvent->WriteFoundationRestartFaultEvent(2);
777     CallBehaviorParameterInfo Info = { .callType = 1 };
778     CallResponseResult result = CallResponseResult::COMMAND_FAILURE;
779     cellularCallHiSysEvent->WriteDialCallBehaviorEvent(Info, result);
780     result = CallResponseResult::COMMAND_SUCCESS;
781     cellularCallHiSysEvent->WriteDialCallBehaviorEvent(Info, result);
782     Info = { .callType = 0 };
783     cellularCallHiSysEvent->WriteDialCallBehaviorEvent(Info, result);
784     Info = { .callType = 1 };
785     result = CallResponseResult::COMMAND_FAILURE;
786     cellularCallHiSysEvent->WriteHangUpCallBehaviorEvent(Info, result);
787     result = CallResponseResult::COMMAND_SUCCESS;
788     cellularCallHiSysEvent->WriteHangUpCallBehaviorEvent(Info, result);
789     Info = { .callType = 0 };
790     cellularCallHiSysEvent->WriteHangUpCallBehaviorEvent(Info, result);
791     cellularCallHiSysEvent->WriteIncomingCallFaultEvent(
792         0, 0, 0, static_cast<int32_t>(TELEPHONY_ERR_MEMCPY_FAIL), desc);
793     cellularCallHiSysEvent->WriteIncomingCallFaultEvent(0, 0, 0, -1, desc);
794     cellularCallHiSysEvent->JudgingIncomingTimeOut(0, 0, 0);
795     CallForwardingInfo cfInfo;
796     cellularCallHiSysEvent->GetCallForwardingInfo(cfInfo);
797     ASSERT_TRUE(desc.empty());
798 }
799 
800 /**
801  * @tc.number   Telephony_CellularCallHiSysEvent_002
802  * @tc.name     Test error branch
803  * @tc.desc     Function test
804  */
805 HWTEST_F(ZeroBranch1Test, Telephony_CellularCallHiSysEvent_002, Function | MediumTest | Level3)
806 {
807     // AccessToken token;
808     std::shared_ptr<CellularCallHiSysEvent> cellularCallHiSysEvent = std::make_shared<CellularCallHiSysEvent>();
809     CallErrorCode eventValue;
810     cellularCallHiSysEvent->TelephonyErrorCodeConversion(-1, eventValue);
811     cellularCallHiSysEvent->TelephonyErrorCodeConversion(
812         static_cast<int32_t>(TELEPHONY_ERR_LOCAL_PTR_NULL), eventValue);
813     cellularCallHiSysEvent->TelephonyErrorCodeConversion(
814         static_cast<int32_t>(TELEPHONY_ERR_ARGUMENT_INVALID), eventValue);
815     cellularCallHiSysEvent->TelephonyErrorCodeConversion(
816         static_cast<int32_t>(TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL), eventValue);
817     cellularCallHiSysEvent->TelephonyErrorCodeConversion(
818         static_cast<int32_t>(TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL), eventValue);
819     cellularCallHiSysEvent->TelephonyErrorCodeConversion(
820         static_cast<int32_t>(TELEPHONY_ERR_WRITE_DATA_FAIL), eventValue);
821     cellularCallHiSysEvent->TelephonyErrorCodeConversion(
822         static_cast<int32_t>(TELEPHONY_ERR_PERMISSION_ERR), eventValue);
823     cellularCallHiSysEvent->TelephonyErrorCodeConversion(static_cast<int32_t>(TELEPHONY_ERR_MEMSET_FAIL), eventValue);
824     cellularCallHiSysEvent->TelephonyErrorCodeConversion(static_cast<int32_t>(TELEPHONY_ERR_MEMCPY_FAIL), eventValue);
825     cellularCallHiSysEvent->CallDataErrorCodeConversion(-1, eventValue);
826     cellularCallHiSysEvent->CallDataErrorCodeConversion(static_cast<int32_t>(CALL_ERR_INVALID_SLOT_ID), eventValue);
827     cellularCallHiSysEvent->CallDataErrorCodeConversion(static_cast<int32_t>(CALL_ERR_INVALID_CALLID), eventValue);
828     cellularCallHiSysEvent->CallDataErrorCodeConversion(static_cast<int32_t>(CALL_ERR_PHONE_NUMBER_EMPTY), eventValue);
829     cellularCallHiSysEvent->CallDataErrorCodeConversion(
830         static_cast<int32_t>(CALL_ERR_NUMBER_OUT_OF_RANGE), eventValue);
831     cellularCallHiSysEvent->CallDataErrorCodeConversion(
832         static_cast<int32_t>(CALL_ERR_UNSUPPORTED_NETWORK_TYPE), eventValue);
833     cellularCallHiSysEvent->CallDataErrorCodeConversion(static_cast<int32_t>(CALL_ERR_INVALID_DIAL_SCENE), eventValue);
834     cellularCallHiSysEvent->CallDataErrorCodeConversion(
835         static_cast<int32_t>(CALL_ERR_INVALID_VIDEO_STATE), eventValue);
836     cellularCallHiSysEvent->CallDataErrorCodeConversion(static_cast<int32_t>(CALL_ERR_UNKNOW_DIAL_TYPE), eventValue);
837     cellularCallHiSysEvent->CallDataErrorCodeConversion(static_cast<int32_t>(CALL_ERR_UNKNOW_CALL_TYPE), eventValue);
838     cellularCallHiSysEvent->CallDataErrorCodeConversion(
839         static_cast<int32_t>(CALL_ERR_CALL_OBJECT_IS_NULL), eventValue);
840     cellularCallHiSysEvent->CallInterfaceErrorCodeConversion(-1, eventValue);
841     cellularCallHiSysEvent->CallInterfaceErrorCodeConversion(static_cast<int32_t>(CALL_ERR_DIAL_IS_BUSY), eventValue);
842     cellularCallHiSysEvent->CallInterfaceErrorCodeConversion(
843         static_cast<int32_t>(CALL_ERR_ILLEGAL_CALL_OPERATION), eventValue);
844     cellularCallHiSysEvent->CallInterfaceErrorCodeConversion(
845         static_cast<int32_t>(CALL_ERR_PHONE_CALLSTATE_NOTIFY_FAILED), eventValue);
846     cellularCallHiSysEvent->CallInterfaceErrorCodeConversion(
847         static_cast<int32_t>(CALL_ERR_SYSTEM_EVENT_HANDLE_FAILURE), eventValue);
848     cellularCallHiSysEvent->CallInterfaceErrorCodeConversion(
849         static_cast<int32_t>(CALL_ERR_CALL_COUNTS_EXCEED_LIMIT), eventValue);
850     ASSERT_NE(cellularCallHiSysEvent->CallInterfaceErrorCodeConversion(
851         static_cast<int32_t>(CALL_ERR_GET_RADIO_STATE_FAILED), eventValue), 0);
852 }
853 
854 /**
855  * @tc.number	Telephony_CellularCallConnectionCs_001
856  * @tc.name 	Test error branch
857  * @tc.desc 	Function test
858  */
859 HWTEST_F(ZeroBranch1Test, Telephony_CellularCallConnectionCs_001, Function | MediumTest | Level3)
860 {
861     CellularCallConnectionCS cellularCallConnectionCS;
862     DialRequestStruct dialRequestStruct;
863     cellularCallConnectionCS.DialRequest(SIM2_SLOTID, dialRequestStruct);
864     cellularCallConnectionCS.HangUpRequest(SIM2_SLOTID);
865     cellularCallConnectionCS.AnswerRequest(SIM2_SLOTID);
866     cellularCallConnectionCS.AnswerRequest(SIM1_SLOTID);
867     cellularCallConnectionCS.RejectRequest(SIM2_SLOTID);
868     cellularCallConnectionCS.HoldRequest(SIM2_SLOTID);
869     cellularCallConnectionCS.UnHoldCallRequest(SIM2_SLOTID);
870     cellularCallConnectionCS.SwitchCallRequest(SIM2_SLOTID);
871     cellularCallConnectionCS.CombineConferenceRequest(SIM2_SLOTID, 0);
872     cellularCallConnectionCS.SeparateConferenceRequest(SIM2_SLOTID, 0, 0);
873     cellularCallConnectionCS.CallSupplementRequest(SIM2_SLOTID, CallSupplementType::TYPE_DEFAULT);
874     char cDtmfCode = ' ';
875     cellularCallConnectionCS.SendDtmfRequest(SIM2_SLOTID, cDtmfCode, 0);
876     cellularCallConnectionCS.StartDtmfRequest(SIM2_SLOTID, cDtmfCode, 0);
877     cellularCallConnectionCS.StopDtmfRequest(SIM2_SLOTID, 0);
878     cellularCallConnectionCS.GetCsCallsDataRequest(SIM2_SLOTID, 0);
879     cellularCallConnectionCS.GetCallFailReasonRequest(SIM2_SLOTID);
880     ASSERT_EQ(cellularCallConnectionCS.ProcessPostDialCallChar(SIM1_SLOTID, cDtmfCode), TELEPHONY_SUCCESS);
881 }
882 
883 /**
884  * @tc.number	Telephony_SupplementRequestCs_001
885  * @tc.name 	Test error branch
886  * @tc.desc 	Function test
887  */
888 HWTEST_F(ZeroBranch1Test, Telephony_SupplementRequestCs_001, Function | MediumTest | Level3)
889 {
890     SupplementRequestCs supplementRequestCs;
891     std::string msg = "11111";
892     std::string fac = "";
893     std::string pw = "";
894     std::string oldPin = "123456";
895     std::string newPin = "789101";
896     std::string puk = "22222";
897     CallTransferParam callTransferParam;
898     ASSERT_EQ(supplementRequestCs.SendUssdRequest(SIM1_SLOTID, msg), TELEPHONY_ERR_LOCAL_PTR_NULL);
899     ASSERT_EQ(supplementRequestCs.CloseUnFinishedUssdRequest(SIM1_SLOTID), TELEPHONY_ERR_LOCAL_PTR_NULL);
900     ASSERT_EQ(supplementRequestCs.SetClirRequest(SIM1_SLOTID, ACTIVATE_ACTION, 0), TELEPHONY_ERR_LOCAL_PTR_NULL);
901     ASSERT_EQ(supplementRequestCs.GetClipRequest(SIM1_SLOTID, 0), TELEPHONY_ERR_LOCAL_PTR_NULL);
902     ASSERT_EQ(supplementRequestCs.GetClirRequest(SIM1_SLOTID, 0), TELEPHONY_ERR_LOCAL_PTR_NULL);
903     ASSERT_EQ(supplementRequestCs.SetCallTransferRequest(SIM1_SLOTID, callTransferParam, 0),
904         TELEPHONY_ERR_LOCAL_PTR_NULL);
905     ASSERT_EQ(supplementRequestCs.GetCallTransferRequest(SIM1_SLOTID, 0, 0), TELEPHONY_ERR_LOCAL_PTR_NULL);
906     ASSERT_EQ(supplementRequestCs.GetCallRestrictionRequest(SIM1_SLOTID, fac, 0), TELEPHONY_ERR_LOCAL_PTR_NULL);
907     ASSERT_EQ(supplementRequestCs.SetCallRestrictionRequest(SIM1_SLOTID, fac, 0, pw, 0), TELEPHONY_ERR_LOCAL_PTR_NULL);
908     ASSERT_EQ(supplementRequestCs.SetBarringPasswordRequest(SIM1_SLOTID, msg, 0, oldPin.c_str(), newPin.c_str()),
909         TELEPHONY_ERR_LOCAL_PTR_NULL);
910     ASSERT_EQ(supplementRequestCs.SetCallWaitingRequest(SIM1_SLOTID, true, 0, 0), TELEPHONY_ERR_LOCAL_PTR_NULL);
911     ASSERT_EQ(supplementRequestCs.AlterPinPassword(SIM1_SLOTID, newPin, oldPin), TELEPHONY_ERROR);
912     ASSERT_EQ(supplementRequestCs.UnlockPuk(SIM1_SLOTID, newPin, puk), TELEPHONY_ERROR);
913     ASSERT_EQ(supplementRequestCs.AlterPin2Password(SIM1_SLOTID, newPin, oldPin), TELEPHONY_ERROR);
914     ASSERT_EQ(supplementRequestCs.UnlockPuk2(SIM1_SLOTID, newPin, puk), TELEPHONY_ERROR);
915     ASSERT_EQ(supplementRequestCs.GetCallWaitingRequest(SIM1_SLOTID, 0), TELEPHONY_ERR_LOCAL_PTR_NULL);
916 }
917 
918 /**
919  * @tc.number	Telephony_StandardizeUtils_001
920  * @tc.name 	Test error branch
921  * @tc.desc 	Function test
922  */
923 HWTEST_F(ZeroBranch1Test, Telephony_StandardizeUtils_001, Function | MediumTest | Level3)
924 {
925     StandardizeUtils standardizeUtils;
926     std::string phoneString = {0};
927     std::string networkAddress = "1111111";
928     std::string postDial = "11111111";
929     ASSERT_EQ(standardizeUtils.RemoveSeparatorsPhoneNumber(phoneString), "");
930     phoneString = "1111111,123321";
931     standardizeUtils.ExtractAddressAndPostDial(phoneString, networkAddress, postDial);
932     ASSERT_EQ(postDial, "11111111,123321");
933     std::vector<std::string> split = standardizeUtils.Split(phoneString, ",");
934     ASSERT_FALSE(split.empty());
935 }
936 
937 /**
938  * @tc.number	Telephony_MmiCodeUtils_001
939  * @tc.name 	Test error branch
940  * @tc.desc 	Function test
941  */
942 HWTEST_F(ZeroBranch1Test, Telephony_MmiCodeUtils_001, Function | MediumTest | Level3)
943 {
944     MMICodeUtils mmiCodeUtils;
945     bool enable = false;
946     ASSERT_FALSE(mmiCodeUtils.IsNeedExecuteMmi("111111#", enable));
947     mmiCodeUtils.isNeedUseIms_ = true;
948     ASSERT_FALSE(mmiCodeUtils.ExecuteMmiCode(SIM1_SLOTID));
949     mmiCodeUtils.isNeedUseIms_ = false;
950     mmiCodeUtils.mmiData_.serviceCode = "11111";
951     ASSERT_FALSE(mmiCodeUtils.ExecuteMmiCode(SIM1_SLOTID));
952     mmiCodeUtils.mmiData_.serviceCode.clear();
953     mmiCodeUtils.mmiData_.fullString = "11111";
954     ASSERT_TRUE(mmiCodeUtils.ExecuteMmiCode(SIM1_SLOTID));
955     mmiCodeUtils.mmiData_.fullString.clear();
956     mmiCodeUtils.mmiData_.dialString = "11111#";
957     ASSERT_FALSE(mmiCodeUtils.RegexMatchMmi("111111#"));
958     std::string dialStr = "";
959     ASSERT_FALSE(mmiCodeUtils.IsNeedExecuteMmi(dialStr, enable));
960     dialStr = "12";
961     ASSERT_FALSE(mmiCodeUtils.IsNeedExecuteMmi(dialStr, enable));
962     dialStr = "33";
963     ASSERT_TRUE(mmiCodeUtils.IsNeedExecuteMmi(dialStr, enable));
964     dialStr = "*21*10086#";
965     ASSERT_TRUE(mmiCodeUtils.IsNeedExecuteMmi(dialStr, enable));
966     dialStr = "10086";
967     ASSERT_FALSE(mmiCodeUtils.IsNeedExecuteMmi(dialStr, enable));
968     dialStr = "*30#10086";
969     ASSERT_FALSE(mmiCodeUtils.IsNeedExecuteMmi(dialStr, enable));
970     dialStr = "*33##123#";
971     ASSERT_TRUE(mmiCodeUtils.IsNeedExecuteMmi(dialStr, enable));
972 }
973 
974 /**
975  * @tc.number	Telephony_CellularCallRdbHelper_001
976  * @tc.name 	Test error branch
977  * @tc.desc 	Function test
978  */
979 HWTEST_F(ZeroBranch1Test, Telephony_CellularCallRdbHelper_001, Function | MediumTest | Level3)
980 {
981     std::u16string u16Hplmn = u"";
982     CoreManagerInner::GetInstance().GetSimOperatorNumeric(SIM1_SLOTID, u16Hplmn);
983     std::string hplmn = Str16ToStr8(u16Hplmn);
984     std::vector<EccNum> eccVec;
985     ASSERT_NE(DelayedSingleton<CellularCallRdbHelper>::GetInstance()->QueryEccList(hplmn, eccVec), TELEPHONY_SUCCESS);
986 }
987 
988 /**
989  * @tc.number	Telephony_CellularCallDumpHelper_001
990  * @tc.name 	Test error branch
991  * @tc.desc 	Function test
992  */
993 HWTEST_F(ZeroBranch1Test, Telephony_CellularCallDumpHelper_001, Function | MediumTest | Level3)
994 {
995     CellularCallDumpHelper cellularCallDumpHelper;
996     std::vector<std::string> args = { "123456", "234567" };
997     std::string result;
998     cellularCallDumpHelper.WhetherHasSimCard(SIM1_SLOTID);
999     ASSERT_NE(cellularCallDumpHelper.Dump(args, result), TELEPHONY_SUCCESS);
1000 }
1001 
1002 /**
1003  * @tc.number	Telephony_EmergencyUtils_001
1004  * @tc.name 	Test error branch
1005  * @tc.desc 	Function test
1006  */
1007 HWTEST_F(ZeroBranch1Test, Telephony_EmergencyUtils_001, Function | MediumTest | Level3)
1008 {
1009     EmergencyUtils emergencyUtils;
1010     std::string phoneNum = "1234567";
1011     bool enabled = false;
1012     ASSERT_EQ(emergencyUtils.IsEmergencyCall(SIM1_SLOTID, phoneNum, enabled), TELEPHONY_SUCCESS);
1013 }
1014 
1015 } // namespace Telephony
1016 } // namespace OHOS