1 /*
2 * Copyright (C) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #define private public
17 #define protected public
18
19 #include "gtest/gtest.h"
20 #include "cellular_call_connection_ims.h"
21 #include "cellular_call_connection_satellite.h"
22 #include "call_manager_base.h"
23 #include "cellular_call_service.h"
24
25 namespace OHOS {
26 namespace Telephony {
27 using namespace testing::ext;
28 class ImsConnectionTest : public testing::Test {
29 public:
30 static void SetUpTestCase();
31 static void TearDownTestCase();
32 void SetUp();
33 void TearDown();
34 };
SetUpTestCase()35 void ImsConnectionTest::SetUpTestCase() {}
36
TearDownTestCase()37 void ImsConnectionTest::TearDownTestCase() {}
38
SetUp()39 void ImsConnectionTest::SetUp() {}
40
TearDown()41 void ImsConnectionTest::TearDown() {}
42 /**
43 * @tc.number Telephony_CellularCallConnectionIMSTest_0001
44 * @tc.name Test CellularCallConnectionIMS
45 * @tc.desc Function test
46 */
47 HWTEST_F(ImsConnectionTest, CellularCallConnectionIMSTest_0001, Function | MediumTest | Level1)
48 {
49 auto cellularCallConnectionIMS = std::make_shared<CellularCallConnectionIMS>();
50 int32_t slotId = 0;
51 std::string phoneNum;
52 int32_t index = 0;
53 int32_t ret = cellularCallConnectionIMS->HangUpRequest(slotId, phoneNum, index);
54 EXPECT_EQ(ret, TELEPHONY_ERROR);
55 }
56
57 /**
58 * @tc.number Telephony_CellularCallConnectionIMSTest_0002
59 * @tc.name Test CellularCallConnectionIMS
60 * @tc.desc Function test
61 */
62 HWTEST_F(ImsConnectionTest, CellularCallConnectionIMSTest_0002, Function | MediumTest | Level1)
63 {
64 auto cellularCallConnectionIMS = std::make_shared<CellularCallConnectionIMS>();
65 int32_t slotId = 0;
66 std::string phoneNum;
67 int32_t index = 0;
68 int32_t videoState = 0;
69 int32_t ret = cellularCallConnectionIMS->AnswerRequest(slotId, phoneNum, videoState, index);
70 EXPECT_EQ(ret, TELEPHONY_ERROR);
71 }
72
73 /**
74 * @tc.number Telephony_CellularCallConnectionIMSTest_0003
75 * @tc.name Test CellularCallConnectionIMS
76 * @tc.desc Function test
77 */
78 HWTEST_F(ImsConnectionTest, CellularCallConnectionIMSTest_0003, Function | MediumTest | Level1)
79 {
80 auto cellularCallConnectionIMS = std::make_shared<CellularCallConnectionIMS>();
81 int32_t slotId = 0;
82 std::string phoneNum;
83 int32_t index = 0;
84 int32_t ret = cellularCallConnectionIMS->RejectRequest(slotId, phoneNum, index);
85 EXPECT_EQ(ret, TELEPHONY_ERROR);
86 }
87
88 /**
89 * @tc.number Telephony_CellularCallConnectionIMSTest_0004
90 * @tc.name Test CellularCallConnectionIMS
91 * @tc.desc Function test
92 */
93 HWTEST_F(ImsConnectionTest, CellularCallConnectionIMSTest_0004, Function | MediumTest | Level1)
94 {
95 auto cellularCallConnectionIMS = std::make_shared<CellularCallConnectionIMS>();
96 int32_t slotId = 0;
97 int32_t ret = cellularCallConnectionIMS->HoldCallRequest(slotId);
98 EXPECT_EQ(ret, TELEPHONY_ERROR);
99 }
100
101 /**
102 * @tc.number Telephony_CellularCallConnectionIMSTest_0005
103 * @tc.name Test CellularCallConnectionIMS
104 * @tc.desc Function test
105 */
106 HWTEST_F(ImsConnectionTest, CellularCallConnectionIMSTest_0005, Function | MediumTest | Level1)
107 {
108 auto cellularCallConnectionIMS = std::make_shared<CellularCallConnectionIMS>();
109 int32_t slotId = 0;
110 int32_t ret = cellularCallConnectionIMS->UnHoldCallRequest(slotId);
111 EXPECT_EQ(ret, TELEPHONY_ERROR);
112 }
113
114 /**
115 * @tc.number Telephony_CellularCallConnectionIMSTest_0006
116 * @tc.name Test CellularCallConnectionIMS
117 * @tc.desc Function test
118 */
119 HWTEST_F(ImsConnectionTest, CellularCallConnectionIMSTest_0006, Function | MediumTest | Level1)
120 {
121 auto cellularCallConnectionIMS = std::make_shared<CellularCallConnectionIMS>();
122 int32_t slotId = 0;
123 int32_t voiceCall = 0;
124 int32_t ret = cellularCallConnectionIMS->CombineConferenceRequest(slotId, voiceCall);
125 EXPECT_EQ(ret, TELEPHONY_ERROR);
126 }
127
128 /**
129 * @tc.number Telephony_CellularCallConnectionIMSTest_0007
130 * @tc.name Test CellularCallConnectionIMS
131 * @tc.desc Function test
132 */
133 HWTEST_F(ImsConnectionTest, CellularCallConnectionIMSTest_0007, Function | MediumTest | Level1)
134 {
135 auto cellularCallConnectionIMS = std::make_shared<CellularCallConnectionIMS>();
136 int32_t slotId = 0;
137 std::vector<std::string> numberList;
138 int32_t ret = cellularCallConnectionIMS->InviteToConferenceRequest(slotId, numberList);
139 EXPECT_EQ(ret, TELEPHONY_ERROR);
140 }
141
142 /**
143 * @tc.number Telephony_CellularCallConnectionIMSTest_0008
144 * @tc.name Test CellularCallConnectionIMS
145 * @tc.desc Function test
146 */
147 HWTEST_F(ImsConnectionTest, CellularCallConnectionIMSTest_0008, Function | MediumTest | Level1)
148 {
149 auto cellularCallConnectionIMS = std::make_shared<CellularCallConnectionIMS>();
150 int32_t slotId = 0;
151 int32_t index = 0;
152 int32_t ret = cellularCallConnectionIMS->KickOutFromConferenceRequest(slotId, index);
153 EXPECT_EQ(ret, TELEPHONY_ERROR);
154 }
155
156 /**
157 * @tc.number Telephony_CellularCallConnectionIMSTest_0009
158 * @tc.name Test CellularCallConnectionIMS
159 * @tc.desc Function test
160 */
161 HWTEST_F(ImsConnectionTest, CellularCallConnectionIMSTest_0009, Function | MediumTest | Level1)
162 {
163 auto cellularCallConnectionIMS = std::make_shared<CellularCallConnectionIMS>();
164 int32_t slotId = 0;
165 int32_t videoState = 0;
166 int32_t ret = cellularCallConnectionIMS->SwitchCallRequest(slotId, videoState);
167 EXPECT_EQ(ret, TELEPHONY_ERROR);
168 }
169
170 /**
171 * @tc.number Telephony_CellularCallConnectionIMSTest_0010
172 * @tc.name Test CellularCallConnectionIMS
173 * @tc.desc Function test
174 */
175 HWTEST_F(ImsConnectionTest, CellularCallConnectionIMSTest_0010, Function | MediumTest | Level1)
176 {
177 auto cellularCallConnectionIMS = std::make_shared<CellularCallConnectionIMS>();
178 int32_t slotId = 0;
179 int64_t lastCallsDataFlag = 0;
180 int32_t ret = cellularCallConnectionIMS->GetImsCallsDataRequest(slotId, lastCallsDataFlag);
181 EXPECT_EQ(ret, TELEPHONY_ERROR);
182 }
183
184 /**
185 * @tc.number Telephony_CellularCallConnectionIMSTest_0011
186 * @tc.name Test CellularCallConnectionIMS
187 * @tc.desc Function test
188 */
189 HWTEST_F(ImsConnectionTest, CellularCallConnectionIMSTest_0011, Function | MediumTest | Level1)
190 {
191 auto cellularCallConnectionIMS = std::make_shared<CellularCallConnectionIMS>();
192 int32_t slotId = 0;
193 int32_t lastCallsDataFlag = 0;
194 char cDtmfCode = 0;
195 int32_t ret = cellularCallConnectionIMS->SendDtmfRequest(slotId, cDtmfCode, lastCallsDataFlag);
196 EXPECT_EQ(ret, TELEPHONY_ERROR);
197 }
198
199 /**
200 * @tc.number Telephony_CellularCallConnectionIMSTest_0012
201 * @tc.name Test CellularCallConnectionIMS
202 * @tc.desc Function test
203 */
204 HWTEST_F(ImsConnectionTest, CellularCallConnectionIMSTest_0012, Function | MediumTest | Level1)
205 {
206 auto cellularCallConnectionIMS = std::make_shared<CellularCallConnectionIMS>();
207 int32_t slotId = 0;
208 int32_t lastCallsDataFlag = 0;
209 char cDtmfCode = 0;
210 int32_t ret = cellularCallConnectionIMS->StartDtmfRequest(slotId, cDtmfCode, lastCallsDataFlag);
211 EXPECT_EQ(ret, TELEPHONY_ERROR);
212 }
213
214 /**
215 * @tc.number Telephony_CellularCallConnectionIMSTest_0013
216 * @tc.name Test CellularCallConnectionIMS
217 * @tc.desc Function test
218 */
219 HWTEST_F(ImsConnectionTest, CellularCallConnectionIMSTest_0013, Function | MediumTest | Level1)
220 {
221 auto cellularCallConnectionIMS = std::make_shared<CellularCallConnectionIMS>();
222 int32_t slotId = 0;
223 int32_t index = 0;
224 int32_t ret = cellularCallConnectionIMS->StopDtmfRequest(slotId, index);
225 EXPECT_EQ(ret, TELEPHONY_ERROR);
226 }
227
228 /**
229 * @tc.number Telephony_CellularCallConnectionIMSTest_0014
230 * @tc.name Test CellularCallConnectionIMS
231 * @tc.desc Function test
232 */
233 HWTEST_F(ImsConnectionTest, CellularCallConnectionIMSTest_0014, Function | MediumTest | Level1)
234 {
235 auto cellularCallConnectionIMS = std::make_shared<CellularCallConnectionIMS>();
236 int32_t slotId = 0;
237 std::string msg;
238 int32_t ret = cellularCallConnectionIMS->StartRttRequest(slotId, msg);
239 EXPECT_EQ(ret, TELEPHONY_ERROR);
240 }
241
242 /**
243 * @tc.number Telephony_CellularCallConnectionIMSTest_0015
244 * @tc.name Test CellularCallConnectionIMS
245 * @tc.desc Function test
246 */
247 HWTEST_F(ImsConnectionTest, CellularCallConnectionIMSTest_0015, Function | MediumTest | Level1)
248 {
249 auto cellularCallConnectionIMS = std::make_shared<CellularCallConnectionIMS>();
250 int32_t slotId = 0;
251 int32_t ret = cellularCallConnectionIMS->StopRttRequest(slotId);
252 EXPECT_EQ(ret, TELEPHONY_ERROR);
253 }
254
255 /**
256 * @tc.number Telephony_CellularCallConnectionIMSTest_0016
257 * @tc.name Test CellularCallConnectionIMS
258 * @tc.desc Function test
259 */
260 HWTEST_F(ImsConnectionTest, CellularCallConnectionIMSTest_0016, Function | MediumTest | Level1)
261 {
262 auto cellularCallConnectionIMS = std::make_shared<CellularCallConnectionIMS>();
263 int32_t slotId = 0;
264 int32_t ret = cellularCallConnectionIMS->GetCallFailReasonRequest(slotId);
265 EXPECT_EQ(ret, TELEPHONY_ERROR);
266 }
267
268 /**
269 * @tc.number Telephony_CellularCallConnectionIMSTest_0017
270 * @tc.name Test CellularCallConnectionIMS
271 * @tc.desc Function test
272 */
273 HWTEST_F(ImsConnectionTest, CellularCallConnectionIMSTest_0017, Function | MediumTest | Level1)
274 {
275 auto cellularCallConnectionIMS = std::make_shared<CellularCallConnectionIMS>();
276 int32_t slotId = 0;
277 char c = 0;
278 int32_t ret = cellularCallConnectionIMS->ProcessPostDialCallChar(slotId, c);
279 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
280 }
281
282 /**
283 * @tc.number Telephony_CellularCallConnectionIMSTest_0018
284 * @tc.name Test CellularCallConnectionIMS
285 * @tc.desc Function test
286 */
287 HWTEST_F(ImsConnectionTest, CellularCallConnectionIMSTest_0018, Function | MediumTest | Level1)
288 {
289 auto cellularCallConnectionIMS = std::make_shared<CellularCallConnectionIMS>();
290 EXPECT_FALSE(cellularCallConnectionIMS->IsNeedToDial());
291 }
292
293 /**
294 * @tc.number Telephony_CellularCallConnectionIMSTest_0019
295 * @tc.name Test CellularCallConnectionIMS
296 * @tc.desc Function test
297 */
298 HWTEST_F(ImsConnectionTest, CellularCallConnectionIMSTest_0019, Function | MediumTest | Level1)
299 {
300 auto cellularCallConnectionIMS = std::make_shared<CellularCallConnectionIMS>();
301 bool isNeedToDial = false;
302 cellularCallConnectionIMS->SetDialFlag(isNeedToDial);
303 EXPECT_EQ(cellularCallConnectionIMS->isNeedToDial_, 0);
304 }
305
306 /**
307 * @tc.number Telephony_CellularCallConnectionIMSTest_0021
308 * @tc.name Test CellularCallConnectionIMS
309 * @tc.desc Function test
310 */
311 HWTEST_F(ImsConnectionTest, CellularCallConnectionIMSTest_0021, Function | MediumTest | Level1)
312 {
313 auto cellularCallConnectionIMS = std::make_shared<CellularCallConnectionIMS>();
314 EXPECT_FALSE(cellularCallConnectionIMS->IsPendingHold());
315 }
316
317 /**
318 * @tc.number Telephony_CellularCallConnectionSatelliteTest_0001
319 * @tc.name Test CellularCallConnectionSatellite
320 * @tc.desc Function test
321 */
322 HWTEST_F(ImsConnectionTest, CellularCallConnectionSatelliteTest_0001, Function | MediumTest | Level1)
323 {
324 auto cellularCallconnerctionSatellite = std::make_shared<CellularCallConnectionSatellite>();
325 int32_t slotId = 0;
326 int32_t index = 0;
327 int32_t ret = cellularCallconnerctionSatellite->SendDtmfRequest(slotId, '1', index);
328 EXPECT_NE(ret, TELEPHONY_ERROR);
329 }
330
331 /**
332 * @tc.number Telephony_CellularCallConnectionSatelliteTest_0002
333 * @tc.name Test CellularCallConnectionSatellite
334 * @tc.desc Function test
335 */
336 HWTEST_F(ImsConnectionTest, CellularCallConnectionSatelliteTest_0002, Function | MediumTest | Level1)
337 {
338 auto cellularCallconnerctionSatellite = std::make_shared<CellularCallConnectionSatellite>();
339 int32_t slotId = 0;
340 int32_t index = 0;
341 int32_t ret = cellularCallconnerctionSatellite->SendDtmfRequest(slotId, '1', index);
342 EXPECT_NE(ret, TELEPHONY_ERROR);
343 auto handle = DelayedSingleton<CellularCallService>::GetInstance()->GetHandler(slotId);
344 EXPECT_EQ(handle, nullptr);
345 }
346
347 /**
348 * @tc.number Telephony_CellularCallConnectionSatelliteTest_0003
349 * @tc.name Test CellularCallConnectionSatellite
350 * @tc.desc Function test
351 */
352 HWTEST_F(ImsConnectionTest, CellularCallConnectionSatelliteTest_0003, Function | MediumTest | Level1)
353 {
354 auto cellularCallconnerctionSatellite = std::make_shared<CellularCallConnectionSatellite>();
355 int32_t slotId = 0;
356 int32_t index = 0;
357 int32_t ret = cellularCallconnerctionSatellite->StartDtmfRequest(slotId, '1', index);
358 EXPECT_NE(ret, TELEPHONY_ERROR);
359
360 auto handle = DelayedSingleton<CellularCallService>::GetInstance()->GetHandler(slotId);
361 EXPECT_EQ(handle, nullptr);
362 }
363
364 /**
365 * @tc.number Telephony_CellularCallConnectionSatelliteTest_0004
366 * @tc.name Test CellularCallConnectionSatellite
367 * @tc.desc Function test
368 */
369 HWTEST_F(ImsConnectionTest, CellularCallConnectionSatelliteTest_0004, Function | MediumTest | Level1)
370 {
371 auto cellularCallconnerctionSatellite = std::make_shared<CellularCallConnectionSatellite>();
372 int32_t slotId = 0;
373 int32_t index = 0;
374 int32_t ret = cellularCallconnerctionSatellite->StopDtmfRequest(slotId, index);
375 EXPECT_NE(ret, TELEPHONY_ERROR);
376
377 auto handle = DelayedSingleton<CellularCallService>::GetInstance()->GetHandler(slotId);
378 EXPECT_EQ(handle, nullptr);
379 }
380
381 /**
382 * @tc.number Telephony_CellularCallConnectionSatelliteTest_0005
383 * @tc.name Test CellularCallConnectionSatellite
384 * @tc.desc Function test
385 */
386 HWTEST_F(ImsConnectionTest, CellularCallConnectionSatelliteTest_0005, Function | MediumTest | Level1)
387 {
388 auto cellularCallconnerctionSatellite = std::make_shared<CellularCallConnectionSatellite>();
389 int32_t slotId = 0;
390 int32_t ret = cellularCallconnerctionSatellite->ProcessPostDialCallChar(slotId, '1');
391 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
392
393 auto handle = DelayedSingleton<CellularCallService>::GetInstance()->GetHandler(slotId);
394 EXPECT_EQ(handle, nullptr);
395 }
396
397 /**
398 * @tc.number Telephony_ImsBaseConnectionTest_0001
399 * @tc.name Test BaseConnection
400 * @tc.desc Function test GetState
401 */
402 HWTEST_F(ImsConnectionTest, BaseConnectionTest_0001, Function | MediumTest | Level1)
403 {
404 BaseConnection baseConnection;
405 baseConnection.SetStatus(TelCallState::CALL_STATUS_DIALING);
406 EXPECT_EQ(baseConnection.GetStatus(), TelCallState::CALL_STATUS_DIALING);
407 }
408
409 /**
410 * @tc.number Telephony_ImsBaseConnectionTest_0002
411 * @tc.name Test BaseConnection
412 * @tc.desc Function test IsRingingState
413 */
414 HWTEST_F(ImsConnectionTest, BaseConnectionTest_0002, Function | MediumTest | Level1)
415 {
416 BaseConnection baseConnection;
417 baseConnection.SetStatus(TelCallState::CALL_STATUS_DIALING);
418 EXPECT_FALSE(baseConnection.IsRingingState());
419
420 baseConnection.SetStatus(TelCallState::CALL_STATUS_WAITING);
421 EXPECT_TRUE(baseConnection.IsRingingState());
422
423 baseConnection.SetStatus(TelCallState::CALL_STATUS_ALERTING);
424 EXPECT_TRUE(baseConnection.IsRingingState());
425 }
426
427 /**
428 * @tc.number Telephony_ImsBaseConnectionTest_0003
429 * @tc.name Test BaseConnection
430 * @tc.desc Function test GetFlag and SetFlag
431 */
432 HWTEST_F(ImsConnectionTest, BaseConnectionTest_0003, Function | MediumTest | Level1)
433 {
434 BaseConnection baseConnection;
435 baseConnection.SetFlag(true);
436 EXPECT_EQ(baseConnection.GetFlag(), true);
437 }
438
439 /**
440 * @tc.number Telephony_ImsBaseConnectionTest_0004
441 * @tc.name Test BaseConnection
442 * @tc.desc Function test GetNumber
443 */
444 HWTEST_F(ImsConnectionTest, BaseConnectionTest_0004, Function | MediumTest | Level1)
445 {
446 BaseConnection baseConnection;
447 baseConnection.SetNumber("1234567890");
448 EXPECT_EQ(baseConnection.GetNumber(), "1234567890");
449 }
450
451 /**
452 * @tc.number Telephony_ImsBaseConnectionTest_0005
453 * @tc.name Test BaseConnection
454 * @tc.desc Function test GetNumber
455 */
456 HWTEST_F(ImsConnectionTest, BaseConnectionTest_0005, Function | MediumTest | Level1)
457 {
458 BaseConnection baseConnection;
459 baseConnection.SetNumber("1234567890");
460 EXPECT_EQ(baseConnection.GetNumber(), "1234567890");
461 }
462
463 /**
464 * @tc.number Telephony_ImsBaseConnectionTest_0006
465 * @tc.name Test BaseConnection
466 * @tc.desc Function test UpdatePendingHoldFlag
467 */
468 HWTEST_F(ImsConnectionTest, BaseConnectionTest_0006, Function | MediumTest | Level1)
469 {
470 BaseConnection baseConnection;
471 baseConnection.UpdatePendingHoldFlag(true);
472 EXPECT_EQ(baseConnection.GetCallReportInfo().isPendingHold, true);
473 }
474
475 /**
476 * @tc.number Telephony_ImsBaseConnectionTest_0007
477 * @tc.name Test BaseConnection
478 * @tc.desc Function test ProcessPostDialCallChar
479 */
480 HWTEST_F(ImsConnectionTest, BaseConnectionTest_0007, Function | MediumTest | Level1)
481 {
482 BaseConnection baseConnection;
483 int32_t slotId = 0;
484 char c = 'B';
485 EXPECT_EQ(baseConnection.ProcessPostDialCallChar(slotId, c), TELEPHONY_SUCCESS);
486 }
487
488 /**
489 * @tc.number Telephony_ImsBaseConnectionTest_0008
490 * @tc.name Test BaseConnection
491 * @tc.desc Function test GetLeftPostDialCallString
492 */
493 HWTEST_F(ImsConnectionTest, BaseConnectionTest_0008, Function | MediumTest | Level1)
494 {
495 BaseConnection baseConnection;
496 EXPECT_EQ(baseConnection.GetLeftPostDialCallString(), "");
497
498 baseConnection.SetPostDialCallState(PostDialCallState::POST_DIAL_CALL_NOT_STARTED);
499 std::string phoneString = "13363669099,123321";
500 baseConnection.UpdateCallNumber(phoneString);
501 EXPECT_NE(baseConnection.GetLeftPostDialCallString(), "13363669099");
502 }
503
504 /**
505 * @tc.number Telephony_ImsBaseConnectionTest_0009
506 * @tc.name Test BaseConnection
507 * @tc.desc Function test ProcessNextChar
508 */
509 HWTEST_F(ImsConnectionTest, BaseConnectionTest_0009, Function | MediumTest | Level1)
510 {
511 BaseConnection baseConnection;
512 baseConnection.SetPostDialCallState(PostDialCallState::POST_DIAL_CALL_CANCELED);
513 int32_t slotId = 0;
514 char c = 'B';
515 EXPECT_EQ(baseConnection.ProcessNextChar(slotId, c), PostDialCallState::POST_DIAL_CALL_CANCELED);
516
517 baseConnection.SetPostDialCallState(PostDialCallState::POST_DIAL_CALL_NOT_STARTED);
518 EXPECT_EQ(baseConnection.ProcessNextChar(slotId, c), PostDialCallState::POST_DIAL_CALL_COMPLETE);
519
520 baseConnection.SetPostDialCallState(PostDialCallState::POST_DIAL_CALL_NOT_STARTED);
521 std::string phoneString = "13363669099,123321";
522 baseConnection.UpdateCallNumber(phoneString);
523 EXPECT_NE(baseConnection.ProcessNextChar(slotId, c), PostDialCallState::POST_DIAL_CALL_CANCELED);
524 }
525
526 /**
527 * @tc.number Telephony_SupplementRequestImsTest_0001
528 * @tc.name Test SupplementRequestIms
529 * @tc.desc Function test
530 */
531 HWTEST_F(ImsConnectionTest, SupplementRequestImsTest_0001, Function | MediumTest | Level1)
532 {
533 SupplementRequestIms supplementRequestIms;
534 int32_t slotId = 0;
535 int32_t index = 0;
536 int32_t ret = supplementRequestIms.GetClipRequest(slotId, index);
537 EXPECT_NE(ret, CALL_ERR_RESOURCE_UNAVAILABLE);
538 }
539
540 /**
541 * @tc.number Telephony_SupplementRequestImsTest_0002
542 * @tc.name Test SupplementRequestIms
543 * @tc.desc Function test
544 */
545 HWTEST_F(ImsConnectionTest, SupplementRequestImsTest_0002, Function | MediumTest | Level1)
546 {
547 SupplementRequestIms supplementRequestIms;
548 int32_t slotId = 0;
549 int32_t reason = 0;
550 int32_t index = 0;
551 int32_t ret = supplementRequestIms.GetCallTransferRequest(slotId, reason, index);
552 EXPECT_NE(ret, CALL_ERR_RESOURCE_UNAVAILABLE);
553 }
554
555 /**
556 * @tc.number Telephony_SupplementRequestImsTest_0003
557 * @tc.name Test SupplementRequestIms
558 * @tc.desc Function test
559 */
560 HWTEST_F(ImsConnectionTest, SupplementRequestImsTest_0003, Function | MediumTest | Level1)
561 {
562 SupplementRequestIms supplementRequestIms;
563 int32_t slotId = 0;
564 int32_t reason = 0;
565 CallTransferInfo cfInfo;
566 int32_t index = 0;
567 int32_t ret = supplementRequestIms.SetCallTransferRequest(slotId, cfInfo, reason, index);
568 EXPECT_NE(ret, CALL_ERR_RESOURCE_UNAVAILABLE);
569 }
570
571 /**
572 * @tc.number Telephony_SupplementRequestImsTest_0004
573 * @tc.name Test SupplementRequestIms
574 * @tc.desc Function test
575 */
576 HWTEST_F(ImsConnectionTest, SupplementRequestImsTest_0004, Function | MediumTest | Level1)
577 {
578 SupplementRequestIms supplementRequestIms;
579 int32_t slotId = 0;
580 bool result = false;
581 int32_t ret = supplementRequestIms.CanSetCallTransferTime(slotId, result);
582 EXPECT_NE(ret, CALL_ERR_RESOURCE_UNAVAILABLE);
583 }
584
585 /**
586 * @tc.number Telephony_SupplementRequestImsTest_0005
587 * @tc.name Test SupplementRequestIms
588 * @tc.desc Function test
589 */
590 HWTEST_F(ImsConnectionTest, SupplementRequestImsTest_0005, Function | MediumTest | Level1)
591 {
592 SupplementRequestIms supplementRequestIms;
593 int32_t slotId = 0;
594 int32_t reason = 0;
595 int32_t index = 0;
596 int32_t ret = supplementRequestIms.GetCallTransferRequest(slotId, reason, index);
597 EXPECT_NE(ret, CALL_ERR_RESOURCE_UNAVAILABLE);
598 }
599
600 /**
601 * @tc.number Telephony_CellularCallConnectionCSTest_0001
602 * @tc.name Test CellularCallConnectionCS HangUpRequest
603 * @tc.desc Function test
604 */
605 HWTEST_F(ImsConnectionTest, CellularCallConnectionCSTest_0001, Function | MediumTest | Level1)
606 {
607 CellularCallConnectionCS cellularCallConnectionCS;
608 DelayedSingleton<CellularCallService>::GetInstance()->Init();
609 int32_t slotId = 0;
610 int32_t ret = cellularCallConnectionCS.HangUpRequest(slotId);
611 EXPECT_NE(ret, TELEPHONY_SUCCESS);
612
613 slotId = -1;
614 ret = cellularCallConnectionCS.HangUpRequest(slotId);
615 EXPECT_EQ(ret, CALL_ERR_RESOURCE_UNAVAILABLE);
616 }
617
618 /**
619 * @tc.number Telephony_CellularCallConnectionCSTest_0002
620 * @tc.name Test CellularCallConnectionCS AnswerRequest
621 * @tc.desc Function test
622 */
623 HWTEST_F(ImsConnectionTest, CellularCallConnectionCSTest_0002, Function | MediumTest | Level1)
624 {
625 CellularCallConnectionCS cellularCallConnectionCS;
626 DelayedSingleton<CellularCallService>::GetInstance()->Init();
627 int32_t slotId = 0;
628 int32_t ret = cellularCallConnectionCS.AnswerRequest(slotId);
629 EXPECT_NE(ret, TELEPHONY_SUCCESS);
630
631 slotId = -1;
632 ret = cellularCallConnectionCS.AnswerRequest(slotId);
633 EXPECT_EQ(ret, CALL_ERR_RESOURCE_UNAVAILABLE);
634 }
635
636
637 /**
638 * @tc.number Telephony_CellularCallConnectionCSTest_0003
639 * @tc.name Test CellularCallConnectionCS RejectRequest
640 * @tc.desc Function test
641 */
642 HWTEST_F(ImsConnectionTest, CellularCallConnectionCSTest_0003, Function | MediumTest | Level1)
643 {
644 CellularCallConnectionCS cellularCallConnectionCS;
645 DelayedSingleton<CellularCallService>::GetInstance()->Init();
646 int32_t slotId = 0;
647 int32_t ret = cellularCallConnectionCS.RejectRequest(slotId);
648 EXPECT_NE(ret, TELEPHONY_SUCCESS);
649 }
650
651 /**
652 * @tc.number Telephony_CellularCallConnectionCSTest_0004
653 * @tc.name Test CellularCallConnectionCS HoldRequest
654 * @tc.desc Function test
655 */
656 HWTEST_F(ImsConnectionTest, CellularCallConnectionCSTest_0004, Function | MediumTest | Level1)
657 {
658 CellularCallConnectionCS cellularCallConnectionCS;
659 DelayedSingleton<CellularCallService>::GetInstance()->Init();
660 int32_t slotId = 0;
661 int32_t ret = cellularCallConnectionCS.HoldRequest(slotId);
662 EXPECT_NE(ret, TELEPHONY_SUCCESS);
663 }
664
665 /**
666 * @tc.number Telephony_CellularCallConnectionCSTest_0005
667 * @tc.name Test CellularCallConnectionCS UnHoldRequest
668 * @tc.desc Function test
669 */
670 HWTEST_F(ImsConnectionTest, CellularCallConnectionCSTest_0005, Function | MediumTest | Level1)
671 {
672 CellularCallConnectionCS cellularCallConnectionCS;
673 DelayedSingleton<CellularCallService>::GetInstance()->Init();
674 int32_t slotId = 0;
675 int32_t ret = cellularCallConnectionCS.UnHoldCallRequest(slotId);
676 EXPECT_NE(ret, TELEPHONY_SUCCESS);
677 }
678
679 /**
680 * @tc.number Telephony_CellularCallConnectionCSTest_0006
681 * @tc.name Test CellularCallConnectionCS SwitchCallRequest
682 * @tc.desc Function test
683 */
684 HWTEST_F(ImsConnectionTest, CellularCallConnectionCSTest_0006, Function | MediumTest | Level1)
685 {
686 CellularCallConnectionCS cellularCallConnectionCS;
687 DelayedSingleton<CellularCallService>::GetInstance()->Init();
688 int32_t slotId = 0;
689 int32_t ret = cellularCallConnectionCS.SwitchCallRequest(slotId);
690 EXPECT_NE(ret, TELEPHONY_SUCCESS);
691 }
692
693 /**
694 * @tc.number Telephony_CellularCallConnectionCSTest_0007
695 * @tc.name Test CellularCallConnectionCS CombineConferenceRequest
696 * @tc.desc Function test
697 */
698 HWTEST_F(ImsConnectionTest, CellularCallConnectionCSTest_0007, Function | MediumTest | Level1)
699 {
700 CellularCallConnectionCS cellularCallConnectionCS;
701 DelayedSingleton<CellularCallService>::GetInstance()->Init();
702 int32_t slotId = 0;
703 int32_t voiceCall = 0;
704 int32_t ret = cellularCallConnectionCS.CombineConferenceRequest(slotId, voiceCall);
705 EXPECT_NE(ret, TELEPHONY_SUCCESS);
706
707 slotId = -1;
708 ret = cellularCallConnectionCS.CombineConferenceRequest(slotId, voiceCall);
709 EXPECT_EQ(ret, CALL_ERR_RESOURCE_UNAVAILABLE);
710 }
711
712 /**
713 * @tc.number Telephony_CellularCallConnectionCSTest_0008
714 * @tc.name Test CellularCallConnectionCS SeparateConferenceRequest
715 * @tc.desc Function test
716 */
717 HWTEST_F(ImsConnectionTest, CellularCallConnectionCSTest_0008, Function | MediumTest | Level1)
718 {
719 CellularCallConnectionCS cellularCallConnectionCS;
720 DelayedSingleton<CellularCallService>::GetInstance()->Init();
721 int32_t slotId = 0;
722 int32_t voiceCall = 0;
723 int32_t index = 0;
724 int32_t ret = cellularCallConnectionCS.SeparateConferenceRequest(slotId, index, voiceCall);
725 EXPECT_NE(ret, TELEPHONY_SUCCESS);
726
727 slotId = -1;
728 ret = cellularCallConnectionCS.SeparateConferenceRequest(slotId, index, voiceCall);
729 EXPECT_EQ(ret, CALL_ERR_RESOURCE_UNAVAILABLE);
730 }
731 /**
732 * @tc.number Telephony_CellularCallConnectionCSTest_0009
733 * @tc.name Test CellularCallConnectionCS CallSupplementRequest
734 * @tc.desc Function test
735 */
736 HWTEST_F(ImsConnectionTest, CellularCallConnectionCSTest_0009, Function | MediumTest | Level1)
737 {
738 CellularCallConnectionCS cellularCallConnectionCS;
739 DelayedSingleton<CellularCallService>::GetInstance()->Init();
740 int32_t slotId = 0;
741 CallSupplementType type = CallSupplementType::TYPE_DEFAULT;
742 int32_t ret = cellularCallConnectionCS.CallSupplementRequest(slotId, type);
743 EXPECT_NE(ret, TELEPHONY_SUCCESS);
744 }
745
746 /**
747 * @tc.number Telephony_CellularCallConnectionCSTest_0010
748 * @tc.name Test CellularCallConnectionCS SendCDMAThreeWayDialRequest
749 * @tc.desc Function test
750 */
751 HWTEST_F(ImsConnectionTest, CellularCallConnectionCSTest_0010, Function | MediumTest | Level1)
752 {
753 CellularCallConnectionCS cellularCallConnectionCS;
754 int32_t slotId = 0;
755 int32_t ret = cellularCallConnectionCS.SendCDMAThreeWayDialRequest(slotId);
756 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
757 }
758
759 /**
760 * @tc.number Telephony_CellularCallConnectionCSTest_0011
761 * @tc.name Test CellularCallConnectionCS SeparateConferenceRequest
762 * @tc.desc Function test
763 */
764 HWTEST_F(ImsConnectionTest, CellularCallConnectionCSTest_0011, Function | MediumTest | Level1)
765 {
766 CellularCallConnectionCS cellularCallConnectionCS;
767 DelayedSingleton<CellularCallService>::GetInstance()->Init();
768 int32_t slotId = 0;
769 int32_t index = 0;
770 char cDtmfCode = '0';
771 int32_t ret = cellularCallConnectionCS.SendDtmfRequest(slotId, cDtmfCode, index);
772 EXPECT_NE(ret, TELEPHONY_SUCCESS);
773 }
774
775 /**
776 * @tc.number Telephony_CellularCallConnectionCSTest_0012
777 * @tc.name Test CellularCallConnectionCS StartDtmfRequest
778 * @tc.desc Function test
779 */
780 HWTEST_F(ImsConnectionTest, CellularCallConnectionCSTest_0012, Function | MediumTest | Level1)
781 {
782 CellularCallConnectionCS cellularCallConnectionCS;
783 DelayedSingleton<CellularCallService>::GetInstance()->Init();
784 int32_t slotId = 0;
785 int32_t index = 0;
786 char cDtmfCode = '0';
787 int32_t ret = cellularCallConnectionCS.StartDtmfRequest(slotId, cDtmfCode, index);
788 EXPECT_NE(ret, TELEPHONY_SUCCESS);
789 }
790
791 /**
792 * @tc.number Telephony_CellularCallConnectionCSTest_0013
793 * @tc.name Test CellularCallConnectionCS StopDtmfRequest
794 * @tc.desc Function test
795 */
796 HWTEST_F(ImsConnectionTest, CellularCallConnectionCSTest_0013, Function | MediumTest | Level1)
797 {
798 CellularCallConnectionCS cellularCallConnectionCS;
799 DelayedSingleton<CellularCallService>::GetInstance()->Init();
800 int32_t slotId = 0;
801 int32_t index = 0;
802 int32_t ret = cellularCallConnectionCS.StopDtmfRequest(slotId, index);
803 EXPECT_NE(ret, TELEPHONY_SUCCESS);
804 }
805
806 /**
807 * @tc.number Telephony_CellularCallConnectionCSTest_0014
808 * @tc.name Test CellularCallConnectionCS GetCsCallsDataRequest
809 * @tc.desc Function test
810 */
811 HWTEST_F(ImsConnectionTest, CellularCallConnectionCSTest_0014, Function | MediumTest | Level1)
812 {
813 CellularCallConnectionCS cellularCallConnectionCS;
814 DelayedSingleton<CellularCallService>::GetInstance()->Init();
815 int32_t slotId = 0;
816 int64_t lastCallsDataFlag = 0;
817 int32_t ret = cellularCallConnectionCS.GetCsCallsDataRequest(slotId, lastCallsDataFlag);
818 EXPECT_NE(ret, TELEPHONY_SUCCESS);
819 }
820
821 /**
822 * @tc.number Telephony_CellularCallConnectionCSTest_0015
823 * @tc.name Test CellularCallConnectionCS GetCallFailReasonRequest
824 * @tc.desc Function test
825 */
826 HWTEST_F(ImsConnectionTest, CellularCallConnectionCSTest_0015, Function | MediumTest | Level1)
827 {
828 CellularCallConnectionCS cellularCallConnectionCS;
829 DelayedSingleton<CellularCallService>::GetInstance()->Init();
830 int32_t slotId = 0;
831 int32_t ret = cellularCallConnectionCS.GetCallFailReasonRequest(slotId);
832 EXPECT_NE(ret, TELEPHONY_SUCCESS);
833 }
834
835 /**
836 * @tc.number Telephony_CellularCallConnectionCSTest_0016
837 * @tc.name Test CellularCallConnectionCS ProcessPostDialCallChar
838 * @tc.desc Function test
839 */
840 HWTEST_F(ImsConnectionTest, CellularCallConnectionCSTest_0016, Function | MediumTest | Level1)
841 {
842 CellularCallConnectionCS cellularCallConnectionCS;
843 DelayedSingleton<CellularCallService>::GetInstance()->Init();
844 int32_t slotId = 0;
845 char c = '0';
846 int32_t ret = cellularCallConnectionCS.ProcessPostDialCallChar(slotId, c);
847 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
848
849 c = ',';
850 slotId = -1;
851 ret = cellularCallConnectionCS.ProcessPostDialCallChar(slotId, c);
852 EXPECT_EQ(ret, CALL_ERR_RESOURCE_UNAVAILABLE);
853
854 slotId = 0;
855 ret = cellularCallConnectionCS.ProcessPostDialCallChar(slotId, c);
856 EXPECT_NE(ret, TELEPHONY_SUCCESS);
857
858 c = ';';
859 ret = cellularCallConnectionCS.ProcessPostDialCallChar(slotId, c);
860 EXPECT_EQ(ret, TELEPHONY_SUCCESS);
861 }
862 } // namespace Telephony
863 } // namespace OHOS
864