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 "base_request.h"
21 #include "cellular_call_hisysevent.h"
22 #include "core_manager_inner.h"
23 #include "core_manager_inner.h"
24 #include "supplement_request_cs.h"
25 #include "supplement_request_ims.h"
26 #include "telephony_hisysevent.h"
27
28 namespace OHOS {
29 namespace Telephony {
30 using namespace testing::ext;
31
32 static const int32_t INVALID_VALUE = -1;
33 static const int32_t CS_CALL_TYPE = 0;
34 static const int32_t IMS_CALL_TYPE = 1;
35 static const int32_t VOICE_TYPE = 0;
36 static const int32_t VIDEO_TYPE = 1;
37
38 class CellularCallHiSysEventTest : public testing::Test {
39 public:
40 static void SetUpTestCase();
41 static void TearDownTestCase();
42 void SetUp();
43 void TearDown();
44 };
SetUpTestCase()45 void CellularCallHiSysEventTest::SetUpTestCase() {}
46
TearDownTestCase()47 void CellularCallHiSysEventTest::TearDownTestCase() {}
48
SetUp()49 void CellularCallHiSysEventTest::SetUp() {}
50
TearDown()51 void CellularCallHiSysEventTest::TearDown() {}
52
53 /**
54 * @tc.number Telephony_CellularCallHiSysEventTest_0001
55 * @tc.name Test CellularCallHiSysEvent
56 * @tc.desc Function test
57 */
58 HWTEST_F(CellularCallHiSysEventTest, CellularCallHiSysEventTest_0001, Function | MediumTest | Level1)
59 {
60 std::shared_ptr<CellularCallHiSysEvent> cellularCallHiSysEvent = std::make_shared<CellularCallHiSysEvent>();
61 cellularCallHiSysEvent->WriteFoundationRestartFaultEvent(2);
62 cellularCallHiSysEvent->WriteCallEndBehaviorEvent(0, 17);
63
64 CallBehaviorParameterInfo callInfo = {.callType = IMS_CALL_TYPE, .videoState = VOICE_TYPE};
65 CallResponseResult result = CallResponseResult::COMMAND_FAILURE;
66 cellularCallHiSysEvent->WriteDialCallBehaviorEvent(callInfo, result);
67
68 callInfo.videoState = VIDEO_TYPE;
69 cellularCallHiSysEvent->WriteDialCallBehaviorEvent(callInfo, result);
70
71 callInfo.callType = INVALID_VALUE;
72 cellularCallHiSysEvent->WriteDialCallBehaviorEvent(callInfo, result);
73
74 callInfo.videoState = VOICE_TYPE;
75 cellularCallHiSysEvent->WriteDialCallBehaviorEvent(callInfo, result);
76
77 callInfo = {.callType = IMS_CALL_TYPE, .videoState = VOICE_TYPE};
78 result = CallResponseResult::COMMAND_FAILURE;
79 cellularCallHiSysEvent->WriteHangUpCallBehaviorEvent(callInfo, result);
80
81 callInfo.videoState = VIDEO_TYPE;
82 cellularCallHiSysEvent->WriteHangUpCallBehaviorEvent(callInfo, result);
83
84 callInfo.callType = INVALID_VALUE;
85 cellularCallHiSysEvent->WriteHangUpCallBehaviorEvent(callInfo, result);
86
87 callInfo.videoState = VOICE_TYPE;
88 cellularCallHiSysEvent->WriteHangUpCallBehaviorEvent(callInfo, result);
89
90 int32_t slotId = 0;
91 int32_t callType = CS_CALL_TYPE;
92 int32_t videoState = VOICE_TYPE;
93 int32_t errCode = static_cast<int32_t>(TELEPHONY_ERR_MEMCPY_FAIL);
94 std::string desc;
95 CallErrorCode value = CallErrorCode::CALL_ERROR_NONE;
96 cellularCallHiSysEvent->WriteIncomingCallFaultEvent(slotId, callType, videoState, errCode, desc);
97 EXPECT_TRUE(cellularCallHiSysEvent->ErrorCodeConversion(errCode, value));
98 }
99
100 /**
101 * @tc.number Telephony_CellularCallHiSysEventTest_0003
102 * @tc.name Test CellularCallHiSysEvent
103 * @tc.desc Function test
104 */
105 HWTEST_F(CellularCallHiSysEventTest, CellularCallHiSysEventTest_0003, Function | MediumTest | Level1)
106 {
107 std::shared_ptr<CellularCallHiSysEvent> cellularCallHiSysEvent = std::make_shared<CellularCallHiSysEvent>();
108
109 CallBehaviorParameterInfo callInfo = {.callType = IMS_CALL_TYPE, .videoState = VOICE_TYPE,
110 .incomingCallType = IMS_CALL_TYPE, .incomingVideoState = VOICE_TYPE};
111 CallResponseResult result = CallResponseResult::COMMAND_FAILURE;
112 cellularCallHiSysEvent->WriteAnswerCallBehaviorEvent(callInfo, result);
113
114 callInfo.incomingVideoState = VIDEO_TYPE;
115 cellularCallHiSysEvent->WriteAnswerCallBehaviorEvent(callInfo, result);
116
117 callInfo.videoState = VIDEO_TYPE;
118 cellularCallHiSysEvent->WriteAnswerCallBehaviorEvent(callInfo, result);
119
120 CallBehaviorParameterInfo callInfo1 = {.callType = CS_CALL_TYPE, .videoState = VOICE_TYPE,
121 .incomingCallType = CS_CALL_TYPE, .incomingVideoState = VOICE_TYPE};
122 cellularCallHiSysEvent->WriteAnswerCallBehaviorEvent(callInfo1, result);
123
124 cellularCallHiSysEvent->WriteVoNRSwitchChangeEvent(0);
125 cellularCallHiSysEvent->WriteVoNRSwitchChangeEvent(1);
126
127 int32_t slotId = 0;
128 int32_t callType = CS_CALL_TYPE;
129 int32_t videoState = VOICE_TYPE;
130 int32_t errCode = 100;
131 std::string desc;
132 CallErrorCode value = CallErrorCode::CALL_ERROR_NONE;
133 cellularCallHiSysEvent->WriteIncomingCallFaultEvent(slotId, callType, videoState, errCode, desc);
134 EXPECT_FALSE(cellularCallHiSysEvent->
135 ErrorCodeConversion(errCode, value));
136 }
137
138 /**
139 * @tc.number Telephony_CellularCallHiSysEventTest_0004
140 * @tc.name Test CellularCallHiSysEvent TelephonyErrorCodeConversion
141 * @tc.desc Function test
142 */
143 HWTEST_F(CellularCallHiSysEventTest, CellularCallHiSysEventTest_0004, Function | MediumTest | Level1)
144 {
145 std::shared_ptr<CellularCallHiSysEvent> cellularCallHiSysEvent = std::make_shared<CellularCallHiSysEvent>();
146 int32_t errCode = static_cast<int32_t>(TELEPHONY_ERR_WRITE_DESCRIPTOR_TOKEN_FAIL);
147 CallErrorCode eventValue;
148 int32_t ret = cellularCallHiSysEvent->TelephonyErrorCodeConversion(errCode, eventValue);
149 EXPECT_TRUE(ret);
150 EXPECT_EQ(eventValue, CallErrorCode::CALL_ERROR_IPC_WRITE_DESCRIPTOR_TOKEN_FAIL);
151
152 errCode = static_cast<int32_t>(TELEPHONY_ERR_WRITE_DATA_FAIL);
153 ret = cellularCallHiSysEvent->TelephonyErrorCodeConversion(errCode, eventValue);
154 EXPECT_TRUE(ret);
155 EXPECT_EQ(eventValue, CallErrorCode::CALL_ERROR_IPC_WRITE_DATA_FAIL);
156
157 errCode = static_cast<int32_t>(TELEPHONY_ERR_PERMISSION_ERR);
158 ret = cellularCallHiSysEvent->TelephonyErrorCodeConversion(errCode, eventValue);
159 EXPECT_TRUE(ret);
160 EXPECT_EQ(eventValue, CallErrorCode::CALL_ERROR_PERMISSION_ERR);
161
162 errCode = static_cast<int32_t>(TELEPHONY_ERR_MEMSET_FAIL);
163 ret = cellularCallHiSysEvent->TelephonyErrorCodeConversion(errCode, eventValue);
164 EXPECT_TRUE(ret);
165 EXPECT_EQ(eventValue, CallErrorCode::CALL_ERROR_MEMSET_FAIL);
166
167 errCode = static_cast<int32_t>(TELEPHONY_ERR_MEMCPY_FAIL);
168 ret = cellularCallHiSysEvent->TelephonyErrorCodeConversion(errCode, eventValue);
169 EXPECT_TRUE(ret);
170 EXPECT_EQ(eventValue, CallErrorCode::CALL_ERROR_MEMCPY_FAIL);
171
172 errCode = 100;
173 ret = cellularCallHiSysEvent->TelephonyErrorCodeConversion(errCode, eventValue);
174 EXPECT_FALSE(ret);
175 }
176
177 /**
178 * @tc.number Telephony_CellularCallHiSysEventTest_0005
179 * @tc.name Test CellularCallHiSysEvent
180 * @tc.desc Function test
181 */
182 HWTEST_F(CellularCallHiSysEventTest, CellularCallHiSysEventTest_0005, Function | MediumTest | Level1)
183 {
184 std::shared_ptr<CellularCallHiSysEvent> cellularCallHiSysEvent = std::make_shared<CellularCallHiSysEvent>();
185 CallBehaviorParameterInfo info = {.callType = CS_CALL_TYPE, .videoState = VOICE_TYPE,
186 .incomingCallType = CS_CALL_TYPE, .incomingVideoState = VOICE_TYPE};
187
188 CallModeBehaviorType type = CallModeBehaviorType::SEND_REQUEST_EVENT;
189 int32_t requestResult = INVALID_VALUE;
190 cellularCallHiSysEvent->WriteImsCallModeBehaviorEvent(type, info, requestResult);
191 requestResult = CS_CALL_TYPE;
192 cellularCallHiSysEvent->WriteImsCallModeBehaviorEvent(type, info, requestResult);
193 requestResult = IMS_CALL_TYPE;
194 cellularCallHiSysEvent->WriteImsCallModeBehaviorEvent(type, info, requestResult);
195
196 type = CallModeBehaviorType::SEND_RESPONSE_EVENT;
197 requestResult = INVALID_VALUE;
198 cellularCallHiSysEvent->WriteImsCallModeBehaviorEvent(type, info, requestResult);
199 requestResult = CS_CALL_TYPE;
200 cellularCallHiSysEvent->WriteImsCallModeBehaviorEvent(type, info, requestResult);
201 requestResult = IMS_CALL_TYPE;
202 cellularCallHiSysEvent->WriteImsCallModeBehaviorEvent(type, info, requestResult);
203
204 type = CallModeBehaviorType::RECEIVE_REQUEST_EVENT;
205 requestResult = INVALID_VALUE;
206 cellularCallHiSysEvent->WriteImsCallModeBehaviorEvent(type, info, requestResult);
207 requestResult = CS_CALL_TYPE;
208 cellularCallHiSysEvent->WriteImsCallModeBehaviorEvent(type, info, requestResult);
209 requestResult = IMS_CALL_TYPE;
210 cellularCallHiSysEvent->WriteImsCallModeBehaviorEvent(type, info, requestResult);
211
212 type = CallModeBehaviorType::RECEIVE_RESPONSE_EVENT;
213 requestResult = INVALID_VALUE;
214 cellularCallHiSysEvent->WriteImsCallModeBehaviorEvent(type, info, requestResult);
215 requestResult = CS_CALL_TYPE;
216 cellularCallHiSysEvent->WriteImsCallModeBehaviorEvent(type, info, requestResult);
217 requestResult = IMS_CALL_TYPE;
218 cellularCallHiSysEvent->WriteImsCallModeBehaviorEvent(type, info, requestResult);
219
220 cellularCallHiSysEvent->SetIncomingCallParameterInfo(IMS_CALL_TYPE, VIDEO_TYPE);
221 cellularCallHiSysEvent->GetCallParameterInfo(info);
222 EXPECT_EQ(info.incomingCallType, IMS_CALL_TYPE);
223 EXPECT_EQ(info.incomingVideoState, VIDEO_TYPE);
224 }
225
226 /**
227 * @tc.number Telephony_CellularCallHiSysEventTest_0008
228 * @tc.name Test CellularCallHiSysEvent CallDataErrorCodeConversion
229 * @tc.desc Function test
230 */
231 HWTEST_F(CellularCallHiSysEventTest, CellularCallHiSysEventTest_0008, Function | MediumTest | Level1)
232 {
233 std::shared_ptr<CellularCallHiSysEvent> cellularCallHiSysEvent = std::make_shared<CellularCallHiSysEvent>();
234 int32_t errCode = static_cast<int32_t>(CALL_ERR_INVALID_SLOT_ID);
235 CallErrorCode eventValue;
236 int32_t ret = cellularCallHiSysEvent->CallDataErrorCodeConversion(errCode, eventValue);
237 EXPECT_TRUE(ret);
238 EXPECT_EQ(eventValue, CallErrorCode::CALL_ERROR_INVALID_SLOT_ID);
239
240 errCode = static_cast<int32_t>(CALL_ERR_INVALID_CALLID);
241 ret = cellularCallHiSysEvent->CallDataErrorCodeConversion(errCode, eventValue);
242 EXPECT_TRUE(ret);
243 EXPECT_EQ(eventValue, CallErrorCode::CALL_ERROR_INVALID_CALLID);
244
245 errCode = static_cast<int32_t>(CALL_ERR_NUMBER_OUT_OF_RANGE);
246 ret = cellularCallHiSysEvent->CallDataErrorCodeConversion(errCode, eventValue);
247 EXPECT_TRUE(ret);
248 EXPECT_EQ(eventValue, CallErrorCode::CALL_ERROR_NUMBER_OUT_OF_RANGE);
249
250 errCode = static_cast<int32_t>(CALL_ERR_UNSUPPORTED_NETWORK_TYPE);
251 ret = cellularCallHiSysEvent->CallDataErrorCodeConversion(errCode, eventValue);
252 EXPECT_TRUE(ret);
253 EXPECT_EQ(eventValue, CallErrorCode::CALL_ERROR_UNSUPPORTED_NETWORK_TYPE);
254
255 errCode = static_cast<int32_t>(CALL_ERR_INVALID_DIAL_SCENE);
256 ret = cellularCallHiSysEvent->CallDataErrorCodeConversion(errCode, eventValue);
257 EXPECT_TRUE(ret);
258 EXPECT_EQ(eventValue, CallErrorCode::CALL_ERROR_INVALID_DIAL_SCENE);
259
260 errCode = static_cast<int32_t>(CALL_ERR_INVALID_VIDEO_STATE);
261 ret = cellularCallHiSysEvent->CallDataErrorCodeConversion(errCode, eventValue);
262 EXPECT_TRUE(ret);
263 EXPECT_EQ(eventValue, CallErrorCode::CALL_ERROR_INVALID_VIDEO_STATE);
264
265 errCode = static_cast<int32_t>(CALL_ERR_UNKNOW_DIAL_TYPE);
266 ret = cellularCallHiSysEvent->CallDataErrorCodeConversion(errCode, eventValue);
267 EXPECT_TRUE(ret);
268 EXPECT_EQ(eventValue, CallErrorCode::CALL_ERROR_UNKNOW_DIAL_TYPE);
269
270 errCode = static_cast<int32_t>(CALL_ERR_UNKNOW_CALL_TYPE);
271 ret = cellularCallHiSysEvent->CallDataErrorCodeConversion(errCode, eventValue);
272 EXPECT_TRUE(ret);
273 EXPECT_EQ(eventValue, CallErrorCode::CALL_ERROR_UNKNOW_CALL_TYPE);
274
275 errCode = static_cast<int32_t>(CALL_ERR_CALL_OBJECT_IS_NULL);
276 ret = cellularCallHiSysEvent->CallDataErrorCodeConversion(errCode, eventValue);
277 EXPECT_TRUE(ret);
278 EXPECT_EQ(eventValue, CallErrorCode::CALL_ERROR_CALL_OBJECT_IS_NULL);
279 }
280
281 /**
282 * @tc.number Telephony_CellularCallHiSysEventTest_0009
283 * @tc.name Test CellularCallHiSysEvent CallInterfaceErrorCodeConversion
284 * @tc.desc Function test
285 */
286 HWTEST_F(CellularCallHiSysEventTest, CellularCallHiSysEventTest_0009, Function | MediumTest | Level1)
287 {
288 std::shared_ptr<CellularCallHiSysEvent> cellularCallHiSysEvent = std::make_shared<CellularCallHiSysEvent>();
289 int32_t errCode = static_cast<int32_t>(CALL_ERR_DIAL_IS_BUSY);
290 CallErrorCode eventValue;
291 int32_t ret = cellularCallHiSysEvent->CallInterfaceErrorCodeConversion(errCode, eventValue);
292 EXPECT_TRUE(ret);
293 EXPECT_EQ(eventValue, CallErrorCode::CALL_ERROR_DIAL_IS_BUSY);
294
295 errCode = static_cast<int32_t>(CALL_ERR_ILLEGAL_CALL_OPERATION);
296 ret = cellularCallHiSysEvent->CallInterfaceErrorCodeConversion(errCode, eventValue);
297 EXPECT_TRUE(ret);
298 EXPECT_EQ(eventValue, CallErrorCode::CALL_ERROR_ILLEGAL_CALL_OPERATION);
299
300 errCode = static_cast<int32_t>(CALL_ERR_PHONE_CALLSTATE_NOTIFY_FAILED);
301 ret = cellularCallHiSysEvent->CallInterfaceErrorCodeConversion(errCode, eventValue);
302 EXPECT_TRUE(ret);
303 EXPECT_EQ(eventValue, CallErrorCode::CALL_ERROR_PHONE_CALLSTATE_NOTIFY_FAILED);
304
305 errCode = static_cast<int32_t>(CALL_ERR_SYSTEM_EVENT_HANDLE_FAILURE);
306 ret = cellularCallHiSysEvent->CallInterfaceErrorCodeConversion(errCode, eventValue);
307 EXPECT_TRUE(ret);
308 EXPECT_EQ(eventValue, CallErrorCode::CALL_ERROR_SYSTEM_EVENT_HANDLE_FAILURE);
309
310 errCode = static_cast<int32_t>(CALL_ERR_CALL_COUNTS_EXCEED_LIMIT);
311 ret = cellularCallHiSysEvent->CallInterfaceErrorCodeConversion(errCode, eventValue);
312 EXPECT_TRUE(ret);
313 EXPECT_EQ(eventValue, CallErrorCode::CALL_ERROR_CALL_COUNTS_EXCEED_LIMIT);
314 }
315
316 /**
317 * @tc.number Telephony_CellularCallHiSysEventTest_0011
318 * @tc.name Test CellularCallHiSysEvent SetIncomingStartTime
319 * @tc.desc Function test
320 */
321 HWTEST_F(CellularCallHiSysEventTest, CellularCallHiSysEventTest_0011, Function | MediumTest | Level1)
322 {
323 std::shared_ptr<CellularCallHiSysEvent> cellularCallHiSysEvent = std::make_shared<CellularCallHiSysEvent>();
324 int64_t startTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now()
325 .time_since_epoch()).count();
326 cellularCallHiSysEvent->SetIncomingStartTime();
327 int64_t stopTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now()
328 .time_since_epoch()).count();
329 EXPECT_TRUE(((stopTime - startTime) >= 0) && ((stopTime - startTime) < NORMAL_INCOMING_TIME));
330 }
331
332 /**
333 * @tc.number Telephony_CellularCallHiSysEventTest_0012
334 * @tc.name Test CellularCallHiSysEvent JudgingIncomingTimeOut
335 * @tc.desc Function test
336 */
337 HWTEST_F(CellularCallHiSysEventTest, CellularCallHiSysEventTest_0012, Function | MediumTest | Level1)
338 {
339 std::shared_ptr<CellularCallHiSysEvent> cellularCallHiSysEvent = std::make_shared<CellularCallHiSysEvent>();
340
341 int64_t startTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now()
342 .time_since_epoch()).count();
343 cellularCallHiSysEvent->SetIncomingStartTime();
344 cellularCallHiSysEvent->JudgingIncomingTimeOut(0, CS_CALL_TYPE, VOICE_TYPE);
345 int64_t stopTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now()
346 .time_since_epoch()).count();
347 EXPECT_TRUE(((stopTime - startTime) >= 0) && ((stopTime - startTime) < NORMAL_INCOMING_TIME));
348
349 startTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now()
350 .time_since_epoch()).count();
351 cellularCallHiSysEvent->SetIncomingStartTime();
352 std::this_thread::sleep_for(std::chrono::milliseconds(800));
353 cellularCallHiSysEvent->JudgingIncomingTimeOut(0, CS_CALL_TYPE, VOICE_TYPE);
354 stopTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now()
355 .time_since_epoch()).count();
356 EXPECT_TRUE((stopTime - startTime) > NORMAL_INCOMING_TIME);
357 }
358
359 /**
360 * @tc.number Telephony_CellularCallHiSysEventTest_0013
361 * @tc.name Test CellularCallHiSysEvent CallParameterInfo set and get
362 * @tc.desc Function test
363 */
364 HWTEST_F(CellularCallHiSysEventTest, CellularCallHiSysEventTest_0013, Function | MediumTest | Level1)
365 {
366 std::shared_ptr<CellularCallHiSysEvent> cellularCallHiSysEvent = std::make_shared<CellularCallHiSysEvent>();
367
368 CallForwardingInfo info;
369 int32_t slotId = 0;
370 bool enable = true;
371 std::string number = "10086";
372
373 cellularCallHiSysEvent->SetCallForwardingInfo(slotId, enable, number);
374 cellularCallHiSysEvent->GetCallForwardingInfo(info);
375 EXPECT_EQ(info.slotId, slotId);
376 EXPECT_EQ(info.enable, enable);
377 EXPECT_EQ(info.number, number);
378 }
379
380 /**
381 * @tc.number Telephony_SupplementRequestImsTest_0001
382 * @tc.name Test SupplementRequestImsTest
383 * @tc.desc Function test
384 */
385 HWTEST_F(CellularCallHiSysEventTest, SupplementRequestImsTest_0001, Function | MediumTest | Level1)
386 {
387 SupplementRequestIms supplementRequestIms;
388 int32_t slotId = 0;
389 std::string fac;
390 int32_t mode = 0;
391 std::string pw;
392 int32_t index = 0;
393 int32_t ret = supplementRequestIms.SetCallRestrictionRequest(slotId, fac, mode, pw, index);
394 EXPECT_EQ(ret, TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
395 }
396
397 /**
398 * @tc.number Telephony_SupplementRequestImsTest_0002
399 * @tc.name Test SupplementRequestImsTest
400 * @tc.desc Function test
401 */
402 HWTEST_F(CellularCallHiSysEventTest, SupplementRequestImsTest_0002, Function | MediumTest | Level1)
403 {
404 SupplementRequestIms supplementRequestIms;
405 int32_t slotId = 0;
406 bool activate = false;
407 int32_t classType = 0;
408 int32_t index = 0;
409 int32_t ret = supplementRequestIms.SetCallWaitingRequest(slotId, activate, classType, index);
410 EXPECT_EQ(ret, TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
411 }
412
413 /**
414 * @tc.number Telephony_SupplementRequestImsTest_0003
415 * @tc.name Test SupplementRequestImsTest
416 * @tc.desc Function test
417 */
418 HWTEST_F(CellularCallHiSysEventTest, SupplementRequestImsTest_0003, Function | MediumTest | Level1)
419 {
420 SupplementRequestIms supplementRequestIms;
421 int32_t slotId = 0;
422 int32_t index = 0;
423 int32_t ret = supplementRequestIms.GetCallWaitingRequest(slotId, index);
424 EXPECT_EQ(ret, TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
425 }
426
427 /**
428 * @tc.number Telephony_SupplementRequestImsTest_0004
429 * @tc.name Test SupplementRequestImsTest
430 * @tc.desc Function test
431 */
432 HWTEST_F(CellularCallHiSysEventTest, SupplementRequestImsTest_0004, Function | MediumTest | Level1)
433 {
434 SupplementRequestIms supplementRequestIms;
435 int32_t slotId = 0;
436 int32_t presentation = 0;
437 int32_t index = 0;
438 int32_t ret = supplementRequestIms.SetColrRequest(slotId, presentation, index);
439 EXPECT_EQ(ret, TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
440 }
441
442 /**
443 * @tc.number Telephony_SupplementRequestImsTest_0005
444 * @tc.name Test SupplementRequestImsTest
445 * @tc.desc Function test
446 */
447 HWTEST_F(CellularCallHiSysEventTest, SupplementRequestImsTest_0005, Function | MediumTest | Level1)
448 {
449 SupplementRequestIms supplementRequestIms;
450 int32_t slotId = 0;
451 int32_t index = 0;
452 int32_t ret = supplementRequestIms.GetColrRequest(slotId, index);
453 EXPECT_EQ(ret, TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
454 }
455
456 /**
457 * @tc.number Telephony_SupplementRequestImsTest_0006
458 * @tc.name Test SupplementRequestImsTest
459 * @tc.desc Function test
460 */
461 HWTEST_F(CellularCallHiSysEventTest, SupplementRequestImsTest_0006, Function | MediumTest | Level1)
462 {
463 SupplementRequestIms supplementRequestIms;
464 int32_t slotId = 0;
465 int32_t action = 0;
466 int32_t index = 0;
467 auto point = supplementRequestIms.GetMMIHandler(slotId);
468 int32_t ret = supplementRequestIms.SetColpRequest(slotId, action, index);
469 EXPECT_EQ(ret, TELEPHONY_ERR_IPC_CONNECT_STUB_FAIL);
470 }
471
472 /**
473 * @tc.number Telephony_SupplementRequestCsTest_0001
474 * @tc.name Test SupplementRequestCsTest
475 * @tc.desc Function test
476 */
477 HWTEST_F(CellularCallHiSysEventTest, SupplementRequestCsTest_0001, Function | MediumTest | Level1)
478 {
479 SupplementRequestCs supplementRequestCs;
480 int32_t slotId = 0;
481 std::string msg;
482 auto ret = supplementRequestCs.SendUssdRequest(slotId, msg);
483 EXPECT_EQ(ret, TELEPHONY_ERR_LOCAL_PTR_NULL);
484
485 slotId = -1;
486 ret = supplementRequestCs.SendUssdRequest(slotId, msg);
487 EXPECT_NE(ret, TELEPHONY_ERR_ARGUMENT_INVALID);
488 }
489
490 /**
491 * @tc.number Telephony_SupplementRequestCsTest_0002
492 * @tc.name Test SupplementRequestCsTest
493 * @tc.desc Function test
494 */
495 HWTEST_F(CellularCallHiSysEventTest, SupplementRequestCsTest_0002, Function | MediumTest | Level1)
496 {
497 SupplementRequestCs supplementRequestCs;
498 int32_t slotId = 0;
499 auto ret = supplementRequestCs.CloseUnFinishedUssdRequest(slotId);
500 EXPECT_EQ(ret, TELEPHONY_ERR_LOCAL_PTR_NULL);
501
502 CoreManagerInner::GetInstance().telRilManager_ = nullptr;
503 ret = supplementRequestCs.CloseUnFinishedUssdRequest(slotId);
504 EXPECT_EQ(ret, TELEPHONY_ERR_LOCAL_PTR_NULL);
505 }
506 } // namespace Telephony
507 } // namespace OHOS