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