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 #include "cs_test.h"
17
18 #define private public
19 #define protected public
20 #include "cellular_call_register.h"
21 #include "cellular_call_service.h"
22 #include "core_service_client.h"
23 #include "cs_control.h"
24 #include "hril_call_parcel.h"
25 #include "operator_config_types.h"
26 #include "securec.h"
27 #include "sim_state_type.h"
28
29 namespace OHOS {
30 namespace Telephony {
31 using namespace testing::ext;
32 const int32_t SIM1_SLOTID = 0;
33 const int32_t SIM2_SLOTID = 1;
34 const int32_t INVALID_SLOTID = -1;
35 const int32_t INVALID_HANG_UP_TYPE = -1;
36 const int32_t RESULT = 1;
37 const std::string PHONE_NUMBER = "0000000";
38 const std::string PHONE_NUMBER_SECOND = "1111111";
39 const std::string PHONE_NUMBER_THIRD = "2222222";
40 const int32_t CELLULAR_CALL_SUCCESS = 0;
41
HasSimCard(int32_t slotId)42 bool CsTest::HasSimCard(int32_t slotId)
43 {
44 bool hasSimCard = false;
45 DelayedRefSingleton<CoreServiceClient>::GetInstance().HasSimCard(slotId, hasSimCard);
46 return hasSimCard;
47 }
48
SetUpTestCase(void)49 void CsTest::SetUpTestCase(void)
50 {
51 // step 3: Set Up Test Case
52 }
53
TearDownTestCase(void)54 void CsTest::TearDownTestCase(void)
55 {
56 // step 3: Tear Down Test Case
57 }
58
SetUp(void)59 void CsTest::SetUp(void)
60 {
61 // step 3: input testcase setup step
62 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::DIAL)] = &CsTest::Dial;
63 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::HANG_UP)] = &CsTest::HangUp;
64 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::REJECT)] = &CsTest::Reject;
65 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::ANSWER)] = &CsTest::Answer;
66 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::HOLD_CALL)] = &CsTest::HoldCall;
67 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::UN_HOLD_CALL)] = &CsTest::UnHoldCall;
68 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::SWITCH_CALL)] = &CsTest::SwitchCall;
69 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::EMERGENCY_CALL)] =
70 &CsTest::IsEmergencyPhoneNumber;
71 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::COMBINE_CONFERENCE)] =
72 &CsTest::CombineConference;
73 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::SEPARATE_CONFERENCE)] =
74 &CsTest::SeparateConference;
75 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::INVITE_TO_CONFERENCE)] =
76 &CsTest::InviteToConference;
77 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::KICK_OUT_CONFERENCE)] =
78 &CsTest::KickOutFromConference;
79 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::HANG_UP_ALL_CONNECTION)] =
80 &CsTest::HangUpAllConnection;
81 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::UPDATE_CALL_MEDIA_MODE)] =
82 &CsTest::UpdateImsCallMode;
83 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::REGISTER_CALLBACK)] =
84 &CsTest::RegisterCallBack;
85 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::UNREGISTER_CALLBACK)] =
86 &CsTest::UnRegisterCallBack;
87 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::START_DTMF)] = &CsTest::StartDtmf;
88 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::STOP_DTMF)] = &CsTest::StopDtmf;
89 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::SEND_DTMF)] = &CsTest::SendDtmf;
90 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::START_RTT)] = &CsTest::StartRtt;
91 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::STOP_RTT)] = &CsTest::StopRtt;
92 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::SET_CALL_TRANSFER)] =
93 &CsTest::SetCallTransferInfo;
94 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::GET_CALL_TRANSFER)] =
95 &CsTest::GetCallTransferInfo;
96 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::SET_CALL_WAITING)] =
97 &CsTest::SetCallWaiting;
98 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::GET_CALL_WAITING)] =
99 &CsTest::GetCallWaiting;
100 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::SET_CALL_RESTRICTION)] =
101 &CsTest::SetCallRestriction;
102 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::GET_CALL_RESTRICTION)] =
103 &CsTest::GetCallRestriction;
104 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::SET_MUTE)] = &CsTest::SetMute;
105 requestFuncMap_[static_cast<int32_t>(CellularCallInterface::OperationType::GET_MUTE)] = &CsTest::GetMute;
106 }
107
TearDown(void)108 void CsTest::TearDown(void)
109 {
110 // step 3: input testcase teardown step
111 }
112
Dial(const sptr<CellularCallInterface> & telephonyService) const113 int32_t CsTest::Dial(const sptr<CellularCallInterface> &telephonyService) const
114 {
115 std::cout << "test Dial entry.\n";
116 CellularCallInfo callInfo;
117 if (memset_s(&callInfo, sizeof(callInfo), 0, sizeof(callInfo)) != EOK) {
118 std::cout << "CellularCallService return, memset_s failed. \n";
119 return TELEPHONY_ERR_ARGUMENT_INVALID;
120 }
121 std::cout << "please enter the phone number:";
122 std::cin >> callInfo.phoneNum;
123 callInfo.videoState = 1;
124 int32_t slotId = 0;
125 std::cout << "please enter the slotId:(0 1)";
126 std::cin >> slotId;
127 callInfo.slotId = slotId;
128 return telephonyService->Dial(callInfo);
129 }
130
HangUp(const sptr<CellularCallInterface> & telephonyService) const131 int32_t CsTest::HangUp(const sptr<CellularCallInterface> &telephonyService) const
132 {
133 std::cout << "test HangUp entry.\n";
134 CellularCallInfo callInfo;
135 if (memset_s(&callInfo, sizeof(callInfo), 0, sizeof(callInfo)) != EOK) {
136 std::cout << "CellularCallService return, memset_s failed. \n";
137 return TELEPHONY_ERR_ARGUMENT_INVALID;
138 }
139
140 std::cout << "please enter the phone number:";
141 std::cin >> callInfo.phoneNum;
142 callInfo.videoState = 1;
143 std::cout << "please enter the call type(0:CS 1:IMS):";
144 int32_t callType = 0;
145 std::cin >> callType;
146 callInfo.callType = static_cast<CallType>(callType);
147 int32_t slotId = 0;
148 std::cout << "please enter the slotId:(0 1)";
149 std::cin >> slotId;
150 callInfo.slotId = slotId;
151 std::cout << "please enter the connect index:";
152 std::cin >> callInfo.index;
153 std::cout << "please enter the type:";
154 int32_t type;
155 std::cin >> type;
156 return telephonyService->HangUp(callInfo, static_cast<CallSupplementType>(type));
157 }
158
Answer(const sptr<CellularCallInterface> & telephonyService) const159 int32_t CsTest::Answer(const sptr<CellularCallInterface> &telephonyService) const
160 {
161 std::cout << "test Answer entry.\n";
162 CellularCallInfo callInfo;
163 if (memset_s(&callInfo, sizeof(callInfo), 0, sizeof(callInfo)) != EOK) {
164 std::cout << "CellularCallService return, memset_s failed. \n";
165 return TELEPHONY_ERR_ARGUMENT_INVALID;
166 }
167
168 std::cout << "please enter the phone number:";
169 std::cin >> callInfo.phoneNum;
170 callInfo.videoState = 1;
171 std::cout << "please enter the call type(0:CS 1:IMS):";
172 int32_t callType = 0;
173 std::cin >> callType;
174 callInfo.callType = static_cast<CallType>(callType);
175 int32_t slotId = 0;
176 std::cout << "please enter the slotId:(0 1)";
177 std::cin >> slotId;
178 callInfo.slotId = slotId;
179 return telephonyService->Answer(callInfo);
180 }
181
Reject(const sptr<CellularCallInterface> & telephonyService) const182 int32_t CsTest::Reject(const sptr<CellularCallInterface> &telephonyService) const
183 {
184 std::cout << "test Reject entry.\n";
185 CellularCallInfo callInfo;
186 if (memset_s(&callInfo, sizeof(callInfo), 0, sizeof(callInfo)) != EOK) {
187 std::cout << "CellularCallService return, memset_s failed. \n";
188 return TELEPHONY_ERR_ARGUMENT_INVALID;
189 }
190
191 std::cout << "please enter the phone number:";
192 std::cin >> callInfo.phoneNum;
193 callInfo.videoState = 1;
194 std::cout << "please enter the call type(0:CS 1:IMS):";
195 int32_t callType = 0;
196 std::cin >> callType;
197 callInfo.callType = static_cast<CallType>(callType);
198 int32_t slotId = 0;
199 std::cout << "please enter the slotId:(0 1)";
200 std::cin >> slotId;
201 callInfo.slotId = slotId;
202 std::cout << "please enter the connect index:";
203 std::cin >> callInfo.index;
204 return telephonyService->Reject(callInfo);
205 }
206
HoldCall(const sptr<CellularCallInterface> & telephonyService) const207 int32_t CsTest::HoldCall(const sptr<CellularCallInterface> &telephonyService) const
208 {
209 std::cout << "test HoldCall entry.\n";
210 CellularCallInfo callInfo;
211 if (memset_s(&callInfo, sizeof(callInfo), 0, sizeof(callInfo)) != EOK) {
212 std::cout << "CellularCallService return, memset_s failed. \n";
213 return TELEPHONY_ERR_ARGUMENT_INVALID;
214 }
215
216 std::cout << "please enter the phone number:";
217 std::cin >> callInfo.phoneNum;
218 callInfo.videoState = 1;
219 std::cout << "please enter the call type(0:CS 1:IMS):";
220 int32_t callType = 0;
221 std::cin >> callType;
222 callInfo.callType = static_cast<CallType>(callType);
223 int32_t slotId = 0;
224 std::cout << "please enter the slotId:(0 1)";
225 std::cin >> slotId;
226 callInfo.slotId = slotId;
227 return telephonyService->HoldCall(callInfo);
228 }
229
UnHoldCall(const sptr<CellularCallInterface> & telephonyService) const230 int32_t CsTest::UnHoldCall(const sptr<CellularCallInterface> &telephonyService) const
231 {
232 std::cout << "test UnHoldCall entry.\n";
233 CellularCallInfo callInfo;
234 if (memset_s(&callInfo, sizeof(callInfo), 0, sizeof(callInfo)) != EOK) {
235 std::cout << "CellularCallService return, memset_s failed. \n";
236 return TELEPHONY_ERR_ARGUMENT_INVALID;
237 }
238
239 std::cout << "please enter the phone number:";
240 std::cin >> callInfo.phoneNum;
241 callInfo.videoState = 1;
242 std::cout << "please enter the call type(0:CS 1:IMS):";
243 int32_t callType = 0;
244 std::cin >> callType;
245 callInfo.callType = static_cast<CallType>(callType);
246 int32_t slotId = 0;
247 std::cout << "please enter the slotId:(0 1)";
248 std::cin >> slotId;
249 callInfo.slotId = slotId;
250 return telephonyService->UnHoldCall(callInfo);
251 }
252
SwitchCall(const sptr<CellularCallInterface> & telephonyService) const253 int32_t CsTest::SwitchCall(const sptr<CellularCallInterface> &telephonyService) const
254 {
255 std::cout << "test SwitchCall entry.\n";
256 CellularCallInfo callInfo;
257 if (memset_s(&callInfo, sizeof(callInfo), 0, sizeof(callInfo)) != EOK) {
258 std::cout << "CellularCallService return, memset_s failed. \n";
259 return TELEPHONY_ERR_ARGUMENT_INVALID;
260 }
261
262 std::cout << "please enter the phone number:";
263 std::cin >> callInfo.phoneNum;
264 callInfo.videoState = 1;
265 std::cout << "please enter the call type(0:CS 1:IMS):";
266 int32_t callType = 0;
267 std::cin >> callType;
268 callInfo.callType = static_cast<CallType>(callType);
269 int32_t slotId = 0;
270 std::cout << "please enter the slotId:(0 1)";
271 std::cin >> slotId;
272 callInfo.slotId = slotId;
273 return telephonyService->SwitchCall(callInfo);
274 }
275
IsEmergencyPhoneNumber(const sptr<CellularCallInterface> & telephonyService) const276 int32_t CsTest::IsEmergencyPhoneNumber(const sptr<CellularCallInterface> &telephonyService) const
277 {
278 std::cout << "test IsEmergencyPhoneNumber entry.\n";
279 std::string phoneNum;
280 std::cout << "input phoneNum: ";
281 std::cin >> phoneNum;
282 std::cout << "input slotId: ";
283 int32_t slotId = 0;
284 std::cin >> slotId;
285 bool enabled = false;
286 telephonyService->IsEmergencyPhoneNumber(slotId, phoneNum, enabled);
287 return enabled;
288 }
289
CombineConference(const sptr<CellularCallInterface> & telephonyService) const290 int32_t CsTest::CombineConference(const sptr<CellularCallInterface> &telephonyService) const
291 {
292 std::cout << "test CombineConference entry." << std::endl;
293 CellularCallInfo callInfo;
294 if (memset_s(&callInfo, sizeof(callInfo), 0, sizeof(callInfo)) != EOK) {
295 std::cout << "CellularCallService return, memset_s failed. \n";
296 return TELEPHONY_ERR_ARGUMENT_INVALID;
297 }
298 std::cout << "please enter the phone number:";
299 std::cin >> callInfo.phoneNum;
300 callInfo.videoState = 1;
301 std::cout << "please enter the call type(0:CS 1:IMS):";
302 int32_t callType = 0;
303 std::cin >> callType;
304 callInfo.callType = static_cast<CallType>(callType);
305 int32_t slotId = 0;
306 std::cout << "please enter the slotId:(0 1)";
307 std::cin >> slotId;
308 callInfo.slotId = slotId;
309 return telephonyService->CombineConference(callInfo);
310 }
311
SeparateConference(const sptr<CellularCallInterface> & telephonyService) const312 int32_t CsTest::SeparateConference(const sptr<CellularCallInterface> &telephonyService) const
313 {
314 std::cout << "test SeparateConference entry." << std::endl;
315 CellularCallInfo callInfo;
316 if (memset_s(&callInfo, sizeof(callInfo), 0, sizeof(callInfo)) != EOK) {
317 std::cout << "CellularCallService return, memset_s failed. \n";
318 return TELEPHONY_ERR_ARGUMENT_INVALID;
319 }
320 std::cout << "please enter the need split phone number:";
321 std::cin >> callInfo.phoneNum;
322 callInfo.videoState = 1;
323 std::cout << "please enter the call type(0:CS 1:IMS):";
324 int32_t callType = 0;
325 std::cin >> callType;
326 callInfo.callType = static_cast<CallType>(callType);
327 int32_t slotId = 0;
328 std::cout << "please enter the slotId:(0 1)";
329 std::cin >> slotId;
330 callInfo.slotId = slotId;
331 std::cout << "please enter the need split index:";
332 std::cin >> callInfo.index;
333 return telephonyService->SeparateConference(callInfo);
334 }
335
InviteToConference(const sptr<CellularCallInterface> & telephonyService) const336 int32_t CsTest::InviteToConference(const sptr<CellularCallInterface> &telephonyService) const
337 {
338 std::cout << "test InviteToConference entry." << std::endl;
339 std::vector<std::string> numberList;
340 std::cout << "please enter the invite phone number:";
341 std::string phoneNum;
342 std::cin >> phoneNum;
343 numberList.push_back(phoneNum);
344 std::cout << "please enter the slotId:";
345 int32_t slotId = 0;
346 return telephonyService->InviteToConference(slotId, numberList);
347 }
348
KickOutFromConference(const sptr<CellularCallInterface> & telephonyService) const349 int32_t CsTest::KickOutFromConference(const sptr<CellularCallInterface> &telephonyService) const
350 {
351 std::cout << "test KickOutFromConference entry." << std::endl;
352 std::vector<std::string> numberList;
353 std::cout << "please enter the kick out phone number:";
354 std::string phoneNum;
355 std::cin >> phoneNum;
356 numberList.push_back(phoneNum);
357 std::cout << "please enter the slotId:";
358 int32_t slotId = 0;
359 return telephonyService->KickOutFromConference(slotId, numberList);
360 }
361
HangUpAllConnection(const sptr<CellularCallInterface> & telephonyService) const362 int32_t CsTest::HangUpAllConnection(const sptr<CellularCallInterface> &telephonyService) const
363 {
364 std::cout << "test HangUpAllConnection entry." << std::endl;
365 return telephonyService->HangUpAllConnection();
366 }
367
UpdateImsCallMode(const sptr<CellularCallInterface> & telephonyService) const368 int32_t CsTest::UpdateImsCallMode(const sptr<CellularCallInterface> &telephonyService) const
369 {
370 std::cout << "test UpdateImsCallMode entry." << std::endl;
371 CellularCallInfo callInfo;
372 if (memset_s(&callInfo, sizeof(callInfo), 0, sizeof(callInfo)) != EOK) {
373 std::cout << "UpdateImsCallMode return, memset_s failed. \n";
374 return TELEPHONY_ERR_ARGUMENT_INVALID;
375 }
376 std::cout << "please enter the need update phone number:";
377 std::cin >> callInfo.phoneNum;
378 callInfo.callType = CallType::TYPE_IMS;
379 int32_t slotId = 0;
380 std::cout << "please enter the slotId:(0 1)";
381 std::cin >> slotId;
382 callInfo.slotId = slotId;
383 std::cout << "please enter the need update index:";
384 std::cin >> callInfo.index;
385 std::cout << "please enter the mode:";
386 int32_t mode = 0;
387 std::cin >> mode;
388 return telephonyService->UpdateImsCallMode(callInfo, static_cast<ImsCallMode>(mode));
389 }
390
RegisterCallBack(const sptr<CellularCallInterface> & telephonyService) const391 int32_t CsTest::RegisterCallBack(const sptr<CellularCallInterface> &telephonyService) const
392 {
393 std::cout << "test RegisterCallBack entry.\n";
394 return CELLULAR_CALL_SUCCESS;
395 }
396
UnRegisterCallBack(const sptr<CellularCallInterface> & telephonyService) const397 int32_t CsTest::UnRegisterCallBack(const sptr<CellularCallInterface> &telephonyService) const
398 {
399 std::cout << "test UnRegisterCallBack entry.\n";
400 return telephonyService->UnRegisterCallManagerCallBack();
401 }
402
StartDtmf(const sptr<CellularCallInterface> & telephonyService) const403 int32_t CsTest::StartDtmf(const sptr<CellularCallInterface> &telephonyService) const
404 {
405 std::cout << "test StartDtmf entry." << std::endl;
406 CellularCallInfo callInfo;
407 if (memset_s(&callInfo, sizeof(callInfo), 0, sizeof(callInfo)) != EOK) {
408 std::cout << "CellularCallService return, memset_s failed. \n";
409 return TELEPHONY_ERR_ARGUMENT_INVALID;
410 }
411 std::cout << "please enter the phone number:";
412 std::cin >> callInfo.phoneNum;
413 callInfo.videoState = 1;
414 std::cout << "please enter the call type(0:CS 1:IMS):";
415 int32_t callType = 0;
416 std::cin >> callType;
417 callInfo.callType = static_cast<CallType>(callType);
418 int32_t slotId = 0;
419 std::cout << "please enter the slotId:(0 1)";
420 std::cin >> slotId;
421 callInfo.slotId = slotId;
422 std::cout << "please enter the index:";
423 std::cin >> callInfo.index;
424 char cDtmfCode;
425 std::cout << "please enter the Dtmf code:";
426 std::cin >> cDtmfCode;
427 return telephonyService->StartDtmf(cDtmfCode, callInfo);
428 }
429
StopDtmf(const sptr<CellularCallInterface> & telephonyService) const430 int32_t CsTest::StopDtmf(const sptr<CellularCallInterface> &telephonyService) const
431 {
432 std::cout << "test StopDtmf entry." << std::endl;
433 CellularCallInfo callInfo;
434 if (memset_s(&callInfo, sizeof(callInfo), 0, sizeof(callInfo)) != EOK) {
435 std::cout << "CellularCallService return, memset_s failed. \n";
436 return TELEPHONY_ERR_ARGUMENT_INVALID;
437 }
438 std::cout << "please enter the phone number:";
439 std::cin >> callInfo.phoneNum;
440 callInfo.videoState = 1;
441 std::cout << "please enter the call type(0:CS 1:IMS):";
442 int32_t callType = 0;
443 std::cin >> callType;
444 callInfo.callType = static_cast<CallType>(callType);
445 int32_t slotId = 0;
446 std::cout << "please enter the slotId:(0 1)";
447 std::cin >> slotId;
448 callInfo.slotId = slotId;
449 std::cout << "please enter the index:";
450 std::cin >> callInfo.index;
451 return telephonyService->StopDtmf(callInfo);
452 }
453
SendDtmf(const sptr<CellularCallInterface> & telephonyService) const454 int32_t CsTest::SendDtmf(const sptr<CellularCallInterface> &telephonyService) const
455 {
456 std::cout << "test SendDtmf entry." << std::endl;
457 CellularCallInfo callInfo;
458 if (memset_s(&callInfo, sizeof(callInfo), 0, sizeof(callInfo)) != EOK) {
459 std::cout << "CellularCallService return, memset_s failed. \n";
460 return TELEPHONY_ERR_ARGUMENT_INVALID;
461 }
462 std::cout << "please enter the phone number:";
463 std::cin >> callInfo.phoneNum;
464 callInfo.videoState = 1;
465 std::cout << "please enter the call type(0:CS 1:IMS):";
466 int32_t callType = 0;
467 std::cin >> callType;
468 callInfo.callType = static_cast<CallType>(callType);
469 int32_t slotId = 0;
470 std::cout << "please enter the slotId:(0 1)";
471 std::cin >> slotId;
472 callInfo.slotId = slotId;
473 std::cout << "please enter the index:";
474 std::cin >> callInfo.index;
475 char cDtmfCode;
476 std::cout << "please enter the Dtmf code:";
477 std::cin >> cDtmfCode;
478 return telephonyService->SendDtmf(cDtmfCode, callInfo);
479 }
480
StartRtt(const sptr<CellularCallInterface> & telephonyService) const481 int32_t CsTest::StartRtt(const sptr<CellularCallInterface> &telephonyService) const
482 {
483 std::cout << "test StartRtt entry." << std::endl;
484 std::string msg;
485 std::cout << "please enter the send msg:";
486 std::cin >> msg;
487 int32_t slotId;
488 std::cout << "please enter the slotId:";
489 std::cin >> slotId;
490 return telephonyService->StartRtt(slotId, msg);
491 }
492
StopRtt(const sptr<CellularCallInterface> & telephonyService) const493 int32_t CsTest::StopRtt(const sptr<CellularCallInterface> &telephonyService) const
494 {
495 std::cout << "test StopRtt entry." << std::endl;
496 int32_t slotId;
497 std::cout << "please enter the slotId:";
498 std::cin >> slotId;
499 return telephonyService->StopRtt(slotId);
500 }
501
SetCallTransferInfo(const sptr<CellularCallInterface> & telephonyService) const502 int32_t CsTest::SetCallTransferInfo(const sptr<CellularCallInterface> &telephonyService) const
503 {
504 std::cout << "test SetCallTransferInfoInfo entry.\n";
505 int32_t slotId = 0;
506 std::cout << "please enter the slotId:(0 1)";
507 std::cin >> slotId;
508 CallTransferInfo callTransferInfo;
509 std::cout << "please enter the transfer type(0 - 5):";
510 int32_t type = 0;
511 std::cin >> type;
512 callTransferInfo.type = static_cast<CallTransferType>(type);
513 std::cout << "please enter the transfer setting type(0 - 4):";
514 int32_t settingType = 0;
515 std::cin >> settingType;
516 callTransferInfo.settingType = static_cast<CallTransferSettingType>(settingType);
517 std::cout << "please enter the phone number:";
518 std::cin >> callTransferInfo.transferNum;
519 return telephonyService->SetCallTransferInfo(slotId, callTransferInfo);
520 }
521
GetCallTransferInfo(const sptr<CellularCallInterface> & telephonyService) const522 int32_t CsTest::GetCallTransferInfo(const sptr<CellularCallInterface> &telephonyService) const
523 {
524 std::cout << "test GetCallTransferInfo entry.\n";
525 int32_t slotId = 0;
526 std::cout << "please enter the slotId:(0 1)";
527 std::cin >> slotId;
528 std::cout << "please enter the transfer type(0 - 5):";
529 int32_t type = 0;
530 std::cin >> type;
531 return telephonyService->GetCallTransferInfo(slotId, static_cast<CallTransferType>(type));
532 }
533
SetCallWaiting(const sptr<CellularCallInterface> & telephonyService) const534 int32_t CsTest::SetCallWaiting(const sptr<CellularCallInterface> &telephonyService) const
535 {
536 std::cout << "test SetCallWaiting entry.\n";
537 bool activate = true;
538 int32_t slotId = 0;
539 std::cout << "please enter the slotId:(0 1)";
540 std::cin >> slotId;
541 return telephonyService->SetCallWaiting(slotId, activate);
542 }
543
GetCallWaiting(const sptr<CellularCallInterface> & telephonyService) const544 int32_t CsTest::GetCallWaiting(const sptr<CellularCallInterface> &telephonyService) const
545 {
546 std::cout << "test GetCallWaiting entry.\n";
547 int32_t slotId = 0;
548 std::cout << "please enter the slotId:(0 1)";
549 std::cin >> slotId;
550 return telephonyService->GetCallWaiting(slotId);
551 }
552
SetCallRestriction(const sptr<CellularCallInterface> & telephonyService) const553 int32_t CsTest::SetCallRestriction(const sptr<CellularCallInterface> &telephonyService) const
554 {
555 std::cout << "test SetCallRestriction entry.\n";
556 int32_t slotId = 0;
557 std::cout << "please enter the slotId:(0 1)";
558 std::cin >> slotId;
559 CallRestrictionInfo info;
560 std::cout << "please enter the fac(0 - 4):";
561 int32_t fac = 0;
562 std::cin >> fac;
563 info.fac = static_cast<CallRestrictionType>(fac);
564 std::cout << "please enter the phone password:";
565 std::cin >> info.password;
566 std::cout << "please enter the mode:";
567 int32_t mode = 0;
568 std::cin >> mode;
569 info.mode = static_cast<CallRestrictionMode>(mode);
570 return telephonyService->SetCallRestriction(slotId, info);
571 }
572
GetCallRestriction(const sptr<CellularCallInterface> & telephonyService) const573 int32_t CsTest::GetCallRestriction(const sptr<CellularCallInterface> &telephonyService) const
574 {
575 std::cout << "test GetCallRestriction entry.\n";
576 int32_t slotId = 0;
577 std::cout << "please enter the slotId:(0 1)";
578 std::cin >> slotId;
579 std::cout << "please enter the fac(0 - 4):";
580 int32_t facType = 0;
581 std::cin >> facType;
582 return telephonyService->GetCallRestriction(slotId, static_cast<CallRestrictionType>(facType));
583 }
584
SetMute(const sptr<CellularCallInterface> & telephonyService) const585 int32_t CsTest::SetMute(const sptr<CellularCallInterface> &telephonyService) const
586 {
587 std::cout << "test SetMute entry.\n";
588 int32_t slotId = 0;
589 std::cout << "please enter the slotId:(0 1)";
590 std::cin >> slotId;
591 std::cout << "please enter the mute(0 - 1):";
592 int32_t mute = -1;
593 std::cin >> mute;
594 return telephonyService->SetMute(slotId, mute);
595 }
596
GetMute(const sptr<CellularCallInterface> & telephonyService) const597 int32_t CsTest::GetMute(const sptr<CellularCallInterface> &telephonyService) const
598 {
599 std::cout << "test GetMute entry.\n";
600 int32_t slotId = 0;
601 std::cout << "please enter the slotId:(0 1)";
602 std::cin >> slotId;
603 return telephonyService->GetMute(slotId);
604 }
605
JudgeIsEmergencyPhoneNumber()606 void CsTest::JudgeIsEmergencyPhoneNumber()
607 {
608 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
609 ASSERT_TRUE(systemAbilityMgr != nullptr);
610 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
611 ASSERT_TRUE(remote != nullptr);
612 auto telephonyService = iface_cast<CellularCallInterface>(remote);
613 ASSERT_TRUE(telephonyService != nullptr);
614
615 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
616 return;
617 }
618 bool enabled = false;
619 int32_t successCode = 1;
620 if (HasSimCard(SIM1_SLOTID)) {
621 telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "499", enabled);
622 EXPECT_EQ(enabled, successCode);
623 telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "443", enabled);
624 EXPECT_EQ(enabled, successCode);
625 telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "356", enabled);
626 EXPECT_EQ(enabled, successCode);
627 telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "975", enabled);
628 EXPECT_EQ(enabled, successCode);
629 telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "783", enabled);
630 EXPECT_EQ(enabled, successCode);
631 telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, "350", enabled);
632 EXPECT_EQ(enabled, successCode);
633 }
634 if (HasSimCard(SIM2_SLOTID)) {
635 telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "499", enabled);
636 EXPECT_EQ(enabled, successCode);
637 telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "443", enabled);
638 EXPECT_EQ(enabled, successCode);
639 telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "356", enabled);
640 EXPECT_EQ(enabled, successCode);
641 telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "975", enabled);
642 EXPECT_EQ(enabled, successCode);
643 telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "783", enabled);
644 EXPECT_EQ(enabled, successCode);
645 telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, "350", enabled);
646 EXPECT_EQ(enabled, successCode);
647 }
648 }
649
InputNumForInterface(const sptr<CellularCallInterface> & telephonyService) const650 int32_t CsTest::InputNumForInterface(const sptr<CellularCallInterface> &telephonyService) const
651 {
652 int32_t ret = -1;
653 bool loopFlag = true;
654 int32_t InputNum = 0;
655 int32_t returnNum = 1000; // end loop variable value
656 while (loopFlag) {
657 std::cout << "\n**********Unit Test Start**********\n"
658 "Usage: please input a cmd num:\n"
659 "1:Dial\n2:HangUp\n3:Reject\n4:Answer\n5:HoldCall\n6:UnHoldCall\n7:SwitchCall\n"
660 "8:IsEmergencyPhoneNumber\n9:CombineConference\n10:SeparateConference\n11:InviteToConference\n"
661 "12:KickOutFromConference\n13:HangUpAllConnection\n14:UpdateImsCallMode\n"
662 "15:RegisterCallBack\n16:UnRegisterCallBack\n100:StartDtmf\n101:StopDtmf\n102:SendDtmf\n"
663 "103:StartRtt\n104:StopRtt\n200:SetCallTransferInfo\n201:GetCallTransferInfo\n"
664 "202:SetCallWaiting\n203:GetCallWaiting\n"
665 "204:SetCallRestriction\n205:GetCallRestriction\n311:SetMute\n312:GetMute\n"
666 "1000:Exit\n"
667 "***********************************\n"
668 "Your choice: ";
669 std::cin >> InputNum;
670 if (InputNum == returnNum) {
671 std::cout << "exiting...\n";
672 break;
673 }
674 auto itFunc = requestFuncMap_.find(InputNum);
675 if (itFunc != requestFuncMap_.end()) {
676 auto requestFunc = itFunc->second;
677 if (requestFunc != nullptr) {
678 ret = (this->*requestFunc)(telephonyService);
679 }
680 }
681 if (ret != CELLULAR_CALL_SUCCESS) {
682 std::cout << "this execution did not return a successful value, please check.\n";
683 return ret;
684 }
685 }
686 return CELLULAR_CALL_SUCCESS;
687 }
688
689 /**
690 * @tc.number cellular_call_cs_test_001
691 * @tc.name Test the corresponding functions by entering commands, such as 1 -- Dial, 2 -- Hangup, 3 -- Reject, etc
692 * @tc.desc Function test
693 */
694 HWTEST_F(CsTest, cellular_call_cs_test_001, Function | MediumTest | Level0)
695 {
696 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
697 ASSERT_TRUE(systemAbilityMgr != nullptr);
698 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
699 ASSERT_TRUE(remote != nullptr);
700 auto telephonyService = iface_cast<CellularCallInterface>(remote);
701 ASSERT_TRUE(telephonyService != nullptr);
702 std::cout << "HWTEST_F cellular_call_cs_test_001";
703 }
704
705 /**
706 * @tc.number cellular_call_cs_test_002
707 * @tc.name Test the corresponding functions by entering commands, such as 1 -- Dial, 2 -- Hangup, 3 -- Reject, etc
708 * @tc.desc Function test
709 */
710 HWTEST_F(CsTest, cellular_call_cs_test_002, Function | MediumTest | Level1)
711 {
712 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
713 ASSERT_TRUE(systemAbilityMgr != nullptr);
714 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
715 ASSERT_TRUE(remote != nullptr);
716 auto telephonyService = iface_cast<CellularCallInterface>(remote);
717 ASSERT_TRUE(telephonyService != nullptr);
718 std::cout << "HWTEST_F cellular_call_cs_test_002";
719 }
720
721 /**
722 * @tc.number Telephony_CallManager_SetEmergencyCallList_0101
723 * @tc.name SetEmergencyCallList "443,356,789",test SetEmergencyCallList(),return success
724 * @tc.desc Function test
725 */
726 HWTEST_F(CsTest, cellular_call_SetEmergencyCallList_0101, Function | MediumTest | Level3)
727 {
728 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
729 ASSERT_TRUE(systemAbilityMgr != nullptr);
730 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
731 ASSERT_TRUE(remote != nullptr);
732 auto telephonyService = iface_cast<CellularCallInterface>(remote);
733 ASSERT_TRUE(telephonyService != nullptr);
734
735 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
736 return;
737 }
738
739 std::vector<EmergencyCall> eccVec;
740 EmergencyCall temp0 = { "499", "460", EccType::TYPE_CATEGORY, SimpresentType::TYPE_NO_CARD,
741 AbnormalServiceType::TYPE_ALL };
742 EmergencyCall temp1 = { "443", "460", EccType::TYPE_POLICE, SimpresentType::TYPE_NO_CARD,
743 AbnormalServiceType::TYPE_ALL };
744 EmergencyCall temp2 = { "356", "460", EccType::TYPE_AMBULANCE, SimpresentType::TYPE_NO_CARD,
745 AbnormalServiceType::TYPE_ALL };
746 EmergencyCall temp3 = { "783", "460", EccType::TYPE_FIRE, SimpresentType::TYPE_NO_CARD,
747 AbnormalServiceType::TYPE_ALL };
748 EmergencyCall temp4 = { "975", "460", EccType::TYPE_SEA, SimpresentType::TYPE_HAS_CARD,
749 AbnormalServiceType::TYPE_ONLY_CS };
750 EmergencyCall temp5 = { "350", "460", EccType::TYPE_MOUNTAIN, SimpresentType::TYPE_HAS_CARD,
751 AbnormalServiceType::TYPE_ALL };
752 eccVec.push_back(temp0);
753 eccVec.push_back(temp1);
754 eccVec.push_back(temp2);
755 eccVec.push_back(temp3);
756 eccVec.push_back(temp4);
757 eccVec.push_back(temp5);
758 if (HasSimCard(SIM1_SLOTID)) {
759 EXPECT_EQ(telephonyService->SetEmergencyCallList(SIM1_SLOTID, eccVec), 0);
760 }
761 if (HasSimCard(SIM2_SLOTID)) {
762 EXPECT_EQ(telephonyService->SetEmergencyCallList(SIM2_SLOTID, eccVec), 0);
763 }
764 JudgeIsEmergencyPhoneNumber();
765 }
766
767 HWTEST_F(CsTest, cellular_call_IsOperatorConfigEmergencyCallList_0001, Function | MediumTest | Level3)
768 {
769 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
770 ASSERT_TRUE(systemAbilityMgr != nullptr);
771 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
772 ASSERT_TRUE(remote != nullptr);
773 auto telephonyService = iface_cast<CellularCallInterface>(remote);
774 ASSERT_TRUE(telephonyService != nullptr);
775
776 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
777 return;
778 }
779 OperatorConfig opc;
780 if (HasSimCard(SIM1_SLOTID)) {
781 DelayedRefSingleton<CoreServiceClient>::GetInstance().GetOperatorConfigs(SIM1_SLOTID, opc);
782 if (opc.stringArrayValue.find(KEY_EMERGENCY_CALL_STRING_ARRAY) != opc.stringArrayValue.end()) {
783 for (auto number : opc.stringArrayValue[KEY_EMERGENCY_CALL_STRING_ARRAY]) {
784 bool enabled = false;
785 int32_t errorCode = telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, number, enabled);
786 EXPECT_EQ(TELEPHONY_SUCCESS, errorCode);
787 }
788 }
789 }
790 if (HasSimCard(SIM2_SLOTID)) {
791 DelayedRefSingleton<CoreServiceClient>::GetInstance().GetOperatorConfigs(SIM2_SLOTID, opc);
792 if (opc.stringArrayValue.find(KEY_EMERGENCY_CALL_STRING_ARRAY) != opc.stringArrayValue.end()) {
793 for (auto number : opc.stringArrayValue[KEY_EMERGENCY_CALL_STRING_ARRAY]) {
794 bool enabled = false;
795 int32_t errorCode = telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, number, enabled);
796 EXPECT_EQ(TELEPHONY_SUCCESS, errorCode);
797 }
798 }
799 }
800 }
801
802 /**
803 * @tc.number cellular_call_DialCall_0001
804 * @tc.name Test for SetClip function by cs
805 * @tc.desc Function test
806 */
807 HWTEST_F(CsTest, cellular_call_DialCall_0001, Function | MediumTest | Level2)
808 {
809 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
810 return;
811 }
812 if (HasSimCard(SIM1_SLOTID)) {
813 int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*30#");
814 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
815 }
816 if (HasSimCard(SIM2_SLOTID)) {
817 int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*30#");
818 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
819 }
820 }
821
822 /**
823 * @tc.number cellular_call_DialCall_0002
824 * @tc.name Test for SetClip function by cs
825 * @tc.desc Function test
826 */
827 HWTEST_F(CsTest, cellular_call_DialCall_0002, Function | MediumTest | Level2)
828 {
829 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
830 return;
831 }
832 if (HasSimCard(SIM1_SLOTID)) {
833 int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#30#");
834 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
835 }
836 if (HasSimCard(SIM2_SLOTID)) {
837 int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#30#");
838 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
839 }
840 }
841
842 /**
843 * @tc.number cellular_call_DialCall_0003
844 * @tc.name Test for getClip function by cs
845 * @tc.desc Function test
846 */
847 HWTEST_F(CsTest, cellular_call_DialCall_0003, Function | MediumTest | Level2)
848 {
849 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
850 return;
851 }
852 if (HasSimCard(SIM1_SLOTID)) {
853 int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#30#");
854 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
855 }
856 if (HasSimCard(SIM2_SLOTID)) {
857 int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#30#");
858 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
859 }
860 }
861
862 /**
863 * @tc.number cellular_call_DialCall_0004
864 * @tc.name Test for SetClir function by cs
865 * @tc.desc Function test
866 */
867 HWTEST_F(CsTest, cellular_call_DialCall_0004, Function | MediumTest | Level2)
868 {
869 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
870 return;
871 }
872 if (HasSimCard(SIM1_SLOTID)) {
873 int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*31#");
874 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
875 }
876 if (HasSimCard(SIM2_SLOTID)) {
877 int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*31#");
878 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
879 }
880 }
881
882 /**
883 * @tc.number cellular_call_DialCall_0005
884 * @tc.name Test for SetClir function by cs
885 * @tc.desc Function test
886 */
887 HWTEST_F(CsTest, cellular_call_DialCall_0005, Function | MediumTest | Level2)
888 {
889 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
890 return;
891 }
892 if (HasSimCard(SIM1_SLOTID)) {
893 int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#31#");
894 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
895 }
896 if (HasSimCard(SIM2_SLOTID)) {
897 int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#31#");
898 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
899 }
900 }
901
902 /**
903 * @tc.number cellular_call_DialCall_0006
904 * @tc.name Test for GetClir function by cs
905 * @tc.desc Function test
906 */
907 HWTEST_F(CsTest, cellular_call_DialCall_0006, Function | MediumTest | Level2)
908 {
909 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
910 return;
911 }
912 if (HasSimCard(SIM1_SLOTID)) {
913 int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#31#");
914 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
915 }
916 if (HasSimCard(SIM2_SLOTID)) {
917 int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#31#");
918 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
919 }
920 }
921
922 /**
923 * @tc.number cellular_call_DialCall_0007
924 * @tc.name Test for SetCallTransfer function by cs
925 * @tc.desc Function test
926 */
927 HWTEST_F(CsTest, cellular_call_DialCall_0007, Function | MediumTest | Level2)
928 {
929 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
930 return;
931 }
932 if (HasSimCard(SIM1_SLOTID)) {
933 int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*21#");
934 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
935 }
936 if (HasSimCard(SIM2_SLOTID)) {
937 int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*21#");
938 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
939 }
940 }
941
942 /**
943 * @tc.number cellular_call_DialCall_0008
944 * @tc.name Test for SetCallTransfer function by cs
945 * @tc.desc Function test
946 */
947 HWTEST_F(CsTest, cellular_call_DialCall_0008, Function | MediumTest | Level2)
948 {
949 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
950 return;
951 }
952 if (HasSimCard(SIM1_SLOTID)) {
953 int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#21#");
954 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
955 }
956 if (HasSimCard(SIM2_SLOTID)) {
957 int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#21#");
958 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
959 }
960 }
961
962 /**
963 * @tc.number cellular_call_DialCall_0009
964 * @tc.name Test for GetCallTransfer function by cs
965 * @tc.desc Function test
966 */
967 HWTEST_F(CsTest, cellular_call_DialCall_0009, Function | MediumTest | Level2)
968 {
969 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
970 return;
971 }
972 if (HasSimCard(SIM1_SLOTID)) {
973 int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#21#");
974 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
975 }
976 if (HasSimCard(SIM2_SLOTID)) {
977 int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#21#");
978 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
979 }
980 }
981
982 /**
983 * @tc.number cellular_call_DialCall_0010
984 * @tc.name Test for SetCallRestriction function by cs
985 * @tc.desc Function test
986 */
987 HWTEST_F(CsTest, cellular_call_DialCall_0010, Function | MediumTest | Level2)
988 {
989 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
990 return;
991 }
992 if (HasSimCard(SIM1_SLOTID)) {
993 int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*33#");
994 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
995 }
996 if (HasSimCard(SIM2_SLOTID)) {
997 int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*33#");
998 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
999 }
1000 }
1001
1002 /**
1003 * @tc.number cellular_call_DialCall_0011
1004 * @tc.name Test for SetCallRestriction function by cs
1005 * @tc.desc Function test
1006 */
1007 HWTEST_F(CsTest, cellular_call_DialCall_0011, Function | MediumTest | Level2)
1008 {
1009 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1010 return;
1011 }
1012 if (HasSimCard(SIM1_SLOTID)) {
1013 int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#33#");
1014 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1015 }
1016 if (HasSimCard(SIM2_SLOTID)) {
1017 int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#33#");
1018 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1019 }
1020 }
1021
1022 /**
1023 * @tc.number cellular_call_DialCall_0012
1024 * @tc.name Test for GetCallRestriction function by cs
1025 * @tc.desc Function test
1026 */
1027 HWTEST_F(CsTest, cellular_call_DialCall_0012, Function | MediumTest | Level2)
1028 {
1029 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1030 return;
1031 }
1032 if (HasSimCard(SIM1_SLOTID)) {
1033 int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#33#");
1034 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1035 }
1036 if (HasSimCard(SIM2_SLOTID)) {
1037 int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#33#");
1038 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1039 }
1040 }
1041
1042 /**
1043 * @tc.number cellular_call_DialCall_0013
1044 * @tc.name Test for SetCallWaiting function by cs
1045 * @tc.desc Function test
1046 */
1047 HWTEST_F(CsTest, cellular_call_DialCall_0013, Function | MediumTest | Level2)
1048 {
1049 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1050 return;
1051 }
1052 if (HasSimCard(SIM1_SLOTID)) {
1053 int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*43#");
1054 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1055 }
1056 if (HasSimCard(SIM2_SLOTID)) {
1057 int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*43#");
1058 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1059 }
1060 }
1061
1062 /**
1063 * @tc.number cellular_call_DialCall_0014
1064 * @tc.name Test for SetCallWaiting function by cs
1065 * @tc.desc Function test
1066 */
1067 HWTEST_F(CsTest, cellular_call_DialCall_0014, Function | MediumTest | Level2)
1068 {
1069 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1070 return;
1071 }
1072 if (HasSimCard(SIM1_SLOTID)) {
1073 int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#43#");
1074 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1075 }
1076 if (HasSimCard(SIM2_SLOTID)) {
1077 int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#43#");
1078 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1079 }
1080 }
1081
1082 /**
1083 * @tc.number cellular_call_DialCall_0015
1084 * @tc.name Test for GetCallWaiting function by cs
1085 * @tc.desc Function test
1086 */
1087 HWTEST_F(CsTest, cellular_call_DialCall_0015, Function | MediumTest | Level2)
1088 {
1089 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1090 return;
1091 }
1092 if (HasSimCard(SIM1_SLOTID)) {
1093 int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#43#");
1094 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1095 }
1096 if (HasSimCard(SIM2_SLOTID)) {
1097 int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#43#");
1098 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1099 }
1100 }
1101
1102 /**
1103 * @tc.number cellular_call_DialCall_0016
1104 * @tc.name Test for AlterPinPassword function by cs
1105 * @tc.desc Function test
1106 */
1107 HWTEST_F(CsTest, cellular_call_DialCall_0016, Function | MediumTest | Level2)
1108 {
1109 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1110 return;
1111 }
1112 if (HasSimCard(SIM1_SLOTID)) {
1113 int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*04#");
1114 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1115 }
1116 if (HasSimCard(SIM2_SLOTID)) {
1117 int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*04#");
1118 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1119 }
1120 }
1121
1122 /**
1123 * @tc.number cellular_call_DialCall_0017
1124 * @tc.name Test for UnlockPuk function by cs
1125 * @tc.desc Function test
1126 */
1127 HWTEST_F(CsTest, cellular_call_DialCall_0017, Function | MediumTest | Level2)
1128 {
1129 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1130 return;
1131 }
1132 if (HasSimCard(SIM1_SLOTID)) {
1133 int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*05#");
1134 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1135 }
1136 if (HasSimCard(SIM2_SLOTID)) {
1137 int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*05#");
1138 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1139 }
1140 }
1141
1142 /**
1143 * @tc.number cellular_call_DialCall_0018
1144 * @tc.name Test for AlterPin2Password function by cs
1145 * @tc.desc Function test
1146 */
1147 HWTEST_F(CsTest, cellular_call_DialCall_0018, Function | MediumTest | Level2)
1148 {
1149 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1150 return;
1151 }
1152 if (HasSimCard(SIM1_SLOTID)) {
1153 int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*042#");
1154 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1155 }
1156 if (HasSimCard(SIM2_SLOTID)) {
1157 int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*042#");
1158 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1159 }
1160 }
1161
1162 /**
1163 * @tc.number cellular_call_DialCall_0019
1164 * @tc.name Test for UnlockPuk2 function by cs
1165 * @tc.desc Function test
1166 */
1167 HWTEST_F(CsTest, cellular_call_DialCall_0019, Function | MediumTest | Level2)
1168 {
1169 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1170 return;
1171 }
1172 if (HasSimCard(SIM1_SLOTID)) {
1173 int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*052#");
1174 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1175 }
1176 if (HasSimCard(SIM2_SLOTID)) {
1177 int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*052#");
1178 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1179 }
1180 }
1181
1182 /**
1183 * @tc.number cellular_call_DialCall_0020
1184 * @tc.name Test for SendUssd function by cs
1185 * @tc.desc Function test
1186 */
1187 HWTEST_F(CsTest, cellular_call_DialCall_0020, Function | MediumTest | Level2)
1188 {
1189 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1190 return;
1191 }
1192 if (HasSimCard(SIM1_SLOTID)) {
1193 int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*4444#");
1194 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1195 }
1196 if (HasSimCard(SIM2_SLOTID)) {
1197 int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*4444#");
1198 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1199 }
1200 }
1201
1202 /**
1203 * @tc.number cellular_call_DialCall_0021
1204 * @tc.name Test for dial function with invalid slot by cs
1205 * @tc.desc Function test
1206 */
1207 HWTEST_F(CsTest, cellular_call_DialCall_0021, Function | MediumTest | Level2)
1208 {
1209 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1210 return;
1211 }
1212 if (HasSimCard(SIM1_SLOTID)) {
1213 int32_t ret = TestDialCallByCs(INVALID_SLOTID, PHONE_NUMBER);
1214 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1215 }
1216 if (HasSimCard(SIM2_SLOTID)) {
1217 int32_t ret = TestDialCallByCs(INVALID_SLOTID, PHONE_NUMBER);
1218 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1219 }
1220 }
1221
1222 /**
1223 * @tc.number cellular_call_HangUpCall_0001
1224 * @tc.name Test for HangUp function by cs
1225 * @tc.desc Function test
1226 */
1227 HWTEST_F(CsTest, cellular_call_HangUpCall_0001, Function | MediumTest | Level2)
1228 {
1229 AccessToken token;
1230 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1231 ASSERT_TRUE(systemAbilityMgr != nullptr);
1232 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1233 ASSERT_TRUE(remote != nullptr);
1234 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1235 ASSERT_TRUE(telephonyService != nullptr);
1236 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1237 return;
1238 }
1239 if (HasSimCard(SIM1_SLOTID)) {
1240 CellularCallInfo callInfo;
1241 int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
1242 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1243 ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_DEFAULT);
1244 EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
1245 ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE);
1246 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1247 }
1248 if (HasSimCard(SIM2_SLOTID)) {
1249 CellularCallInfo callInfo;
1250 int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
1251 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1252 ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_DEFAULT);
1253 EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
1254 ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE);
1255 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1256 }
1257 }
1258
1259 /**
1260 * @tc.number cellular_call_HangUpCall_0002
1261 * @tc.name Test for HangUp function with invalid slot by cs
1262 * @tc.desc Function test
1263 */
1264 HWTEST_F(CsTest, cellular_call_HangUpCall_0002, Function | MediumTest | Level2)
1265 {
1266 AccessToken token;
1267 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1268 ASSERT_TRUE(systemAbilityMgr != nullptr);
1269 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1270 ASSERT_TRUE(remote != nullptr);
1271 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1272 ASSERT_TRUE(telephonyService != nullptr);
1273 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1274 return;
1275 }
1276 if (HasSimCard(SIM1_SLOTID)) {
1277 CellularCallInfo callInfo;
1278 int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1279 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1280 ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_DEFAULT);
1281 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1282 }
1283 if (HasSimCard(SIM2_SLOTID)) {
1284 CellularCallInfo callInfo;
1285 int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1286 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1287 ret = telephonyService->HangUp(callInfo, CallSupplementType::TYPE_DEFAULT);
1288 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1289 }
1290 }
1291
1292 /**
1293 * @tc.number cellular_call_AnswerCall_0001
1294 * @tc.name Test for answer function by cs
1295 * @tc.desc Function test
1296 */
1297 HWTEST_F(CsTest, cellular_call_AnswerCall_0001, Function | MediumTest | Level2)
1298 {
1299 AccessToken token;
1300 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1301 ASSERT_TRUE(systemAbilityMgr != nullptr);
1302 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1303 ASSERT_TRUE(remote != nullptr);
1304 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1305 ASSERT_TRUE(telephonyService != nullptr);
1306 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1307 return;
1308 }
1309 if (HasSimCard(SIM1_SLOTID)) {
1310 CellularCallInfo callInfo;
1311 int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
1312 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1313 ret = telephonyService->Answer(callInfo);
1314 EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
1315 }
1316 if (HasSimCard(SIM2_SLOTID)) {
1317 CellularCallInfo callInfo;
1318 int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
1319 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1320 ret = telephonyService->Answer(callInfo);
1321 EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
1322 }
1323 }
1324
1325 /**
1326 * @tc.number cellular_call_AnswerCall_0002
1327 * @tc.name Test for answer function with invalid slot by cs
1328 * @tc.desc Function test
1329 */
1330 HWTEST_F(CsTest, cellular_call_AnswerCall_0002, Function | MediumTest | Level2)
1331 {
1332 AccessToken token;
1333 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1334 ASSERT_TRUE(systemAbilityMgr != nullptr);
1335 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1336 ASSERT_TRUE(remote != nullptr);
1337 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1338 ASSERT_TRUE(telephonyService != nullptr);
1339 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1340 return;
1341 }
1342 if (HasSimCard(SIM1_SLOTID)) {
1343 CellularCallInfo callInfo;
1344 int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1345 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1346 ret = telephonyService->Answer(callInfo);
1347 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1348 }
1349 if (HasSimCard(SIM2_SLOTID)) {
1350 CellularCallInfo callInfo;
1351 int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1352 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1353 ret = telephonyService->Answer(callInfo);
1354 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1355 }
1356 }
1357
1358 /**
1359 * @tc.number cellular_call_RejectCall_0001
1360 * @tc.name Test for reject function by cs
1361 * @tc.desc Function test
1362 */
1363 HWTEST_F(CsTest, cellular_call_RejectCall_0001, Function | MediumTest | Level2)
1364 {
1365 AccessToken token;
1366 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1367 ASSERT_TRUE(systemAbilityMgr != nullptr);
1368 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1369 ASSERT_TRUE(remote != nullptr);
1370 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1371 ASSERT_TRUE(telephonyService != nullptr);
1372 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1373 return;
1374 }
1375 if (HasSimCard(SIM1_SLOTID)) {
1376 CellularCallInfo callInfo;
1377 int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
1378 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1379 ret = telephonyService->Reject(callInfo);
1380 EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
1381 }
1382 if (HasSimCard(SIM2_SLOTID)) {
1383 CellularCallInfo callInfo;
1384 int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
1385 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1386 ret = telephonyService->Reject(callInfo);
1387 EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
1388 }
1389 }
1390
1391 /**
1392 * @tc.number cellular_call_RejectCall_0002
1393 * @tc.name Test for reject function with invalid slot by cs
1394 * @tc.desc Function test
1395 */
1396 HWTEST_F(CsTest, cellular_call_RejectCall_0002, Function | MediumTest | Level2)
1397 {
1398 AccessToken token;
1399 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1400 ASSERT_TRUE(systemAbilityMgr != nullptr);
1401 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1402 ASSERT_TRUE(remote != nullptr);
1403 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1404 ASSERT_TRUE(telephonyService != nullptr);
1405 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1406 return;
1407 }
1408 if (HasSimCard(SIM1_SLOTID)) {
1409 CellularCallInfo callInfo;
1410 int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1411 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1412 ret = telephonyService->Reject(callInfo);
1413 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1414 }
1415 if (HasSimCard(SIM2_SLOTID)) {
1416 CellularCallInfo callInfo;
1417 int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1418 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1419 ret = telephonyService->Reject(callInfo);
1420 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1421 }
1422 }
1423
1424 /**
1425 * @tc.number cellular_call_HoldCall_0001
1426 * @tc.name Test for hold call function by cs
1427 * @tc.desc Function test
1428 */
1429 HWTEST_F(CsTest, cellular_call_HoldCall_0001, Function | MediumTest | Level2)
1430 {
1431 AccessToken token;
1432 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1433 ASSERT_TRUE(systemAbilityMgr != nullptr);
1434 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1435 ASSERT_TRUE(remote != nullptr);
1436 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1437 ASSERT_TRUE(telephonyService != nullptr);
1438 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1439 return;
1440 }
1441 if (HasSimCard(SIM1_SLOTID)) {
1442 CellularCallInfo callInfo;
1443 int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
1444 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1445 ret = telephonyService->HoldCall(callInfo);
1446 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1447 }
1448 if (HasSimCard(SIM2_SLOTID)) {
1449 CellularCallInfo callInfo;
1450 int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
1451 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1452 ret = telephonyService->HoldCall(callInfo);
1453 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1454 }
1455 }
1456
1457 /**
1458 * @tc.number cellular_call_HoldCall_0002
1459 * @tc.name Test for hold function with invalid slot by cs
1460 * @tc.desc Function test
1461 */
1462 HWTEST_F(CsTest, cellular_call_HoldCall_0002, Function | MediumTest | Level2)
1463 {
1464 AccessToken token;
1465 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1466 ASSERT_TRUE(systemAbilityMgr != nullptr);
1467 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1468 ASSERT_TRUE(remote != nullptr);
1469 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1470 ASSERT_TRUE(telephonyService != nullptr);
1471 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1472 return;
1473 }
1474 if (HasSimCard(SIM1_SLOTID)) {
1475 CellularCallInfo callInfo;
1476 int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1477 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1478 ret = telephonyService->HoldCall(callInfo);
1479 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1480 }
1481 if (HasSimCard(SIM2_SLOTID)) {
1482 CellularCallInfo callInfo;
1483 int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1484 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1485 ret = telephonyService->HoldCall(callInfo);
1486 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1487 }
1488 }
1489
1490 /**
1491 * @tc.number cellular_call_UnHoldCall_0001
1492 * @tc.name Test for unhold call function by cs
1493 * @tc.desc Function test
1494 */
1495 HWTEST_F(CsTest, cellular_call_UnHoldCall_0001, Function | MediumTest | Level2)
1496 {
1497 AccessToken token;
1498 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1499 ASSERT_TRUE(systemAbilityMgr != nullptr);
1500 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1501 ASSERT_TRUE(remote != nullptr);
1502 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1503 ASSERT_TRUE(telephonyService != nullptr);
1504 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1505 return;
1506 }
1507 if (HasSimCard(SIM1_SLOTID)) {
1508 CellularCallInfo callInfo;
1509 int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
1510 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1511 ret = telephonyService->UnHoldCall(callInfo);
1512 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1513 }
1514 if (HasSimCard(SIM2_SLOTID)) {
1515 CellularCallInfo callInfo;
1516 int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
1517 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1518 ret = telephonyService->UnHoldCall(callInfo);
1519 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1520 }
1521 }
1522
1523 /**
1524 * @tc.number cellular_call_UnHoldCall_0002
1525 * @tc.name Test for unhold function with invalid slot by cs
1526 * @tc.desc Function test
1527 */
1528 HWTEST_F(CsTest, cellular_call_UnHoldCall_0002, Function | MediumTest | Level2)
1529 {
1530 AccessToken token;
1531 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1532 ASSERT_TRUE(systemAbilityMgr != nullptr);
1533 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1534 ASSERT_TRUE(remote != nullptr);
1535 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1536 ASSERT_TRUE(telephonyService != nullptr);
1537 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1538 return;
1539 }
1540 if (HasSimCard(SIM1_SLOTID)) {
1541 CellularCallInfo callInfo;
1542 int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1543 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1544 ret = telephonyService->UnHoldCall(callInfo);
1545 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1546 }
1547 if (HasSimCard(SIM2_SLOTID)) {
1548 CellularCallInfo callInfo;
1549 int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1550 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1551 ret = telephonyService->UnHoldCall(callInfo);
1552 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1553 }
1554 }
1555
1556 /**
1557 * @tc.number cellular_call_SwitchCall_0001
1558 * @tc.name Test for switch call function by cs
1559 * @tc.desc Function test
1560 */
1561 HWTEST_F(CsTest, cellular_call_SwitchCall_0001, Function | MediumTest | Level2)
1562 {
1563 AccessToken token;
1564 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1565 ASSERT_TRUE(systemAbilityMgr != nullptr);
1566 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1567 ASSERT_TRUE(remote != nullptr);
1568 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1569 ASSERT_TRUE(telephonyService != nullptr);
1570 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1571 return;
1572 }
1573 if (HasSimCard(SIM1_SLOTID)) {
1574 CellularCallInfo callInfo;
1575 int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
1576 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1577 ret = telephonyService->SwitchCall(callInfo);
1578 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1579 }
1580 if (HasSimCard(SIM2_SLOTID)) {
1581 CellularCallInfo callInfo;
1582 int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
1583 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1584 ret = telephonyService->SwitchCall(callInfo);
1585 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1586 }
1587 }
1588
1589 /**
1590 * @tc.number cellular_call_SwitchCall_0002
1591 * @tc.name Test for switch function with invalid slot by cs
1592 * @tc.desc Function test
1593 */
1594 HWTEST_F(CsTest, cellular_call_SwitchCall_0002, Function | MediumTest | Level2)
1595 {
1596 AccessToken token;
1597 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1598 ASSERT_TRUE(systemAbilityMgr != nullptr);
1599 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1600 ASSERT_TRUE(remote != nullptr);
1601 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1602 ASSERT_TRUE(telephonyService != nullptr);
1603 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1604 return;
1605 }
1606 if (HasSimCard(SIM1_SLOTID)) {
1607 CellularCallInfo callInfo;
1608 int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1609 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1610 ret = telephonyService->SwitchCall(callInfo);
1611 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1612 }
1613 if (HasSimCard(SIM2_SLOTID)) {
1614 CellularCallInfo callInfo;
1615 int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1616 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1617 ret = telephonyService->SwitchCall(callInfo);
1618 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1619 }
1620 }
1621
1622 /**
1623 * @tc.number cellular_call_CombineConference_0001
1624 * @tc.name Test for combineConference function by cs
1625 * @tc.desc Function test
1626 */
1627 HWTEST_F(CsTest, cellular_call_CombineConference_0001, Function | MediumTest | Level2)
1628 {
1629 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1630 ASSERT_TRUE(systemAbilityMgr != nullptr);
1631 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1632 ASSERT_TRUE(remote != nullptr);
1633 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1634 ASSERT_TRUE(telephonyService != nullptr);
1635 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1636 return;
1637 }
1638 if (HasSimCard(SIM1_SLOTID)) {
1639 CellularCallInfo callInfo;
1640 int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
1641 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1642 ret = telephonyService->CombineConference(callInfo);
1643 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1644 }
1645 if (HasSimCard(SIM2_SLOTID)) {
1646 CellularCallInfo callInfo;
1647 int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
1648 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1649 ret = telephonyService->CombineConference(callInfo);
1650 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1651 }
1652 }
1653
1654 /**
1655 * @tc.number cellular_call_CombineConference_0002
1656 * @tc.name Test for combineConference function with invalid slot by cs
1657 * @tc.desc Function test
1658 */
1659 HWTEST_F(CsTest, cellular_call_CombineConference_0002, Function | MediumTest | Level2)
1660 {
1661 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1662 ASSERT_TRUE(systemAbilityMgr != nullptr);
1663 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1664 ASSERT_TRUE(remote != nullptr);
1665 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1666 ASSERT_TRUE(telephonyService != nullptr);
1667 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1668 return;
1669 }
1670 if (HasSimCard(SIM1_SLOTID)) {
1671 CellularCallInfo callInfo;
1672 int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1673 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1674 ret = telephonyService->CombineConference(callInfo);
1675 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1676 }
1677 if (HasSimCard(SIM2_SLOTID)) {
1678 CellularCallInfo callInfo;
1679 int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1680 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1681 ret = telephonyService->CombineConference(callInfo);
1682 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1683 }
1684 }
1685
1686 /**
1687 * @tc.number cellular_call_SeparateConference_0001
1688 * @tc.name Test for separateConference function by cs
1689 * @tc.desc Function test
1690 */
1691 HWTEST_F(CsTest, cellular_call_SeparateConference_0001, Function | MediumTest | Level2)
1692 {
1693 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1694 ASSERT_TRUE(systemAbilityMgr != nullptr);
1695 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1696 ASSERT_TRUE(remote != nullptr);
1697 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1698 ASSERT_TRUE(telephonyService != nullptr);
1699 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1700 return;
1701 }
1702 if (HasSimCard(SIM1_SLOTID)) {
1703 CellularCallInfo callInfo;
1704 int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
1705 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1706 ret = telephonyService->SeparateConference(callInfo);
1707 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1708 }
1709 if (HasSimCard(SIM2_SLOTID)) {
1710 CellularCallInfo callInfo;
1711 int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
1712 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1713 ret = telephonyService->SeparateConference(callInfo);
1714 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1715 }
1716 }
1717
1718 /**
1719 * @tc.number cellular_call_SeparateConference_0002
1720 * @tc.name Test for separateConference function with invalid slot by cs
1721 * @tc.desc Function test
1722 */
1723 HWTEST_F(CsTest, cellular_call_SeparateConference_0002, Function | MediumTest | Level2)
1724 {
1725 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1726 ASSERT_TRUE(systemAbilityMgr != nullptr);
1727 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1728 ASSERT_TRUE(remote != nullptr);
1729 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1730 ASSERT_TRUE(telephonyService != nullptr);
1731 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1732 return;
1733 }
1734 if (HasSimCard(SIM1_SLOTID)) {
1735 CellularCallInfo callInfo;
1736 int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1737 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1738 ret = telephonyService->SeparateConference(callInfo);
1739 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1740 }
1741 if (HasSimCard(SIM2_SLOTID)) {
1742 CellularCallInfo callInfo;
1743 int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1744 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1745 ret = telephonyService->SeparateConference(callInfo);
1746 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1747 }
1748 }
1749
1750 /**
1751 * @tc.number cellular_call_HangUpAllConnection_0001
1752 * @tc.name Test for hangup all connection function by cs
1753 * @tc.desc Function test
1754 */
1755 HWTEST_F(CsTest, cellular_call_HangUpAllConnection_0001, Function | MediumTest | Level2)
1756 {
1757 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1758 ASSERT_TRUE(systemAbilityMgr != nullptr);
1759 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1760 ASSERT_TRUE(remote != nullptr);
1761 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1762 ASSERT_TRUE(telephonyService != nullptr);
1763 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1764 return;
1765 }
1766 if (HasSimCard(SIM1_SLOTID)) {
1767 int32_t ret = telephonyService->HangUpAllConnection();
1768 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1769 }
1770 if (HasSimCard(SIM2_SLOTID)) {
1771 int32_t ret = telephonyService->HangUpAllConnection();
1772 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1773 }
1774 }
1775
1776 /**
1777 * @tc.number cellular_call_StartDtmf_0001
1778 * @tc.name Test for startDtmf function by cs
1779 * @tc.desc Function test
1780 */
1781 HWTEST_F(CsTest, cellular_call_StartDtmf_0001, Function | MediumTest | Level2)
1782 {
1783 AccessToken token;
1784 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1785 ASSERT_TRUE(systemAbilityMgr != nullptr);
1786 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1787 ASSERT_TRUE(remote != nullptr);
1788 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1789 ASSERT_TRUE(telephonyService != nullptr);
1790 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1791 return;
1792 }
1793 if (HasSimCard(SIM1_SLOTID)) {
1794 CellularCallInfo callInfo;
1795 int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
1796 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1797 char code = '1';
1798 ret = telephonyService->StartDtmf(code, callInfo);
1799 EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
1800 }
1801 if (HasSimCard(SIM2_SLOTID)) {
1802 CellularCallInfo callInfo;
1803 int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
1804 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1805 char code = '1';
1806 ret = telephonyService->StartDtmf(code, callInfo);
1807 EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
1808 }
1809 }
1810
1811 /**
1812 * @tc.number cellular_call_StartDtmf_0002
1813 * @tc.name Test for startDtmf function with invalid slot by cs
1814 * @tc.desc Function test
1815 */
1816 HWTEST_F(CsTest, cellular_call_StartDtmf_0002, Function | MediumTest | Level2)
1817 {
1818 AccessToken token;
1819 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1820 ASSERT_TRUE(systemAbilityMgr != nullptr);
1821 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1822 ASSERT_TRUE(remote != nullptr);
1823 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1824 ASSERT_TRUE(telephonyService != nullptr);
1825 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1826 return;
1827 }
1828 if (HasSimCard(SIM1_SLOTID)) {
1829 CellularCallInfo callInfo;
1830 int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1831 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1832 char code = '1';
1833 ret = telephonyService->StartDtmf(code, callInfo);
1834 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1835 }
1836 if (HasSimCard(SIM2_SLOTID)) {
1837 CellularCallInfo callInfo;
1838 int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1839 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1840 char code = '1';
1841 ret = telephonyService->StartDtmf(code, callInfo);
1842 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1843 }
1844 }
1845
1846 /**
1847 * @tc.number cellular_call_StopDtmf_0001
1848 * @tc.name Test for stopDtmf function by cs
1849 * @tc.desc Function test
1850 */
1851 HWTEST_F(CsTest, cellular_call_StopDtmf_0001, Function | MediumTest | Level2)
1852 {
1853 AccessToken token;
1854 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1855 ASSERT_TRUE(systemAbilityMgr != nullptr);
1856 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1857 ASSERT_TRUE(remote != nullptr);
1858 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1859 ASSERT_TRUE(telephonyService != nullptr);
1860 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1861 return;
1862 }
1863 if (HasSimCard(SIM1_SLOTID)) {
1864 CellularCallInfo callInfo;
1865 int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
1866 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1867 ret = telephonyService->StopDtmf(callInfo);
1868 EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
1869 }
1870 if (HasSimCard(SIM2_SLOTID)) {
1871 CellularCallInfo callInfo;
1872 int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
1873 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1874 ret = telephonyService->StopDtmf(callInfo);
1875 EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
1876 }
1877 }
1878
1879 /**
1880 * @tc.number cellular_call_StopDtmf_0002
1881 * @tc.name Test for stopDtmf function with invalid slot by cs
1882 * @tc.desc Function test
1883 */
1884 HWTEST_F(CsTest, cellular_call_StopDtmf_0002, Function | MediumTest | Level2)
1885 {
1886 AccessToken token;
1887 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1888 ASSERT_TRUE(systemAbilityMgr != nullptr);
1889 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1890 ASSERT_TRUE(remote != nullptr);
1891 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1892 ASSERT_TRUE(telephonyService != nullptr);
1893 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1894 return;
1895 }
1896 if (HasSimCard(SIM1_SLOTID)) {
1897 CellularCallInfo callInfo;
1898 int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1899 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1900 ret = telephonyService->StopDtmf(callInfo);
1901 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1902 }
1903 if (HasSimCard(SIM2_SLOTID)) {
1904 CellularCallInfo callInfo;
1905 int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1906 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1907 ret = telephonyService->StopDtmf(callInfo);
1908 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1909 }
1910 }
1911
1912 /**
1913 * @tc.number cellular_call_SendDtmf_0001
1914 * @tc.name Test for sendDtmf function by cs
1915 * @tc.desc Function test
1916 */
1917 HWTEST_F(CsTest, cellular_call_SendDtmf_0001, Function | MediumTest | Level2)
1918 {
1919 AccessToken token;
1920 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1921 ASSERT_TRUE(systemAbilityMgr != nullptr);
1922 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1923 ASSERT_TRUE(remote != nullptr);
1924 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1925 ASSERT_TRUE(telephonyService != nullptr);
1926 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1927 return;
1928 }
1929 if (HasSimCard(SIM1_SLOTID)) {
1930 CellularCallInfo callInfo;
1931 int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
1932 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1933 char code = '1';
1934 ret = telephonyService->SendDtmf(code, callInfo);
1935 EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
1936 }
1937 if (HasSimCard(SIM2_SLOTID)) {
1938 CellularCallInfo callInfo;
1939 int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
1940 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1941 char code = '1';
1942 ret = telephonyService->SendDtmf(code, callInfo);
1943 EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
1944 }
1945 }
1946
1947 /**
1948 * @tc.number cellular_call_SendDtmf_0002
1949 * @tc.name Test for sendDtmf function with invalid slot by cs
1950 * @tc.desc Function test
1951 */
1952 HWTEST_F(CsTest, cellular_call_SendDtmf_0002, Function | MediumTest | Level2)
1953 {
1954 AccessToken token;
1955 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1956 ASSERT_TRUE(systemAbilityMgr != nullptr);
1957 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1958 ASSERT_TRUE(remote != nullptr);
1959 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1960 ASSERT_TRUE(telephonyService != nullptr);
1961 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1962 return;
1963 }
1964 if (HasSimCard(SIM1_SLOTID)) {
1965 CellularCallInfo callInfo;
1966 int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1967 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1968 char code = '1';
1969 ret = telephonyService->SendDtmf(code, callInfo);
1970 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1971 }
1972 if (HasSimCard(SIM2_SLOTID)) {
1973 CellularCallInfo callInfo;
1974 int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
1975 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
1976 char code = '1';
1977 ret = telephonyService->SendDtmf(code, callInfo);
1978 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
1979 }
1980 }
1981
1982 /**
1983 * @tc.number cellular_call_GetDomainPreferenceMode_0001
1984 * @tc.name Test for GetDomainPreferenceMode function by invalid slotId
1985 * @tc.desc Function test
1986 */
1987 HWTEST_F(CsTest, cellular_call_GetDomainPreferenceMode_0001, Function | MediumTest | Level3)
1988 {
1989 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
1990 ASSERT_TRUE(systemAbilityMgr != nullptr);
1991 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
1992 ASSERT_TRUE(remote != nullptr);
1993 auto telephonyService = iface_cast<CellularCallInterface>(remote);
1994 ASSERT_TRUE(telephonyService != nullptr);
1995 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1996 return;
1997 }
1998 if (HasSimCard(SIM1_SLOTID)) {
1999 int32_t ret = telephonyService->GetDomainPreferenceMode(INVALID_SLOTID);
2000 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
2001 }
2002 if (HasSimCard(SIM2_SLOTID)) {
2003 int32_t ret = telephonyService->GetDomainPreferenceMode(INVALID_SLOTID);
2004 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
2005 }
2006 }
2007
2008 /**
2009 * @tc.number cellular_call_GetDomainPreferenceMode_0002
2010 * @tc.name Test for GetDomainPreferenceMode function by valid slotId
2011 * @tc.desc Function test
2012 */
2013 HWTEST_F(CsTest, cellular_call_GetDomainPreferenceMode_0002, Function | MediumTest | Level3)
2014 {
2015 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
2016 ASSERT_TRUE(systemAbilityMgr != nullptr);
2017 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
2018 ASSERT_TRUE(remote != nullptr);
2019 auto telephonyService = iface_cast<CellularCallInterface>(remote);
2020 ASSERT_TRUE(telephonyService != nullptr);
2021 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
2022 return;
2023 }
2024 if (HasSimCard(SIM1_SLOTID)) {
2025 int32_t ret = telephonyService->GetDomainPreferenceMode(SIM1_SLOTID);
2026 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
2027 }
2028 if (HasSimCard(SIM2_SLOTID)) {
2029 int32_t ret = telephonyService->GetDomainPreferenceMode(SIM2_SLOTID);
2030 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
2031 }
2032 }
2033
2034 /**
2035 * @tc.number cellular_call_GetMute_0001
2036 * @tc.name Test for GetMute function by invalid slotId
2037 * @tc.desc Function test
2038 */
2039 HWTEST_F(CsTest, cellular_call_GetMute_0001, Function | MediumTest | Level3)
2040 {
2041 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
2042 ASSERT_TRUE(systemAbilityMgr != nullptr);
2043 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
2044 ASSERT_TRUE(remote != nullptr);
2045 auto telephonyService = iface_cast<CellularCallInterface>(remote);
2046 ASSERT_TRUE(telephonyService != nullptr);
2047 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
2048 return;
2049 }
2050 if (HasSimCard(SIM1_SLOTID)) {
2051 int32_t ret = telephonyService->GetMute(INVALID_SLOTID);
2052 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
2053 }
2054 if (HasSimCard(SIM2_SLOTID)) {
2055 int32_t ret = telephonyService->GetMute(INVALID_SLOTID);
2056 EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
2057 }
2058 }
2059
2060 /**
2061 * @tc.number cellular_call_GetMute_0002
2062 * @tc.name Test for GetMute function by valid slotId
2063 * @tc.desc Function test
2064 */
2065 HWTEST_F(CsTest, cellular_call_GetMute_0002, Function | MediumTest | Level3)
2066 {
2067 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
2068 ASSERT_TRUE(systemAbilityMgr != nullptr);
2069 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
2070 ASSERT_TRUE(remote != nullptr);
2071 auto telephonyService = iface_cast<CellularCallInterface>(remote);
2072 ASSERT_TRUE(telephonyService != nullptr);
2073 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
2074 return;
2075 }
2076 if (HasSimCard(SIM1_SLOTID)) {
2077 int32_t ret = telephonyService->GetMute(SIM1_SLOTID);
2078 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
2079 }
2080 if (HasSimCard(SIM2_SLOTID)) {
2081 int32_t ret = telephonyService->GetMute(SIM2_SLOTID);
2082 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
2083 }
2084 }
2085
2086 /**
2087 * @tc.number cellular_call_CsControl_0001
2088 * @tc.name Test for CsControl
2089 * @tc.desc Function test
2090 */
2091 HWTEST_F(CsTest, cellular_call_CsControl_0001, Function | MediumTest | Level3)
2092 {
2093 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
2094 ASSERT_TRUE(systemAbilityMgr != nullptr);
2095 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
2096 ASSERT_TRUE(remote != nullptr);
2097 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
2098 return;
2099 }
2100 auto csControl = std::make_shared<CSControl>();
2101 CellularCallInfo cellularCallInfo;
2102 EXPECT_EQ(InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, cellularCallInfo), TELEPHONY_SUCCESS);
2103 EXPECT_EQ(csControl->Dial(cellularCallInfo), CALL_ERR_GET_RADIO_STATE_FAILED);
2104 EXPECT_EQ(InitCellularCallInfo(INVALID_SLOTID, "", cellularCallInfo), TELEPHONY_SUCCESS);
2105 EXPECT_EQ(csControl->Dial(cellularCallInfo), CALL_ERR_PHONE_NUMBER_EMPTY);
2106
2107 for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) {
2108 if (!HasSimCard(slotId)) {
2109 continue;
2110 }
2111 EXPECT_EQ(InitCellularCallInfo(slotId, "*30#", cellularCallInfo), TELEPHONY_SUCCESS);
2112 EXPECT_EQ(csControl->DialCdma(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE);
2113 EXPECT_EQ(csControl->DialGsm(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE);
2114 EXPECT_EQ(InitCellularCallInfo(slotId, "#30#", cellularCallInfo), TELEPHONY_SUCCESS);
2115 EXPECT_EQ(csControl->DialGsm(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE);
2116 EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER, cellularCallInfo), TELEPHONY_SUCCESS);
2117 EXPECT_EQ(csControl->DialCdma(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE);
2118 EXPECT_EQ(csControl->Dial(cellularCallInfo), CALL_ERR_GET_RADIO_STATE_FAILED);
2119 ASSERT_FALSE(csControl->CalculateInternationalRoaming(slotId));
2120 CallInfoList callList;
2121 callList.callSize = 0;
2122 EXPECT_EQ(csControl->ReportCallsData(slotId, callList), TELEPHONY_ERROR);
2123 CallInfo callInfo;
2124 callList.callSize = 1;
2125 callInfo.number = PHONE_NUMBER;
2126 callInfo.index = 1;
2127 callInfo.state = static_cast<int32_t>(TelCallState::CALL_STATUS_INCOMING);
2128 callList.calls.push_back(callInfo);
2129 EXPECT_EQ(csControl->ReportCallsData(slotId, callList), TELEPHONY_SUCCESS);
2130 callList.callSize = 2;
2131 callInfo.state = static_cast<int32_t>(TelCallState::CALL_STATUS_ACTIVE);
2132 callInfo.number = PHONE_NUMBER_SECOND;
2133 callInfo.index = 2;
2134 callList.calls.push_back(callInfo);
2135 callList.callSize = 3;
2136 callInfo.state = static_cast<int32_t>(TelCallState::CALL_STATUS_DISCONNECTED);
2137 callInfo.number = PHONE_NUMBER_THIRD;
2138 callInfo.index = 3;
2139 callList.calls.push_back(callInfo);
2140 EXPECT_EQ(csControl->ReportCallsData(slotId, callList), TELEPHONY_SUCCESS);
2141 EXPECT_EQ(csControl->DialCdma(cellularCallInfo), TELEPHONY_SUCCESS);
2142 EXPECT_EQ(csControl->DialGsm(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE);
2143 EXPECT_EQ(csControl->Answer(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE);
2144 EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER_SECOND, cellularCallInfo), TELEPHONY_SUCCESS);
2145 EXPECT_EQ(csControl->Answer(cellularCallInfo), CALL_ERR_CALL_STATE);
2146 EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER_THIRD, cellularCallInfo), TELEPHONY_SUCCESS);
2147 EXPECT_EQ(csControl->Answer(cellularCallInfo), CALL_ERR_CALL_STATE);
2148 EXPECT_EQ(csControl->Reject(cellularCallInfo), CALL_ERR_CALL_STATE);
2149 EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER, cellularCallInfo), TELEPHONY_SUCCESS);
2150 EXPECT_EQ(csControl->Reject(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE);
2151 EXPECT_EQ(csControl->HoldCall(slotId), CALL_ERR_CALL_STATE);
2152 EXPECT_EQ(csControl->UnHoldCall(slotId), CALL_ERR_CALL_STATE);
2153 EXPECT_EQ(csControl->SwitchCall(slotId), CALL_ERR_CALL_STATE);
2154 EXPECT_EQ(csControl->SeparateConference(slotId, PHONE_NUMBER, 1), CALL_ERR_RESOURCE_UNAVAILABLE);
2155 EXPECT_EQ(csControl->SeparateConference(slotId, "", 1), CALL_ERR_RESOURCE_UNAVAILABLE);
2156 EXPECT_EQ(csControl->HangUp(cellularCallInfo, CallSupplementType::TYPE_DEFAULT), CALL_ERR_RESOURCE_UNAVAILABLE);
2157 EXPECT_EQ(csControl->HangUp(cellularCallInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE),
2158 CALL_ERR_RESOURCE_UNAVAILABLE);
2159 EXPECT_EQ(
2160 csControl->HangUp(cellularCallInfo, CallSupplementType::TYPE_HANG_UP_ALL), CALL_ERR_RESOURCE_UNAVAILABLE);
2161 EXPECT_EQ(csControl->HangUp(cellularCallInfo, static_cast<CallSupplementType>(INVALID_HANG_UP_TYPE)),
2162 TELEPHONY_ERR_ARGUMENT_INVALID);
2163 callList.callSize = 0;
2164 EXPECT_EQ(csControl->ReportCallsData(slotId, callList), TELEPHONY_SUCCESS);
2165 }
2166 }
2167
2168 /**
2169 * @tc.number cellular_call_CellularCallConnectionCS_0001
2170 * @tc.name Test for CellularCallConnectionCS
2171 * @tc.desc Function test
2172 */
2173 HWTEST_F(CsTest, cellular_call_CellularCallConnectionCS_0001, Function | MediumTest | Level3)
2174 {
2175 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
2176 ASSERT_TRUE(systemAbilityMgr != nullptr);
2177 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
2178 ASSERT_TRUE(remote != nullptr);
2179 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
2180 return;
2181 }
2182
2183 for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) {
2184 if (!HasSimCard(slotId)) {
2185 continue;
2186 }
2187 CellularCallConnectionCS csConnection;
2188 EXPECT_EQ(csConnection.SendDtmfRequest(slotId, '1', 1), CALL_ERR_RESOURCE_UNAVAILABLE);
2189 EXPECT_EQ(csConnection.StartDtmfRequest(slotId, '1', 1), CALL_ERR_RESOURCE_UNAVAILABLE);
2190 EXPECT_EQ(csConnection.StopDtmfRequest(slotId, 1), CALL_ERR_RESOURCE_UNAVAILABLE);
2191 EXPECT_EQ(csConnection.GetCsCallsDataRequest(slotId, 1), CALL_ERR_RESOURCE_UNAVAILABLE);
2192 EXPECT_EQ(csConnection.GetCallFailReasonRequest(slotId), CALL_ERR_RESOURCE_UNAVAILABLE);
2193 MMICodeUtils utils;
2194 ASSERT_FALSE(utils.IsNeedExecuteMmi(""));
2195 ASSERT_FALSE(utils.ExecuteMmiCode(slotId));
2196 }
2197 }
2198
2199 /**
2200 * @tc.number cellular_call_CellularCallRegister_0001
2201 * @tc.name Test for CellularCallRegister
2202 * @tc.desc Function test
2203 */
2204 HWTEST_F(CsTest, cellular_call_CellularCallRegister_0001, Function | MediumTest | Level3)
2205 {
2206 auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
2207 ASSERT_TRUE(systemAbilityMgr != nullptr);
2208 auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
2209 ASSERT_TRUE(remote != nullptr);
2210 if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
2211 return;
2212 }
2213 auto callRegister = DelayedSingleton<CellularCallRegister>::GetInstance();
2214 ASSERT_TRUE(callRegister != nullptr);
2215 CallReportInfo callRepotInfo;
2216 callRepotInfo.callType = CallType::TYPE_CS;
2217 callRepotInfo.accountId = INVALID_SLOTID;
2218 callRepotInfo.state = TelCallState::CALL_STATUS_INCOMING;
2219 callRepotInfo.callMode = VideoStateType::TYPE_VOICE;
2220 CallsReportInfo calls;
2221 calls.slotId = INVALID_SLOTID;
2222 calls.callVec.push_back(callRepotInfo);
2223 callRegister->ReportCallsInfo(calls);
2224 callRegister->ReportSingleCallInfo(callRepotInfo, TelCallState::CALL_STATUS_INCOMING);
2225 CellularCallEventInfo callEvent;
2226 callRegister->ReportEventResultInfo(callEvent);
2227 CallWaitResponse waitResponse;
2228 callRegister->ReportGetWaitingResult(waitResponse);
2229 callRegister->ReportSetWaitingResult(RESULT);
2230 CallRestrictionResponse restrictionResponse;
2231 callRegister->ReportGetRestrictionResult(restrictionResponse);
2232 callRegister->ReportSetRestrictionResult(RESULT);
2233 CallTransferResponse transferResponse;
2234 callRegister->ReportGetTransferResult(transferResponse);
2235 callRegister->ReportSetTransferResult(RESULT);
2236 ClipResponse clipResponse;
2237 callRegister->ReportGetClipResult(clipResponse);
2238 ClirResponse clirResponse;
2239 callRegister->ReportGetClirResult(clirResponse);
2240 callRegister->ReportSetClirResult(RESULT);
2241 callRegister->ReportCallRingBackResult(RESULT);
2242 DisconnectedDetails details;
2243 callRegister->ReportCallFailReason(details);
2244 MuteControlResponse muteResponse;
2245 callRegister->ReportSetMuteResult(muteResponse);
2246 callRegister->ReportGetMuteResult(muteResponse);
2247 callRegister->ReportInviteToConferenceResult(RESULT);
2248 callRegister->ReportGetCallDataResult(RESULT);
2249 callRegister->ReportStartDtmfResult(RESULT);
2250 callRegister->ReportStopDtmfResult(RESULT);
2251 callRegister->ReportStartRttResult(RESULT);
2252 callRegister->ReportStopRttResult(RESULT);
2253 callRegister->ReportSendUssdResult(RESULT);
2254 SetEccListResponse eccListResponse;
2255 callRegister->ReportSetEmergencyCallListResponse(eccListResponse);
2256 MmiCodeInfo mmiInfo;
2257 callRegister->ReportMmiCodeResult(mmiInfo);
2258 EXPECT_EQ(callRegister->RegisterCallManagerCallBack(nullptr), TELEPHONY_SUCCESS);
2259 EXPECT_EQ(callRegister->UnRegisterCallManagerCallBack(), TELEPHONY_SUCCESS);
2260 ASSERT_FALSE(callRegister->IsCallManagerCallBackRegistered());
2261 }
2262
2263 /**
2264 * @tc.number cellular_call_TestDump_0001
2265 * @tc.name TestDump
2266 * @tc.desc Function test
2267 */
2268 HWTEST_F(CsTest, cellular_call_TestDump_0001, Function | MediumTest | Level3)
2269 {
2270 std::vector<std::u16string> emptyArgs = {};
2271 std::vector<std::u16string> args = { u"test", u"test1" };
2272 EXPECT_EQ(DelayedSingleton<CellularCallService>::GetInstance()->Dump(-1, args), TELEPHONY_ERR_FAIL);
2273 EXPECT_EQ(DelayedSingleton<CellularCallService>::GetInstance()->Dump(0, emptyArgs), 0);
2274 EXPECT_EQ(DelayedSingleton<CellularCallService>::GetInstance()->Dump(0, args), 0);
2275 }
2276 } // namespace Telephony
2277 } // namespace OHOS
2278