1d95e75fdSopenharmony_ci/*
2d95e75fdSopenharmony_ci * Copyright (C) 2021-2023 Huawei Device Co., Ltd.
3d95e75fdSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4d95e75fdSopenharmony_ci * you may not use this file except in compliance with the License.
5d95e75fdSopenharmony_ci * You may obtain a copy of the License at
6d95e75fdSopenharmony_ci *
7d95e75fdSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8d95e75fdSopenharmony_ci *
9d95e75fdSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10d95e75fdSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11d95e75fdSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12d95e75fdSopenharmony_ci * See the License for the specific language governing permissions and
13d95e75fdSopenharmony_ci * limitations under the License.
14d95e75fdSopenharmony_ci */
15d95e75fdSopenharmony_ci
16d95e75fdSopenharmony_ci#include "cs_test.h"
17d95e75fdSopenharmony_ci
18d95e75fdSopenharmony_ci#define private public
19d95e75fdSopenharmony_ci#define protected public
20d95e75fdSopenharmony_ci#include "cellular_call_callback.h"
21d95e75fdSopenharmony_ci#include "cellular_call_handler.h"
22d95e75fdSopenharmony_ci#include "cellular_call_proxy.h"
23d95e75fdSopenharmony_ci#include "cellular_call_register.h"
24d95e75fdSopenharmony_ci#include "cellular_call_service.h"
25d95e75fdSopenharmony_ci#include "cellular_call_supplement.h"
26d95e75fdSopenharmony_ci#include "config_request.h"
27d95e75fdSopenharmony_ci#include "core_service_client.h"
28d95e75fdSopenharmony_ci#include "cs_control.h"
29d95e75fdSopenharmony_ci#include "tel_ril_call_parcel.h"
30d95e75fdSopenharmony_ci#include "operator_config_types.h"
31d95e75fdSopenharmony_ci#include "radio_event.h"
32d95e75fdSopenharmony_ci#include "securec.h"
33d95e75fdSopenharmony_ci#include "sim_state_type.h"
34d95e75fdSopenharmony_ci
35d95e75fdSopenharmony_cinamespace OHOS {
36d95e75fdSopenharmony_cinamespace Telephony {
37d95e75fdSopenharmony_ciusing namespace testing::ext;
38d95e75fdSopenharmony_ciconst int32_t SIM1_SLOTID = 0;
39d95e75fdSopenharmony_ciconst int32_t SIM2_SLOTID = 1;
40d95e75fdSopenharmony_ciconst int32_t INVALID_SLOTID = 0xFF;
41d95e75fdSopenharmony_ciconst int32_t INVALID_HANG_UP_TYPE = -1;
42d95e75fdSopenharmony_ciconst int32_t SUCCESS_RESULT = 0;
43d95e75fdSopenharmony_ciconst int32_t ERROR_RESULT = 1;
44d95e75fdSopenharmony_ciconst int32_t USSD_MODE_NOTIFY = 0;
45d95e75fdSopenharmony_ciconst std::string PHONE_NUMBER = "0000000";
46d95e75fdSopenharmony_ciconst std::string PHONE_NUMBER_SECOND = "1111111";
47d95e75fdSopenharmony_ciconst std::string PHONE_NUMBER_THIRD = "2222222";
48d95e75fdSopenharmony_ci
49d95e75fdSopenharmony_ci/**
50d95e75fdSopenharmony_ci * @tc.number   cellular_call_CombineConference_0001
51d95e75fdSopenharmony_ci * @tc.name     Test for combineConference function by cs
52d95e75fdSopenharmony_ci * @tc.desc     Function test
53d95e75fdSopenharmony_ci */
54d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_CombineConference_0001, Function | MediumTest | Level2)
55d95e75fdSopenharmony_ci{
56d95e75fdSopenharmony_ci    AccessToken token;
57d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
58d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
59d95e75fdSopenharmony_ci    auto combineRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
60d95e75fdSopenharmony_ci    ASSERT_TRUE(combineRemote != nullptr);
61d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(combineRemote);
62d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
63d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
64d95e75fdSopenharmony_ci        return;
65d95e75fdSopenharmony_ci    }
66d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
67d95e75fdSopenharmony_ci        CellularCallInfo conferenceCallInfo;
68d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, conferenceCallInfo);
69d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
70d95e75fdSopenharmony_ci        ret = telephonyService->CombineConference(conferenceCallInfo);
71d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
72d95e75fdSopenharmony_ci    }
73d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
74d95e75fdSopenharmony_ci        CellularCallInfo conferenceCallInfo;
75d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, conferenceCallInfo);
76d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
77d95e75fdSopenharmony_ci        ret = telephonyService->CombineConference(conferenceCallInfo);
78d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
79d95e75fdSopenharmony_ci    }
80d95e75fdSopenharmony_ci}
81d95e75fdSopenharmony_ci
82d95e75fdSopenharmony_ci/**
83d95e75fdSopenharmony_ci * @tc.number   cellular_call_CombineConference_0002
84d95e75fdSopenharmony_ci * @tc.name     Test for combineConference function with invalid slot by cs
85d95e75fdSopenharmony_ci * @tc.desc     Function test
86d95e75fdSopenharmony_ci */
87d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_CombineConference_0002, Function | MediumTest | Level2)
88d95e75fdSopenharmony_ci{
89d95e75fdSopenharmony_ci    AccessToken token;
90d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
91d95e75fdSopenharmony_ci        return;
92d95e75fdSopenharmony_ci    }
93d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
94d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
95d95e75fdSopenharmony_ci    auto combineRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
96d95e75fdSopenharmony_ci    ASSERT_TRUE(combineRemote != nullptr);
97d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(combineRemote);
98d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
99d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
100d95e75fdSopenharmony_ci        CellularCallInfo conferenceCallInfo;
101d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, conferenceCallInfo);
102d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
103d95e75fdSopenharmony_ci        ret = telephonyService->CombineConference(conferenceCallInfo);
104d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
105d95e75fdSopenharmony_ci    }
106d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
107d95e75fdSopenharmony_ci        CellularCallInfo conferenceCallInfo;
108d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, conferenceCallInfo);
109d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
110d95e75fdSopenharmony_ci        ret = telephonyService->CombineConference(conferenceCallInfo);
111d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
112d95e75fdSopenharmony_ci    }
113d95e75fdSopenharmony_ci}
114d95e75fdSopenharmony_ci
115d95e75fdSopenharmony_ci/**
116d95e75fdSopenharmony_ci * @tc.number   cellular_call_SeparateConference_0001
117d95e75fdSopenharmony_ci * @tc.name     Test for separateConference function by cs
118d95e75fdSopenharmony_ci * @tc.desc     Function test
119d95e75fdSopenharmony_ci */
120d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_SeparateConference_0001, Function | MediumTest | Level2)
121d95e75fdSopenharmony_ci{
122d95e75fdSopenharmony_ci    AccessToken token;
123d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
124d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
125d95e75fdSopenharmony_ci    auto separateRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
126d95e75fdSopenharmony_ci    ASSERT_TRUE(separateRemote != nullptr);
127d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(separateRemote);
128d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
129d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
130d95e75fdSopenharmony_ci        return;
131d95e75fdSopenharmony_ci    }
132d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
133d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
134d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
135d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
136d95e75fdSopenharmony_ci        ret = telephonyService->SeparateConference(callInfo);
137d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
138d95e75fdSopenharmony_ci    }
139d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
140d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
141d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
142d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
143d95e75fdSopenharmony_ci        ret = telephonyService->SeparateConference(callInfo);
144d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
145d95e75fdSopenharmony_ci    }
146d95e75fdSopenharmony_ci}
147d95e75fdSopenharmony_ci
148d95e75fdSopenharmony_ci/**
149d95e75fdSopenharmony_ci * @tc.number   cellular_call_SeparateConference_0002
150d95e75fdSopenharmony_ci * @tc.name     Test for separateConference function with invalid slot by cs
151d95e75fdSopenharmony_ci * @tc.desc     Function test
152d95e75fdSopenharmony_ci */
153d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_SeparateConference_0002, Function | MediumTest | Level2)
154d95e75fdSopenharmony_ci{
155d95e75fdSopenharmony_ci    AccessToken token;
156d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
157d95e75fdSopenharmony_ci        return;
158d95e75fdSopenharmony_ci    }
159d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
160d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
161d95e75fdSopenharmony_ci    auto separateRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
162d95e75fdSopenharmony_ci    ASSERT_TRUE(separateRemote != nullptr);
163d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(separateRemote);
164d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
165d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
166d95e75fdSopenharmony_ci        CellularCallInfo separateCallInfo;
167d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, separateCallInfo);
168d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
169d95e75fdSopenharmony_ci        ret = telephonyService->SeparateConference(separateCallInfo);
170d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
171d95e75fdSopenharmony_ci    }
172d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
173d95e75fdSopenharmony_ci        CellularCallInfo separateCallInfo;
174d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, separateCallInfo);
175d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
176d95e75fdSopenharmony_ci        ret = telephonyService->SeparateConference(separateCallInfo);
177d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
178d95e75fdSopenharmony_ci    }
179d95e75fdSopenharmony_ci}
180d95e75fdSopenharmony_ci
181d95e75fdSopenharmony_ci/**
182d95e75fdSopenharmony_ci * @tc.number   cellular_call_KickOutFromConference_0001
183d95e75fdSopenharmony_ci * @tc.name     Test for separateConference function by cs
184d95e75fdSopenharmony_ci * @tc.desc     Function test
185d95e75fdSopenharmony_ci */
186d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_KickOutFromConference_0001, Function | MediumTest | Level2)
187d95e75fdSopenharmony_ci{
188d95e75fdSopenharmony_ci    AccessToken token;
189d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
190d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
191d95e75fdSopenharmony_ci    auto kickOutRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
192d95e75fdSopenharmony_ci    ASSERT_TRUE(kickOutRemote != nullptr);
193d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(kickOutRemote);
194d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
195d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
196d95e75fdSopenharmony_ci        return;
197d95e75fdSopenharmony_ci    }
198d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
199d95e75fdSopenharmony_ci        CellularCallInfo kickOutCallInfo;
200d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, kickOutCallInfo);
201d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
202d95e75fdSopenharmony_ci        ret = telephonyService->KickOutFromConference(kickOutCallInfo);
203d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
204d95e75fdSopenharmony_ci    }
205d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
206d95e75fdSopenharmony_ci        CellularCallInfo kickOutCallInfo;
207d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, kickOutCallInfo);
208d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
209d95e75fdSopenharmony_ci        ret = telephonyService->KickOutFromConference(kickOutCallInfo);
210d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
211d95e75fdSopenharmony_ci    }
212d95e75fdSopenharmony_ci}
213d95e75fdSopenharmony_ci
214d95e75fdSopenharmony_ci/**
215d95e75fdSopenharmony_ci * @tc.number   cellular_call_KickOutFromConference_0002
216d95e75fdSopenharmony_ci * @tc.name     Test for KickOutFromConference function with invalid slot by cs
217d95e75fdSopenharmony_ci * @tc.desc     Function test
218d95e75fdSopenharmony_ci */
219d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_KickOutFromConference_0002, Function | MediumTest | Level2)
220d95e75fdSopenharmony_ci{
221d95e75fdSopenharmony_ci    AccessToken token;
222d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
223d95e75fdSopenharmony_ci        return;
224d95e75fdSopenharmony_ci    }
225d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
226d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
227d95e75fdSopenharmony_ci    auto kickOutRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
228d95e75fdSopenharmony_ci    ASSERT_TRUE(kickOutRemote != nullptr);
229d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(kickOutRemote);
230d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
231d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
232d95e75fdSopenharmony_ci        CellularCallInfo kickOutCallInfo;
233d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, kickOutCallInfo);
234d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
235d95e75fdSopenharmony_ci        ret = telephonyService->KickOutFromConference(kickOutCallInfo);
236d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
237d95e75fdSopenharmony_ci    }
238d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
239d95e75fdSopenharmony_ci        CellularCallInfo kickOutCallInfo;
240d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, kickOutCallInfo);
241d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
242d95e75fdSopenharmony_ci        ret = telephonyService->KickOutFromConference(kickOutCallInfo);
243d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
244d95e75fdSopenharmony_ci    }
245d95e75fdSopenharmony_ci}
246d95e75fdSopenharmony_ci
247d95e75fdSopenharmony_ci/**
248d95e75fdSopenharmony_ci * @tc.number   cellular_call_HangUpAllConnection_0001
249d95e75fdSopenharmony_ci * @tc.name     Test for hangup all connection function by cs
250d95e75fdSopenharmony_ci * @tc.desc     Function test
251d95e75fdSopenharmony_ci */
252d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_HangUpAllConnection_0001, Function | MediumTest | Level2)
253d95e75fdSopenharmony_ci{
254d95e75fdSopenharmony_ci    AccessToken token;
255d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
256d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
257d95e75fdSopenharmony_ci    auto hangUpAllConRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
258d95e75fdSopenharmony_ci    ASSERT_TRUE(hangUpAllConRemote != nullptr);
259d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(hangUpAllConRemote);
260d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
261d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
262d95e75fdSopenharmony_ci        return;
263d95e75fdSopenharmony_ci    }
264d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
265d95e75fdSopenharmony_ci        int32_t ret = telephonyService->HangUpAllConnection();
266d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
267d95e75fdSopenharmony_ci    }
268d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
269d95e75fdSopenharmony_ci        int32_t ret = telephonyService->HangUpAllConnection();
270d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
271d95e75fdSopenharmony_ci    }
272d95e75fdSopenharmony_ci}
273d95e75fdSopenharmony_ci
274d95e75fdSopenharmony_ci/**
275d95e75fdSopenharmony_ci * @tc.number   cellular_call_StartDtmf_0001
276d95e75fdSopenharmony_ci * @tc.name     Test for startDtmf function by cs
277d95e75fdSopenharmony_ci * @tc.desc     Function test
278d95e75fdSopenharmony_ci */
279d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_StartDtmf_0001, Function | MediumTest | Level2)
280d95e75fdSopenharmony_ci{
281d95e75fdSopenharmony_ci    AccessToken token;
282d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
283d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
284d95e75fdSopenharmony_ci    auto startDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
285d95e75fdSopenharmony_ci    ASSERT_TRUE(startDtmfRemote != nullptr);
286d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(startDtmfRemote);
287d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
288d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
289d95e75fdSopenharmony_ci        return;
290d95e75fdSopenharmony_ci    }
291d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
292d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
293d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
294d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
295d95e75fdSopenharmony_ci        char code = '1';
296d95e75fdSopenharmony_ci        ret = telephonyService->StartDtmf(code, callInfo);
297d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
298d95e75fdSopenharmony_ci    }
299d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
300d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
301d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
302d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
303d95e75fdSopenharmony_ci        char code = '1';
304d95e75fdSopenharmony_ci        ret = telephonyService->StartDtmf(code, callInfo);
305d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
306d95e75fdSopenharmony_ci    }
307d95e75fdSopenharmony_ci}
308d95e75fdSopenharmony_ci
309d95e75fdSopenharmony_ci/**
310d95e75fdSopenharmony_ci * @tc.number   cellular_call_StartDtmf_0002
311d95e75fdSopenharmony_ci * @tc.name     Test for startDtmf function with invalid slot by cs
312d95e75fdSopenharmony_ci * @tc.desc     Function test
313d95e75fdSopenharmony_ci */
314d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_StartDtmf_0002, Function | MediumTest | Level2)
315d95e75fdSopenharmony_ci{
316d95e75fdSopenharmony_ci    AccessToken token;
317d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
318d95e75fdSopenharmony_ci        return;
319d95e75fdSopenharmony_ci    }
320d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
321d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
322d95e75fdSopenharmony_ci    auto startDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
323d95e75fdSopenharmony_ci    ASSERT_TRUE(startDtmfRemote != nullptr);
324d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(startDtmfRemote);
325d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
326d95e75fdSopenharmony_ci    CellularCallInfo callInfo;
327d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
328d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
329d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
330d95e75fdSopenharmony_ci        char code = '1';
331d95e75fdSopenharmony_ci        ret = telephonyService->StartDtmf(code, callInfo);
332d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
333d95e75fdSopenharmony_ci    }
334d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
335d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, callInfo);
336d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
337d95e75fdSopenharmony_ci        char code = '1';
338d95e75fdSopenharmony_ci        ret = telephonyService->StartDtmf(code, callInfo);
339d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
340d95e75fdSopenharmony_ci    }
341d95e75fdSopenharmony_ci}
342d95e75fdSopenharmony_ci
343d95e75fdSopenharmony_ci/**
344d95e75fdSopenharmony_ci * @tc.number   cellular_call_StopDtmf_0001
345d95e75fdSopenharmony_ci * @tc.name     Test for stopDtmf function by cs
346d95e75fdSopenharmony_ci * @tc.desc     Function test
347d95e75fdSopenharmony_ci */
348d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_StopDtmf_0001, Function | MediumTest | Level2)
349d95e75fdSopenharmony_ci{
350d95e75fdSopenharmony_ci    AccessToken token;
351d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
352d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
353d95e75fdSopenharmony_ci    auto stopDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
354d95e75fdSopenharmony_ci    ASSERT_TRUE(stopDtmfRemote != nullptr);
355d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(stopDtmfRemote);
356d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
357d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
358d95e75fdSopenharmony_ci        return;
359d95e75fdSopenharmony_ci    }
360d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
361d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
362d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, callInfo);
363d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
364d95e75fdSopenharmony_ci        ret = telephonyService->StopDtmf(callInfo);
365d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
366d95e75fdSopenharmony_ci    }
367d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
368d95e75fdSopenharmony_ci        CellularCallInfo callInfo;
369d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, callInfo);
370d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
371d95e75fdSopenharmony_ci        ret = telephonyService->StopDtmf(callInfo);
372d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
373d95e75fdSopenharmony_ci    }
374d95e75fdSopenharmony_ci}
375d95e75fdSopenharmony_ci
376d95e75fdSopenharmony_ci/**
377d95e75fdSopenharmony_ci * @tc.number   cellular_call_StopDtmf_0002
378d95e75fdSopenharmony_ci * @tc.name     Test for stopDtmf function with invalid slot by cs
379d95e75fdSopenharmony_ci * @tc.desc     Function test
380d95e75fdSopenharmony_ci */
381d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_StopDtmf_0002, Function | MediumTest | Level2)
382d95e75fdSopenharmony_ci{
383d95e75fdSopenharmony_ci    AccessToken token;
384d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
385d95e75fdSopenharmony_ci        return;
386d95e75fdSopenharmony_ci    }
387d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
388d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
389d95e75fdSopenharmony_ci    auto stopDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
390d95e75fdSopenharmony_ci    ASSERT_TRUE(stopDtmfRemote != nullptr);
391d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(stopDtmfRemote);
392d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
393d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
394d95e75fdSopenharmony_ci        CellularCallInfo stopDtmfCallInfo;
395d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, stopDtmfCallInfo);
396d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
397d95e75fdSopenharmony_ci        ret = telephonyService->StopDtmf(stopDtmfCallInfo);
398d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
399d95e75fdSopenharmony_ci    }
400d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
401d95e75fdSopenharmony_ci        CellularCallInfo stopDtmfCallInfo;
402d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, stopDtmfCallInfo);
403d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
404d95e75fdSopenharmony_ci        ret = telephonyService->StopDtmf(stopDtmfCallInfo);
405d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
406d95e75fdSopenharmony_ci    }
407d95e75fdSopenharmony_ci}
408d95e75fdSopenharmony_ci
409d95e75fdSopenharmony_ci/**
410d95e75fdSopenharmony_ci * @tc.number   cellular_call_SendDtmf_0001
411d95e75fdSopenharmony_ci * @tc.name     Test for sendDtmf function by cs
412d95e75fdSopenharmony_ci * @tc.desc     Function test
413d95e75fdSopenharmony_ci */
414d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_SendDtmf_0001, Function | MediumTest | Level2)
415d95e75fdSopenharmony_ci{
416d95e75fdSopenharmony_ci    AccessToken token;
417d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
418d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
419d95e75fdSopenharmony_ci    auto sendDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
420d95e75fdSopenharmony_ci    ASSERT_TRUE(sendDtmfRemote != nullptr);
421d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(sendDtmfRemote);
422d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
423d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
424d95e75fdSopenharmony_ci        return;
425d95e75fdSopenharmony_ci    }
426d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
427d95e75fdSopenharmony_ci        CellularCallInfo sendDtmfCallInfo;
428d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, sendDtmfCallInfo);
429d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
430d95e75fdSopenharmony_ci        char code = '1';
431d95e75fdSopenharmony_ci        ret = telephonyService->SendDtmf(code, sendDtmfCallInfo);
432d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
433d95e75fdSopenharmony_ci    }
434d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
435d95e75fdSopenharmony_ci        CellularCallInfo sendDtmfCallInfo;
436d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, sendDtmfCallInfo);
437d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
438d95e75fdSopenharmony_ci        char code = '1';
439d95e75fdSopenharmony_ci        ret = telephonyService->SendDtmf(code, sendDtmfCallInfo);
440d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST);
441d95e75fdSopenharmony_ci    }
442d95e75fdSopenharmony_ci}
443d95e75fdSopenharmony_ci
444d95e75fdSopenharmony_ci/**
445d95e75fdSopenharmony_ci * @tc.number   cellular_call_SendDtmf_0002
446d95e75fdSopenharmony_ci * @tc.name     Test for sendDtmf function with invalid slot by cs
447d95e75fdSopenharmony_ci * @tc.desc     Function test
448d95e75fdSopenharmony_ci */
449d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_SendDtmf_0002, Function | MediumTest | Level2)
450d95e75fdSopenharmony_ci{
451d95e75fdSopenharmony_ci    AccessToken token;
452d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
453d95e75fdSopenharmony_ci        return;
454d95e75fdSopenharmony_ci    }
455d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
456d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
457d95e75fdSopenharmony_ci    auto sendDtmfRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
458d95e75fdSopenharmony_ci    ASSERT_TRUE(sendDtmfRemote != nullptr);
459d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(sendDtmfRemote);
460d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
461d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
462d95e75fdSopenharmony_ci        CellularCallInfo sendDtmfCallInfo;
463d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, sendDtmfCallInfo);
464d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
465d95e75fdSopenharmony_ci        char code = '1';
466d95e75fdSopenharmony_ci        ret = telephonyService->SendDtmf(code, sendDtmfCallInfo);
467d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
468d95e75fdSopenharmony_ci    }
469d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
470d95e75fdSopenharmony_ci        CellularCallInfo sendDtmfCallInfo;
471d95e75fdSopenharmony_ci        int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, sendDtmfCallInfo);
472d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
473d95e75fdSopenharmony_ci        char code = '1';
474d95e75fdSopenharmony_ci        ret = telephonyService->SendDtmf(code, sendDtmfCallInfo);
475d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
476d95e75fdSopenharmony_ci    }
477d95e75fdSopenharmony_ci}
478d95e75fdSopenharmony_ci
479d95e75fdSopenharmony_ci/**
480d95e75fdSopenharmony_ci * @tc.number   cellular_call_GetDomainPreferenceMode_0001
481d95e75fdSopenharmony_ci * @tc.name     Test for GetDomainPreferenceMode function by invalid slotId
482d95e75fdSopenharmony_ci * @tc.desc     Function test
483d95e75fdSopenharmony_ci */
484d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_GetDomainPreferenceMode_0001, Function | MediumTest | Level3)
485d95e75fdSopenharmony_ci{
486d95e75fdSopenharmony_ci    AccessToken token;
487d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
488d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
489d95e75fdSopenharmony_ci    auto domainPrefModeRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
490d95e75fdSopenharmony_ci    ASSERT_TRUE(domainPrefModeRemote != nullptr);
491d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(domainPrefModeRemote);
492d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
493d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
494d95e75fdSopenharmony_ci        return;
495d95e75fdSopenharmony_ci    }
496d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
497d95e75fdSopenharmony_ci        int32_t ret = telephonyService->GetDomainPreferenceMode(INVALID_SLOTID);
498d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
499d95e75fdSopenharmony_ci    }
500d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
501d95e75fdSopenharmony_ci        int32_t ret = telephonyService->GetDomainPreferenceMode(INVALID_SLOTID);
502d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
503d95e75fdSopenharmony_ci    }
504d95e75fdSopenharmony_ci}
505d95e75fdSopenharmony_ci
506d95e75fdSopenharmony_ci/**
507d95e75fdSopenharmony_ci * @tc.number   cellular_call_GetDomainPreferenceMode_0002
508d95e75fdSopenharmony_ci * @tc.name     Test for GetDomainPreferenceMode function by valid slotId
509d95e75fdSopenharmony_ci * @tc.desc     Function test
510d95e75fdSopenharmony_ci */
511d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_GetDomainPreferenceMode_0002, Function | MediumTest | Level3)
512d95e75fdSopenharmony_ci{
513d95e75fdSopenharmony_ci    AccessToken token;
514d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
515d95e75fdSopenharmony_ci        return;
516d95e75fdSopenharmony_ci    }
517d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
518d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
519d95e75fdSopenharmony_ci    auto domainPrefModeRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
520d95e75fdSopenharmony_ci    ASSERT_TRUE(domainPrefModeRemote != nullptr);
521d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(domainPrefModeRemote);
522d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
523d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
524d95e75fdSopenharmony_ci        int32_t ret = telephonyService->GetDomainPreferenceMode(SIM1_SLOTID);
525d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
526d95e75fdSopenharmony_ci    }
527d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
528d95e75fdSopenharmony_ci        int32_t ret = telephonyService->GetDomainPreferenceMode(SIM2_SLOTID);
529d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
530d95e75fdSopenharmony_ci    }
531d95e75fdSopenharmony_ci}
532d95e75fdSopenharmony_ci
533d95e75fdSopenharmony_ci/**
534d95e75fdSopenharmony_ci * @tc.number   cellular_call_GetMute_0001
535d95e75fdSopenharmony_ci * @tc.name     Test for GetMute function by invalid slotId
536d95e75fdSopenharmony_ci * @tc.desc     Function test
537d95e75fdSopenharmony_ci */
538d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_GetMute_0001, Function | MediumTest | Level3)
539d95e75fdSopenharmony_ci{
540d95e75fdSopenharmony_ci    AccessToken token;
541d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
542d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
543d95e75fdSopenharmony_ci    auto getMuteRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
544d95e75fdSopenharmony_ci    ASSERT_TRUE(getMuteRemote != nullptr);
545d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(getMuteRemote);
546d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
547d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
548d95e75fdSopenharmony_ci        return;
549d95e75fdSopenharmony_ci    }
550d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
551d95e75fdSopenharmony_ci        int32_t ret = telephonyService->GetMute(INVALID_SLOTID);
552d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
553d95e75fdSopenharmony_ci    }
554d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
555d95e75fdSopenharmony_ci        int32_t ret = telephonyService->GetMute(INVALID_SLOTID);
556d95e75fdSopenharmony_ci        EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID);
557d95e75fdSopenharmony_ci    }
558d95e75fdSopenharmony_ci}
559d95e75fdSopenharmony_ci
560d95e75fdSopenharmony_ci/**
561d95e75fdSopenharmony_ci * @tc.number   cellular_call_GetMute_0002
562d95e75fdSopenharmony_ci * @tc.name     Test for GetMute function by valid slotId
563d95e75fdSopenharmony_ci * @tc.desc     Function test
564d95e75fdSopenharmony_ci */
565d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_GetMute_0002, Function | MediumTest | Level3)
566d95e75fdSopenharmony_ci{
567d95e75fdSopenharmony_ci    AccessToken token;
568d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
569d95e75fdSopenharmony_ci        return;
570d95e75fdSopenharmony_ci    }
571d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
572d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
573d95e75fdSopenharmony_ci    auto getMuteRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
574d95e75fdSopenharmony_ci    ASSERT_TRUE(getMuteRemote != nullptr);
575d95e75fdSopenharmony_ci    auto telephonyService = iface_cast<CellularCallInterface>(getMuteRemote);
576d95e75fdSopenharmony_ci    ASSERT_TRUE(telephonyService != nullptr);
577d95e75fdSopenharmony_ci    if (HasSimCard(SIM1_SLOTID)) {
578d95e75fdSopenharmony_ci        int32_t ret = telephonyService->GetMute(SIM1_SLOTID);
579d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
580d95e75fdSopenharmony_ci    }
581d95e75fdSopenharmony_ci    if (HasSimCard(SIM2_SLOTID)) {
582d95e75fdSopenharmony_ci        int32_t ret = telephonyService->GetMute(SIM2_SLOTID);
583d95e75fdSopenharmony_ci        EXPECT_EQ(ret, TELEPHONY_SUCCESS);
584d95e75fdSopenharmony_ci    }
585d95e75fdSopenharmony_ci}
586d95e75fdSopenharmony_ci
587d95e75fdSopenharmony_ci/**
588d95e75fdSopenharmony_ci * @tc.number   cellular_call_CsControl_0001
589d95e75fdSopenharmony_ci * @tc.name     Test for CsControl
590d95e75fdSopenharmony_ci * @tc.desc     Function test
591d95e75fdSopenharmony_ci */
592d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_CsControl_0001, Function | MediumTest | Level3)
593d95e75fdSopenharmony_ci{
594d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
595d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
596d95e75fdSopenharmony_ci    auto csControlRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
597d95e75fdSopenharmony_ci    ASSERT_TRUE(csControlRemote != nullptr);
598d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
599d95e75fdSopenharmony_ci        return;
600d95e75fdSopenharmony_ci    }
601d95e75fdSopenharmony_ci    auto csControl = std::make_shared<CSControl>();
602d95e75fdSopenharmony_ci    CellularCallInfo cellularCallInfo;
603d95e75fdSopenharmony_ci    bool enabled = false;
604d95e75fdSopenharmony_ci    EXPECT_EQ(InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, cellularCallInfo), TELEPHONY_SUCCESS);
605d95e75fdSopenharmony_ci    EXPECT_EQ(csControl->Dial(cellularCallInfo, enabled), CALL_ERR_GET_RADIO_STATE_FAILED);
606d95e75fdSopenharmony_ci    EXPECT_EQ(InitCellularCallInfo(INVALID_SLOTID, "", cellularCallInfo), TELEPHONY_SUCCESS);
607d95e75fdSopenharmony_ci    EXPECT_EQ(csControl->Dial(cellularCallInfo, enabled), CALL_ERR_PHONE_NUMBER_EMPTY);
608d95e75fdSopenharmony_ci    for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) {
609d95e75fdSopenharmony_ci        if (!HasSimCard(slotId)) {
610d95e75fdSopenharmony_ci            continue;
611d95e75fdSopenharmony_ci        }
612d95e75fdSopenharmony_ci        EXPECT_EQ(InitCellularCallInfo(slotId, "*30#", cellularCallInfo), TELEPHONY_SUCCESS);
613d95e75fdSopenharmony_ci        EXPECT_EQ(csControl->DialCdma(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE);
614d95e75fdSopenharmony_ci        EXPECT_EQ(csControl->DialGsm(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE);
615d95e75fdSopenharmony_ci        EXPECT_EQ(InitCellularCallInfo(slotId, "#30#", cellularCallInfo), TELEPHONY_SUCCESS);
616d95e75fdSopenharmony_ci        EXPECT_EQ(csControl->DialGsm(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE);
617d95e75fdSopenharmony_ci        EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER, cellularCallInfo), TELEPHONY_SUCCESS);
618d95e75fdSopenharmony_ci        EXPECT_EQ(csControl->DialCdma(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE);
619d95e75fdSopenharmony_ci        EXPECT_EQ(csControl->Dial(cellularCallInfo, enabled), CALL_ERR_GET_RADIO_STATE_FAILED);
620d95e75fdSopenharmony_ci        ASSERT_FALSE(csControl->CalculateInternationalRoaming(slotId));
621d95e75fdSopenharmony_ci        EXPECT_NE(csControl->DialCdma(cellularCallInfo), TELEPHONY_SUCCESS);
622d95e75fdSopenharmony_ci        EXPECT_EQ(csControl->DialGsm(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE);
623d95e75fdSopenharmony_ci        EXPECT_NE(csControl->Answer(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE);
624d95e75fdSopenharmony_ci        EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER_SECOND, cellularCallInfo), TELEPHONY_SUCCESS);
625d95e75fdSopenharmony_ci        EXPECT_NE(csControl->Answer(cellularCallInfo), CALL_ERR_CALL_STATE);
626d95e75fdSopenharmony_ci        EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER_THIRD, cellularCallInfo), TELEPHONY_SUCCESS);
627d95e75fdSopenharmony_ci        EXPECT_NE(csControl->Answer(cellularCallInfo), CALL_ERR_CALL_STATE);
628d95e75fdSopenharmony_ci        EXPECT_NE(csControl->Reject(cellularCallInfo), CALL_ERR_CALL_STATE);
629d95e75fdSopenharmony_ci        EXPECT_EQ(InitCellularCallInfo(slotId, PHONE_NUMBER, cellularCallInfo), TELEPHONY_SUCCESS);
630d95e75fdSopenharmony_ci        EXPECT_EQ(csControl->SeparateConference(slotId, PHONE_NUMBER, 1), CALL_ERR_RESOURCE_UNAVAILABLE);
631d95e75fdSopenharmony_ci        EXPECT_EQ(csControl->SeparateConference(slotId, "", 1), CALL_ERR_RESOURCE_UNAVAILABLE);
632d95e75fdSopenharmony_ci        EXPECT_NE(csControl->HangUp(cellularCallInfo, CallSupplementType::TYPE_DEFAULT), CALL_ERR_RESOURCE_UNAVAILABLE);
633d95e75fdSopenharmony_ci        EXPECT_EQ(csControl->HangUp(cellularCallInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE),
634d95e75fdSopenharmony_ci            CALL_ERR_RESOURCE_UNAVAILABLE);
635d95e75fdSopenharmony_ci        EXPECT_EQ(
636d95e75fdSopenharmony_ci            csControl->HangUp(cellularCallInfo, CallSupplementType::TYPE_HANG_UP_ALL), CALL_ERR_RESOURCE_UNAVAILABLE);
637d95e75fdSopenharmony_ci        EXPECT_EQ(csControl->HangUp(cellularCallInfo, static_cast<CallSupplementType>(INVALID_HANG_UP_TYPE)),
638d95e75fdSopenharmony_ci            TELEPHONY_ERR_ARGUMENT_INVALID);
639d95e75fdSopenharmony_ci    }
640d95e75fdSopenharmony_ci}
641d95e75fdSopenharmony_ci
642d95e75fdSopenharmony_ci/**
643d95e75fdSopenharmony_ci * @tc.number   cellular_call_CsControl_0002
644d95e75fdSopenharmony_ci * @tc.name     Test for CsControl
645d95e75fdSopenharmony_ci * @tc.desc     Function test
646d95e75fdSopenharmony_ci */
647d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_CsControl_0002, Function | MediumTest | Level3)
648d95e75fdSopenharmony_ci{
649d95e75fdSopenharmony_ci    auto csControl = std::make_shared<CSControl>();
650d95e75fdSopenharmony_ci    CellularCallInfo cellularCallInfo;
651d95e75fdSopenharmony_ci    for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) {
652d95e75fdSopenharmony_ci        if (!HasSimCard(slotId)) {
653d95e75fdSopenharmony_ci            continue;
654d95e75fdSopenharmony_ci        }
655d95e75fdSopenharmony_ci        CallInfoList callList;
656d95e75fdSopenharmony_ci        callList.callSize = 0;
657d95e75fdSopenharmony_ci        EXPECT_EQ(csControl->ReportCallsData(slotId, callList), TELEPHONY_ERROR);
658d95e75fdSopenharmony_ci        EXPECT_NE(csControl->ReportUpdateInfo(slotId, callList), TELEPHONY_SUCCESS);
659d95e75fdSopenharmony_ci        CallInfo callInfo;
660d95e75fdSopenharmony_ci        callList.callSize = 1;
661d95e75fdSopenharmony_ci        callInfo.number = PHONE_NUMBER;
662d95e75fdSopenharmony_ci        callInfo.index = 1;
663d95e75fdSopenharmony_ci        callInfo.state = static_cast<int32_t>(TelCallState::CALL_STATUS_INCOMING);
664d95e75fdSopenharmony_ci        callList.calls.push_back(callInfo);
665d95e75fdSopenharmony_ci        EXPECT_EQ(csControl->ReportCallsData(slotId, callList), TELEPHONY_SUCCESS);
666d95e75fdSopenharmony_ci        callList.callSize = 2;
667d95e75fdSopenharmony_ci        callInfo.state = static_cast<int32_t>(TelCallState::CALL_STATUS_ACTIVE);
668d95e75fdSopenharmony_ci        callInfo.number = PHONE_NUMBER_SECOND;
669d95e75fdSopenharmony_ci        callInfo.index = 2;
670d95e75fdSopenharmony_ci        callList.calls.push_back(callInfo);
671d95e75fdSopenharmony_ci        callList.callSize = 3;
672d95e75fdSopenharmony_ci        callInfo.state = static_cast<int32_t>(TelCallState::CALL_STATUS_DISCONNECTED);
673d95e75fdSopenharmony_ci        callInfo.number = PHONE_NUMBER_THIRD;
674d95e75fdSopenharmony_ci        callInfo.index = 3;
675d95e75fdSopenharmony_ci        callList.calls.push_back(callInfo);
676d95e75fdSopenharmony_ci        callList.callSize = 0;
677d95e75fdSopenharmony_ci        EXPECT_EQ(csControl->ReportCallsData(slotId, callList), TELEPHONY_SUCCESS);
678d95e75fdSopenharmony_ci        EXPECT_NE(csControl->ReportCallsData(slotId, callList), TELEPHONY_SUCCESS);
679d95e75fdSopenharmony_ci        EXPECT_NE(csControl->Reject(cellularCallInfo), CALL_ERR_RESOURCE_UNAVAILABLE);
680d95e75fdSopenharmony_ci        EXPECT_NE(csControl->HoldCall(slotId), CALL_ERR_CALL_STATE);
681d95e75fdSopenharmony_ci        EXPECT_NE(csControl->UnHoldCall(slotId), CALL_ERR_CALL_STATE);
682d95e75fdSopenharmony_ci        EXPECT_NE(csControl->SwitchCall(slotId), CALL_ERR_CALL_STATE);
683d95e75fdSopenharmony_ci    }
684d95e75fdSopenharmony_ci}
685d95e75fdSopenharmony_ci
686d95e75fdSopenharmony_ci/**
687d95e75fdSopenharmony_ci * @tc.number   cellular_call_CellularCallConnectionCS_0001
688d95e75fdSopenharmony_ci * @tc.name     Test for CellularCallConnectionCS
689d95e75fdSopenharmony_ci * @tc.desc     Function test
690d95e75fdSopenharmony_ci */
691d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_CellularCallConnectionCS_0001, Function | MediumTest | Level3)
692d95e75fdSopenharmony_ci{
693d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
694d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
695d95e75fdSopenharmony_ci    auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
696d95e75fdSopenharmony_ci    ASSERT_TRUE(remote != nullptr);
697d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
698d95e75fdSopenharmony_ci        return;
699d95e75fdSopenharmony_ci    }
700d95e75fdSopenharmony_ci
701d95e75fdSopenharmony_ci    for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) {
702d95e75fdSopenharmony_ci        if (!HasSimCard(slotId)) {
703d95e75fdSopenharmony_ci            continue;
704d95e75fdSopenharmony_ci        }
705d95e75fdSopenharmony_ci        CellularCallConnectionCS csConnection;
706d95e75fdSopenharmony_ci        EXPECT_EQ(csConnection.SendDtmfRequest(slotId, '1', 1), CALL_ERR_RESOURCE_UNAVAILABLE);
707d95e75fdSopenharmony_ci        EXPECT_EQ(csConnection.StartDtmfRequest(slotId, '1', 1), CALL_ERR_RESOURCE_UNAVAILABLE);
708d95e75fdSopenharmony_ci        EXPECT_EQ(csConnection.StopDtmfRequest(slotId, 1), CALL_ERR_RESOURCE_UNAVAILABLE);
709d95e75fdSopenharmony_ci        EXPECT_EQ(csConnection.GetCsCallsDataRequest(slotId, 1), CALL_ERR_RESOURCE_UNAVAILABLE);
710d95e75fdSopenharmony_ci        EXPECT_EQ(csConnection.GetCallFailReasonRequest(slotId), CALL_ERR_RESOURCE_UNAVAILABLE);
711d95e75fdSopenharmony_ci        MMICodeUtils utils;
712d95e75fdSopenharmony_ci        ASSERT_FALSE(utils.IsNeedExecuteMmi("", false));
713d95e75fdSopenharmony_ci        ASSERT_FALSE(utils.ExecuteMmiCode(slotId));
714d95e75fdSopenharmony_ci    }
715d95e75fdSopenharmony_ci}
716d95e75fdSopenharmony_ci
717d95e75fdSopenharmony_ci/**
718d95e75fdSopenharmony_ci * @tc.number   cellular_call_CellularCallRegister_0001
719d95e75fdSopenharmony_ci * @tc.name     Test for CellularCallRegister
720d95e75fdSopenharmony_ci * @tc.desc     Function test
721d95e75fdSopenharmony_ci */
722d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_CellularCallRegister_0001, Function | MediumTest | Level3)
723d95e75fdSopenharmony_ci{
724d95e75fdSopenharmony_ci    auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
725d95e75fdSopenharmony_ci    ASSERT_TRUE(systemAbilityMgr != nullptr);
726d95e75fdSopenharmony_ci    auto cellularCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID);
727d95e75fdSopenharmony_ci    ASSERT_TRUE(cellularCallRemote != nullptr);
728d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
729d95e75fdSopenharmony_ci        return;
730d95e75fdSopenharmony_ci    }
731d95e75fdSopenharmony_ci    auto callRegister = DelayedSingleton<CellularCallRegister>::GetInstance();
732d95e75fdSopenharmony_ci    ASSERT_TRUE(callRegister != nullptr);
733d95e75fdSopenharmony_ci    CellularCallEventInfo callEvent;
734d95e75fdSopenharmony_ci    callRegister->ReportEventResultInfo(callEvent);
735d95e75fdSopenharmony_ci    CallWaitResponse waitResponse;
736d95e75fdSopenharmony_ci    callRegister->ReportGetWaitingResult(waitResponse);
737d95e75fdSopenharmony_ci    callRegister->ReportSetWaitingResult(ERROR_RESULT);
738d95e75fdSopenharmony_ci    CallRestrictionResponse restrictionResponse;
739d95e75fdSopenharmony_ci    callRegister->ReportGetRestrictionResult(restrictionResponse);
740d95e75fdSopenharmony_ci    callRegister->ReportSetRestrictionResult(ERROR_RESULT);
741d95e75fdSopenharmony_ci    callRegister->ReportSetBarringPasswordResult(ERROR_RESULT);
742d95e75fdSopenharmony_ci    CallTransferResponse transferResponse;
743d95e75fdSopenharmony_ci    callRegister->ReportGetTransferResult(transferResponse);
744d95e75fdSopenharmony_ci    callRegister->ReportSetTransferResult(ERROR_RESULT);
745d95e75fdSopenharmony_ci    ClipResponse clipResponse;
746d95e75fdSopenharmony_ci    callRegister->ReportGetClipResult(clipResponse);
747d95e75fdSopenharmony_ci    ClirResponse clirResponse;
748d95e75fdSopenharmony_ci    callRegister->ReportGetClirResult(clirResponse);
749d95e75fdSopenharmony_ci    callRegister->ReportSetClirResult(ERROR_RESULT);
750d95e75fdSopenharmony_ci    callRegister->ReportCallRingBackResult(ERROR_RESULT);
751d95e75fdSopenharmony_ci    DisconnectedDetails details;
752d95e75fdSopenharmony_ci    callRegister->ReportCallFailReason(details);
753d95e75fdSopenharmony_ci    MuteControlResponse muteResponse;
754d95e75fdSopenharmony_ci    callRegister->ReportSetMuteResult(muteResponse);
755d95e75fdSopenharmony_ci    callRegister->ReportGetMuteResult(muteResponse);
756d95e75fdSopenharmony_ci    callRegister->ReportInviteToConferenceResult(ERROR_RESULT);
757d95e75fdSopenharmony_ci    callRegister->ReportGetCallDataResult(ERROR_RESULT);
758d95e75fdSopenharmony_ci    callRegister->ReportStartDtmfResult(ERROR_RESULT);
759d95e75fdSopenharmony_ci    callRegister->ReportStopDtmfResult(ERROR_RESULT);
760d95e75fdSopenharmony_ci    callRegister->ReportStartRttResult(ERROR_RESULT);
761d95e75fdSopenharmony_ci    callRegister->ReportStopRttResult(ERROR_RESULT);
762d95e75fdSopenharmony_ci    callRegister->ReportSendUssdResult(ERROR_RESULT);
763d95e75fdSopenharmony_ci    SetEccListResponse eccListResponse;
764d95e75fdSopenharmony_ci    callRegister->ReportSetEmergencyCallListResponse(eccListResponse);
765d95e75fdSopenharmony_ci    MmiCodeInfo mmiInfo;
766d95e75fdSopenharmony_ci    callRegister->ReportMmiCodeResult(mmiInfo);
767d95e75fdSopenharmony_ci    ASSERT_FALSE(callRegister->IsCallManagerCallBackRegistered());
768d95e75fdSopenharmony_ci}
769d95e75fdSopenharmony_ci
770d95e75fdSopenharmony_ci/**
771d95e75fdSopenharmony_ci * @tc.number   cellular_call_CellularCallRegister_0002
772d95e75fdSopenharmony_ci * @tc.name     Test for CellularCallRegister
773d95e75fdSopenharmony_ci * @tc.desc     Function test
774d95e75fdSopenharmony_ci */
775d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_CellularCallRegister_0002, Function | MediumTest | Level3)
776d95e75fdSopenharmony_ci{
777d95e75fdSopenharmony_ci    auto callRegister = DelayedSingleton<CellularCallRegister>::GetInstance();
778d95e75fdSopenharmony_ci    CallReportInfo callRepotInfo;
779d95e75fdSopenharmony_ci    callRepotInfo.callType = CallType::TYPE_CS;
780d95e75fdSopenharmony_ci    callRepotInfo.accountId = INVALID_SLOTID;
781d95e75fdSopenharmony_ci    callRepotInfo.state = TelCallState::CALL_STATUS_INCOMING;
782d95e75fdSopenharmony_ci    callRepotInfo.callMode = VideoStateType::TYPE_VOICE;
783d95e75fdSopenharmony_ci    CallsReportInfo calls;
784d95e75fdSopenharmony_ci    calls.slotId = INVALID_SLOTID;
785d95e75fdSopenharmony_ci    calls.callVec.push_back(callRepotInfo);
786d95e75fdSopenharmony_ci    callRegister->ReportCallsInfo(calls);
787d95e75fdSopenharmony_ci    callRegister->ReportSingleCallInfo(callRepotInfo, TelCallState::CALL_STATUS_INCOMING);
788d95e75fdSopenharmony_ci    EXPECT_EQ(callRegister->RegisterCallManagerCallBack(nullptr), TELEPHONY_SUCCESS);
789d95e75fdSopenharmony_ci    EXPECT_EQ(callRegister->UnRegisterCallManagerCallBack(), TELEPHONY_SUCCESS);
790d95e75fdSopenharmony_ci}
791d95e75fdSopenharmony_ci
792d95e75fdSopenharmony_ci/**
793d95e75fdSopenharmony_ci * @tc.number   cellular_call_SupplementRequestCs_0001
794d95e75fdSopenharmony_ci * @tc.name     Test for SupplementRequestCs
795d95e75fdSopenharmony_ci * @tc.desc     Function test
796d95e75fdSopenharmony_ci */
797d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_SupplementRequestCs_0001, Function | MediumTest | Level3)
798d95e75fdSopenharmony_ci{
799d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
800d95e75fdSopenharmony_ci        return;
801d95e75fdSopenharmony_ci    }
802d95e75fdSopenharmony_ci
803d95e75fdSopenharmony_ci    for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) {
804d95e75fdSopenharmony_ci        if (!HasSimCard(slotId)) {
805d95e75fdSopenharmony_ci            continue;
806d95e75fdSopenharmony_ci        }
807d95e75fdSopenharmony_ci        SupplementRequestCs request;
808d95e75fdSopenharmony_ci        std::string fac = "fac";
809d95e75fdSopenharmony_ci        std::string pw = "test";
810d95e75fdSopenharmony_ci        int32_t index = 1;
811d95e75fdSopenharmony_ci        int32_t mode = 1;
812d95e75fdSopenharmony_ci        int32_t classType = 1;
813d95e75fdSopenharmony_ci        const char *oldPassword = "oldpwd";
814d95e75fdSopenharmony_ci        const char *newPassword = "newpwd";
815d95e75fdSopenharmony_ci        bool active = true;
816d95e75fdSopenharmony_ci        CallTransferParam param;
817d95e75fdSopenharmony_ci        EXPECT_NE(request.GetCallRestrictionRequest(slotId, fac, index), TELEPHONY_SUCCESS);
818d95e75fdSopenharmony_ci        EXPECT_NE(request.SetCallRestrictionRequest(slotId, fac, mode, pw, index), TELEPHONY_SUCCESS);
819d95e75fdSopenharmony_ci        EXPECT_NE(request.SetBarringPasswordRequest(slotId, fac, index, oldPassword, newPassword), TELEPHONY_SUCCESS);
820d95e75fdSopenharmony_ci        EXPECT_NE(request.GetCallWaitingRequest(slotId, index), TELEPHONY_SUCCESS);
821d95e75fdSopenharmony_ci        EXPECT_NE(request.SetCallWaitingRequest(slotId, active, classType, index), TELEPHONY_SUCCESS);
822d95e75fdSopenharmony_ci        EXPECT_NE(request.GetClipRequest(slotId, index), TELEPHONY_SUCCESS);
823d95e75fdSopenharmony_ci        EXPECT_NE(request.GetClirRequest(slotId, index), TELEPHONY_SUCCESS);
824d95e75fdSopenharmony_ci        EXPECT_NE(request.SetClirRequest(slotId, mode, index), TELEPHONY_SUCCESS);
825d95e75fdSopenharmony_ci        EXPECT_NE(request.GetCallTransferRequest(slotId, mode, index), TELEPHONY_SUCCESS);
826d95e75fdSopenharmony_ci        EXPECT_NE(request.SetCallTransferRequest(slotId, param, index), TELEPHONY_SUCCESS);
827d95e75fdSopenharmony_ci    }
828d95e75fdSopenharmony_ci}
829d95e75fdSopenharmony_ci
830d95e75fdSopenharmony_ci/**
831d95e75fdSopenharmony_ci * @tc.number   cellular_call_ConfigRequest_0001
832d95e75fdSopenharmony_ci * @tc.name     Test for ConfigRequest
833d95e75fdSopenharmony_ci * @tc.desc     Function test
834d95e75fdSopenharmony_ci */
835d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_ConfigRequest_0001, Function | MediumTest | Level3)
836d95e75fdSopenharmony_ci{
837d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
838d95e75fdSopenharmony_ci        return;
839d95e75fdSopenharmony_ci    }
840d95e75fdSopenharmony_ci
841d95e75fdSopenharmony_ci    for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) {
842d95e75fdSopenharmony_ci        if (!HasSimCard(slotId)) {
843d95e75fdSopenharmony_ci            continue;
844d95e75fdSopenharmony_ci        }
845d95e75fdSopenharmony_ci        ConfigRequest config;
846d95e75fdSopenharmony_ci        int32_t mode = 1;
847d95e75fdSopenharmony_ci        EXPECT_NE(config.SetDomainPreferenceModeRequest(slotId, mode), TELEPHONY_SUCCESS);
848d95e75fdSopenharmony_ci        EXPECT_NE(config.GetDomainPreferenceModeRequest(slotId), TELEPHONY_SUCCESS);
849d95e75fdSopenharmony_ci        EXPECT_NE(config.SetMuteRequest(slotId, mode), TELEPHONY_SUCCESS);
850d95e75fdSopenharmony_ci        EXPECT_NE(config.GetMuteRequest(slotId), TELEPHONY_SUCCESS);
851d95e75fdSopenharmony_ci    }
852d95e75fdSopenharmony_ci}
853d95e75fdSopenharmony_ci
854d95e75fdSopenharmony_ci/**
855d95e75fdSopenharmony_ci * @tc.number   cellular_call_CellularCallSupplement_0001
856d95e75fdSopenharmony_ci * @tc.name     Test for CellularCallSupplement
857d95e75fdSopenharmony_ci * @tc.desc     Function test
858d95e75fdSopenharmony_ci */
859d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_CellularCallSupplement_0001, Function | MediumTest | Level3)
860d95e75fdSopenharmony_ci{
861d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
862d95e75fdSopenharmony_ci        return;
863d95e75fdSopenharmony_ci    }
864d95e75fdSopenharmony_ci
865d95e75fdSopenharmony_ci    for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) {
866d95e75fdSopenharmony_ci        if (!HasSimCard(slotId)) {
867d95e75fdSopenharmony_ci            continue;
868d95e75fdSopenharmony_ci        }
869d95e75fdSopenharmony_ci        MMIData mmiData;
870d95e75fdSopenharmony_ci        CellularCallSupplement supplement;
871d95e75fdSopenharmony_ci        mmiData.actionString = "";
872d95e75fdSopenharmony_ci        supplement.AlterPinPassword(slotId, mmiData);
873d95e75fdSopenharmony_ci        supplement.AlterPin2Password(slotId, mmiData);
874d95e75fdSopenharmony_ci        supplement.UnlockPuk(slotId, mmiData);
875d95e75fdSopenharmony_ci        supplement.UnlockPuk2(slotId, mmiData);
876d95e75fdSopenharmony_ci        mmiData.actionString = "test";
877d95e75fdSopenharmony_ci        mmiData.serviceInfoA = "infoA";
878d95e75fdSopenharmony_ci        mmiData.serviceInfoB = "infoB";
879d95e75fdSopenharmony_ci        mmiData.serviceInfoC = "infoC";
880d95e75fdSopenharmony_ci        supplement.AlterPinPassword(slotId, mmiData);
881d95e75fdSopenharmony_ci        supplement.AlterPin2Password(slotId, mmiData);
882d95e75fdSopenharmony_ci        supplement.UnlockPuk(slotId, mmiData);
883d95e75fdSopenharmony_ci        supplement.UnlockPuk2(slotId, mmiData);
884d95e75fdSopenharmony_ci        mmiData.serviceInfoC = "infoB";
885d95e75fdSopenharmony_ci        supplement.AlterPinPassword(slotId, mmiData);
886d95e75fdSopenharmony_ci        supplement.AlterPin2Password(slotId, mmiData);
887d95e75fdSopenharmony_ci        supplement.UnlockPuk(slotId, mmiData);
888d95e75fdSopenharmony_ci        supplement.UnlockPuk2(slotId, mmiData);
889d95e75fdSopenharmony_ci        ASSERT_FALSE(supplement.IsVaildPinOrPuk("B", "B"));
890d95e75fdSopenharmony_ci        EXPECT_NE(supplement.SendUssd(slotId, "test"), TELEPHONY_SUCCESS);
891d95e75fdSopenharmony_ci    }
892d95e75fdSopenharmony_ci}
893d95e75fdSopenharmony_ci
894d95e75fdSopenharmony_ci/**
895d95e75fdSopenharmony_ci * @tc.number   cellular_call_CellularCallSupplement_0002
896d95e75fdSopenharmony_ci * @tc.name     Test for CellularCallSupplement
897d95e75fdSopenharmony_ci * @tc.desc     Function test
898d95e75fdSopenharmony_ci */
899d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_CellularCallSupplement_0002, Function | MediumTest | Level3)
900d95e75fdSopenharmony_ci{
901d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
902d95e75fdSopenharmony_ci        return;
903d95e75fdSopenharmony_ci    }
904d95e75fdSopenharmony_ci
905d95e75fdSopenharmony_ci    for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) {
906d95e75fdSopenharmony_ci        if (!HasSimCard(slotId)) {
907d95e75fdSopenharmony_ci            continue;
908d95e75fdSopenharmony_ci        }
909d95e75fdSopenharmony_ci        CellularCallSupplement supplement;
910d95e75fdSopenharmony_ci        supplement.ObtainBarringInstallation("33");
911d95e75fdSopenharmony_ci        supplement.ObtainBarringInstallation("331");
912d95e75fdSopenharmony_ci        supplement.ObtainBarringInstallation("332");
913d95e75fdSopenharmony_ci        supplement.ObtainBarringInstallation("351");
914d95e75fdSopenharmony_ci        supplement.ObtainBarringInstallation("35");
915d95e75fdSopenharmony_ci        supplement.ObtainBarringInstallation("330");
916d95e75fdSopenharmony_ci        supplement.ObtainBarringInstallation("333");
917d95e75fdSopenharmony_ci        supplement.ObtainBarringInstallation("353");
918d95e75fdSopenharmony_ci        supplement.ObtainBarringInstallation("1000");
919d95e75fdSopenharmony_ci
920d95e75fdSopenharmony_ci        EXPECT_NE(supplement.ObtainServiceCode("10"), TELEPHONY_SUCCESS);
921d95e75fdSopenharmony_ci        EXPECT_NE(supplement.ObtainServiceCode("11"), TELEPHONY_SUCCESS);
922d95e75fdSopenharmony_ci        EXPECT_NE(supplement.ObtainServiceCode("12"), TELEPHONY_SUCCESS);
923d95e75fdSopenharmony_ci        EXPECT_NE(supplement.ObtainServiceCode("13"), TELEPHONY_SUCCESS);
924d95e75fdSopenharmony_ci        EXPECT_NE(supplement.ObtainServiceCode("16"), TELEPHONY_SUCCESS);
925d95e75fdSopenharmony_ci        EXPECT_NE(supplement.ObtainServiceCode("19"), TELEPHONY_SUCCESS);
926d95e75fdSopenharmony_ci        EXPECT_NE(supplement.ObtainServiceCode("20"), TELEPHONY_SUCCESS);
927d95e75fdSopenharmony_ci        EXPECT_NE(supplement.ObtainServiceCode("21"), TELEPHONY_SUCCESS);
928d95e75fdSopenharmony_ci        EXPECT_NE(supplement.ObtainServiceCode("22"), TELEPHONY_SUCCESS);
929d95e75fdSopenharmony_ci        EXPECT_NE(supplement.ObtainServiceCode("24"), TELEPHONY_SUCCESS);
930d95e75fdSopenharmony_ci        EXPECT_NE(supplement.ObtainServiceCode("25"), TELEPHONY_SUCCESS);
931d95e75fdSopenharmony_ci        EXPECT_NE(supplement.ObtainServiceCode("99"), TELEPHONY_SUCCESS);
932d95e75fdSopenharmony_ci        EXPECT_EQ(supplement.ObtainServiceCode("100"), TELEPHONY_SUCCESS);
933d95e75fdSopenharmony_ci
934d95e75fdSopenharmony_ci        EXPECT_EQ(supplement.ObtainCause("21"), TELEPHONY_SUCCESS);
935d95e75fdSopenharmony_ci        EXPECT_NE(supplement.ObtainCause("61"), TELEPHONY_SUCCESS);
936d95e75fdSopenharmony_ci        EXPECT_NE(supplement.ObtainCause("62"), TELEPHONY_SUCCESS);
937d95e75fdSopenharmony_ci        EXPECT_NE(supplement.ObtainCause("67"), TELEPHONY_SUCCESS);
938d95e75fdSopenharmony_ci        EXPECT_EQ(supplement.ObtainCause("99"), TELEPHONY_ERROR);
939d95e75fdSopenharmony_ci    }
940d95e75fdSopenharmony_ci}
941d95e75fdSopenharmony_ci
942d95e75fdSopenharmony_ci/**
943d95e75fdSopenharmony_ci * @tc.number   cellular_call_CellularCallSupplement_0003
944d95e75fdSopenharmony_ci * @tc.name     Test for CellularCallSupplement
945d95e75fdSopenharmony_ci * @tc.desc     Function test
946d95e75fdSopenharmony_ci */
947d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_CellularCallSupplement_0003, Function | MediumTest | Level3)
948d95e75fdSopenharmony_ci{
949d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
950d95e75fdSopenharmony_ci        return;
951d95e75fdSopenharmony_ci    }
952d95e75fdSopenharmony_ci
953d95e75fdSopenharmony_ci    for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) {
954d95e75fdSopenharmony_ci        if (!HasSimCard(slotId)) {
955d95e75fdSopenharmony_ci            continue;
956d95e75fdSopenharmony_ci        }
957d95e75fdSopenharmony_ci        CellularCallSupplement supplement;
958d95e75fdSopenharmony_ci        std::string action = "*";
959d95e75fdSopenharmony_ci        std::string number = "";
960d95e75fdSopenharmony_ci        CallTransferSettingType type;
961d95e75fdSopenharmony_ci        EXPECT_EQ(supplement.ObtainCallTrasferAction(action.c_str(), number, type), TELEPHONY_SUCCESS);
962d95e75fdSopenharmony_ci        EXPECT_EQ(supplement.ObtainCallTrasferAction(action.c_str(), PHONE_NUMBER, type), TELEPHONY_SUCCESS);
963d95e75fdSopenharmony_ci        action = "#";
964d95e75fdSopenharmony_ci        EXPECT_EQ(supplement.ObtainCallTrasferAction(action.c_str(), number, type), TELEPHONY_SUCCESS);
965d95e75fdSopenharmony_ci        action = "**";
966d95e75fdSopenharmony_ci        EXPECT_EQ(supplement.ObtainCallTrasferAction(action.c_str(), number, type), TELEPHONY_SUCCESS);
967d95e75fdSopenharmony_ci        action = "##";
968d95e75fdSopenharmony_ci        EXPECT_EQ(supplement.ObtainCallTrasferAction(action.c_str(), number, type), TELEPHONY_SUCCESS);
969d95e75fdSopenharmony_ci        action = "*#";
970d95e75fdSopenharmony_ci        EXPECT_NE(supplement.ObtainCallTrasferAction(action.c_str(), number, type), TELEPHONY_SUCCESS);
971d95e75fdSopenharmony_ci    }
972d95e75fdSopenharmony_ci}
973d95e75fdSopenharmony_ci
974d95e75fdSopenharmony_ci/**
975d95e75fdSopenharmony_ci * @tc.number   cellular_call_CellularCallHandler_0001
976d95e75fdSopenharmony_ci * @tc.name     Test for CellularCallHandler
977d95e75fdSopenharmony_ci * @tc.desc     Function test
978d95e75fdSopenharmony_ci */
979d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_CellularCallHandler_0001, Function | MediumTest | Level3)
980d95e75fdSopenharmony_ci{
981d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
982d95e75fdSopenharmony_ci        return;
983d95e75fdSopenharmony_ci    }
984d95e75fdSopenharmony_ci
985d95e75fdSopenharmony_ci    EventFwk::MatchingSkills matchingSkills;
986d95e75fdSopenharmony_ci    matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED);
987d95e75fdSopenharmony_ci    EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills);
988d95e75fdSopenharmony_ci    CellularCallHandler firstHandler { subscriberInfo };
989d95e75fdSopenharmony_ci    for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) {
990d95e75fdSopenharmony_ci        if (!HasSimCard(slotId)) {
991d95e75fdSopenharmony_ci            continue;
992d95e75fdSopenharmony_ci        }
993d95e75fdSopenharmony_ci        firstHandler.SetSlotId(slotId);
994d95e75fdSopenharmony_ci        auto event = AppExecFwk::InnerEvent::Get(0);
995d95e75fdSopenharmony_ci        auto rilRadioResponse = std::make_shared<RadioResponseInfo>();
996d95e75fdSopenharmony_ci        rilRadioResponse->error = ErrType::ERR_GENERIC_FAILURE;
997d95e75fdSopenharmony_ci        firstHandler.CellularCallIncomingStartTrace(static_cast<int32_t>(TelCallState::CALL_STATUS_INCOMING));
998d95e75fdSopenharmony_ci        firstHandler.CellularCallIncomingFinishTrace(static_cast<int32_t>(TelCallState::CALL_STATUS_INCOMING));
999d95e75fdSopenharmony_ci        firstHandler.GetCsCallsDataResponse(event);
1000d95e75fdSopenharmony_ci        firstHandler.GetCsCallsDataRequest(event);
1001d95e75fdSopenharmony_ci        firstHandler.GetMMIResponse(event);
1002d95e75fdSopenharmony_ci        auto ringbackResponse = std::make_shared<RingbackVoice>();
1003d95e75fdSopenharmony_ci        ringbackResponse->status = ERROR_RESULT;
1004d95e75fdSopenharmony_ci        auto ringbackEvent = AppExecFwk::InnerEvent::Get(0, ringbackResponse);
1005d95e75fdSopenharmony_ci        firstHandler.CallRingBackVoiceResponse(event);
1006d95e75fdSopenharmony_ci        firstHandler.CallRingBackVoiceResponse(ringbackEvent);
1007d95e75fdSopenharmony_ci        auto srvccStatus = std::make_shared<SrvccStatus>();
1008d95e75fdSopenharmony_ci        srvccStatus->status = SrvccState::SRVCC_NONE;
1009d95e75fdSopenharmony_ci        auto srvccEvent1 = AppExecFwk::InnerEvent::Get(0, srvccStatus);
1010d95e75fdSopenharmony_ci        firstHandler.UpdateSrvccStateReport(event);
1011d95e75fdSopenharmony_ci        firstHandler.UpdateSrvccStateReport(srvccEvent1);
1012d95e75fdSopenharmony_ci        srvccStatus->status = SrvccState::COMPLETED;
1013d95e75fdSopenharmony_ci        auto srvccEvent2 = AppExecFwk::InnerEvent::Get(0, srvccStatus);
1014d95e75fdSopenharmony_ci        firstHandler.UpdateSrvccStateReport(srvccEvent2);
1015d95e75fdSopenharmony_ci        firstHandler.UpdateRsrvccStateReport(event);
1016d95e75fdSopenharmony_ci        firstHandler.GetCallFailReasonResponse(event);
1017d95e75fdSopenharmony_ci        firstHandler.GetEmergencyCallListResponse(event);
1018d95e75fdSopenharmony_ci        firstHandler.ReportEccChanged(event);
1019d95e75fdSopenharmony_ci        firstHandler.SetEmergencyCallListResponse(event);
1020d95e75fdSopenharmony_ci        firstHandler.SendUssdResponse(event);
1021d95e75fdSopenharmony_ci        ASSERT_EQ(firstHandler.GetSlotId(), slotId);
1022d95e75fdSopenharmony_ci    }
1023d95e75fdSopenharmony_ci}
1024d95e75fdSopenharmony_ci
1025d95e75fdSopenharmony_ci/**
1026d95e75fdSopenharmony_ci * @tc.number   cellular_call_CellularCallHandler_0002
1027d95e75fdSopenharmony_ci * @tc.name     Test for CellularCallHandler
1028d95e75fdSopenharmony_ci * @tc.desc     Function test
1029d95e75fdSopenharmony_ci */
1030d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_CellularCallHandler_0002, Function | MediumTest | Level3)
1031d95e75fdSopenharmony_ci{
1032d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1033d95e75fdSopenharmony_ci        return;
1034d95e75fdSopenharmony_ci    }
1035d95e75fdSopenharmony_ci
1036d95e75fdSopenharmony_ci    EventFwk::MatchingSkills matchingSkills;
1037d95e75fdSopenharmony_ci    matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED);
1038d95e75fdSopenharmony_ci    EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills);
1039d95e75fdSopenharmony_ci    CellularCallHandler secondHandler { subscriberInfo };
1040d95e75fdSopenharmony_ci    for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) {
1041d95e75fdSopenharmony_ci        if (!HasSimCard(slotId)) {
1042d95e75fdSopenharmony_ci            continue;
1043d95e75fdSopenharmony_ci        }
1044d95e75fdSopenharmony_ci        secondHandler.SetSlotId(slotId);
1045d95e75fdSopenharmony_ci        auto event = AppExecFwk::InnerEvent::Get(0);
1046d95e75fdSopenharmony_ci        auto rilRadioResponse = std::make_shared<RadioResponseInfo>();
1047d95e75fdSopenharmony_ci        rilRadioResponse->error = ErrType::ERR_GENERIC_FAILURE;
1048d95e75fdSopenharmony_ci        secondHandler.CommonResultResponse(event);
1049d95e75fdSopenharmony_ci        auto rejectEvent = AppExecFwk::InnerEvent::Get(RadioEvent::RADIO_REJECT_CALL, rilRadioResponse);
1050d95e75fdSopenharmony_ci        secondHandler.CommonResultResponse(rejectEvent);
1051d95e75fdSopenharmony_ci        auto supplementEvent = AppExecFwk::InnerEvent::Get(RadioEvent::RADIO_CALL_SUPPLEMENT, rilRadioResponse);
1052d95e75fdSopenharmony_ci        secondHandler.CommonResultResponse(supplementEvent);
1053d95e75fdSopenharmony_ci
1054d95e75fdSopenharmony_ci        rilRadioResponse->error = ErrType::NONE;
1055d95e75fdSopenharmony_ci        auto hangupConnectEvent = AppExecFwk::InnerEvent::Get(RadioEvent::RADIO_HANGUP_CONNECT, rilRadioResponse);
1056d95e75fdSopenharmony_ci        secondHandler.CommonResultResponse(hangupConnectEvent);
1057d95e75fdSopenharmony_ci        auto acceptEvent = AppExecFwk::InnerEvent::Get(RadioEvent::RADIO_ACCEPT_CALL, rilRadioResponse);
1058d95e75fdSopenharmony_ci        secondHandler.CommonResultResponse(acceptEvent);
1059d95e75fdSopenharmony_ci        auto splitNoErrorEvent = AppExecFwk::InnerEvent::Get(RadioEvent::RADIO_SPLIT_CALL, rilRadioResponse);
1060d95e75fdSopenharmony_ci        secondHandler.CommonResultResponse(splitNoErrorEvent);
1061d95e75fdSopenharmony_ci
1062d95e75fdSopenharmony_ci        auto ssResult = std::make_shared<SsBaseResult>();
1063d95e75fdSopenharmony_ci        ssResult->index = INVALID_INDEX;
1064d95e75fdSopenharmony_ci        ssResult->result = SUCCESS_RESULT;
1065d95e75fdSopenharmony_ci        auto errorEvent = AppExecFwk::InnerEvent::Get(0, ssResult);
1066d95e75fdSopenharmony_ci        secondHandler.SetCallRestrictionResponse(event);
1067d95e75fdSopenharmony_ci        secondHandler.SetCallRestrictionResponse(errorEvent);
1068d95e75fdSopenharmony_ci        secondHandler.SetBarringPasswordResponse(event);
1069d95e75fdSopenharmony_ci        secondHandler.SetCallTransferInfoResponse(event);
1070d95e75fdSopenharmony_ci        secondHandler.SetCallWaitingResponse(event);
1071d95e75fdSopenharmony_ci        secondHandler.SetClipResponse(event);
1072d95e75fdSopenharmony_ci        secondHandler.SetClirResponse(event);
1073d95e75fdSopenharmony_ci        secondHandler.SetColpResponse(event);
1074d95e75fdSopenharmony_ci        secondHandler.SetColrResponse(event);
1075d95e75fdSopenharmony_ci
1076d95e75fdSopenharmony_ci        auto responseEvent = AppExecFwk::InnerEvent::Get(0, rilRadioResponse);
1077d95e75fdSopenharmony_ci        secondHandler.SetMuteResponse(event);
1078d95e75fdSopenharmony_ci        secondHandler.SetMuteResponse(responseEvent);
1079d95e75fdSopenharmony_ci        secondHandler.GetMuteResponse(event);
1080d95e75fdSopenharmony_ci        secondHandler.GetMuteResponse(responseEvent);
1081d95e75fdSopenharmony_ci        ASSERT_EQ(secondHandler.GetSlotId(), slotId);
1082d95e75fdSopenharmony_ci    }
1083d95e75fdSopenharmony_ci}
1084d95e75fdSopenharmony_ci
1085d95e75fdSopenharmony_ci/**
1086d95e75fdSopenharmony_ci * @tc.number   cellular_call_CellularCallHandler_0003
1087d95e75fdSopenharmony_ci * @tc.name     Test for CellularCallHandler
1088d95e75fdSopenharmony_ci * @tc.desc     Function test
1089d95e75fdSopenharmony_ci */
1090d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_CellularCallHandler_0003, Function | MediumTest | Level3)
1091d95e75fdSopenharmony_ci{
1092d95e75fdSopenharmony_ci    if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) {
1093d95e75fdSopenharmony_ci        return;
1094d95e75fdSopenharmony_ci    }
1095d95e75fdSopenharmony_ci    EventFwk::MatchingSkills matchingSkills;
1096d95e75fdSopenharmony_ci    matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED);
1097d95e75fdSopenharmony_ci    EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills);
1098d95e75fdSopenharmony_ci    CellularCallHandler thirdhandler { subscriberInfo };
1099d95e75fdSopenharmony_ci    for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) {
1100d95e75fdSopenharmony_ci        if (!HasSimCard(slotId)) {
1101d95e75fdSopenharmony_ci            continue;
1102d95e75fdSopenharmony_ci        }
1103d95e75fdSopenharmony_ci        thirdhandler.SetSlotId(slotId);
1104d95e75fdSopenharmony_ci        auto event = AppExecFwk::InnerEvent::Get(0);
1105d95e75fdSopenharmony_ci        auto ussdNoticeResponse = std::make_shared<UssdNoticeInfo>();
1106d95e75fdSopenharmony_ci        ussdNoticeResponse->m = USSD_MODE_NOTIFY;
1107d95e75fdSopenharmony_ci        ussdNoticeResponse->str = "tdd test";
1108d95e75fdSopenharmony_ci        auto successEvent = AppExecFwk::InnerEvent::Get(0, ussdNoticeResponse);
1109d95e75fdSopenharmony_ci        thirdhandler.UssdNotifyResponse(event);
1110d95e75fdSopenharmony_ci        thirdhandler.UssdNotifyResponse(successEvent);
1111d95e75fdSopenharmony_ci        ussdNoticeResponse->str = "";
1112d95e75fdSopenharmony_ci        auto errorEvent = AppExecFwk::InnerEvent::Get(0, ussdNoticeResponse);
1113d95e75fdSopenharmony_ci        thirdhandler.UssdNotifyResponse(errorEvent);
1114d95e75fdSopenharmony_ci
1115d95e75fdSopenharmony_ci        auto ssNoticeResponse = std::make_shared<SsNoticeInfo>();
1116d95e75fdSopenharmony_ci        ssNoticeResponse->result = ERROR_RESULT;
1117d95e75fdSopenharmony_ci        auto defaultEvent = AppExecFwk::InnerEvent::Get(0, ssNoticeResponse);
1118d95e75fdSopenharmony_ci        thirdhandler.SsNotifyResponse(event);
1119d95e75fdSopenharmony_ci        thirdhandler.SsNotifyResponse(defaultEvent);
1120d95e75fdSopenharmony_ci        ssNoticeResponse->requestType = SUCCESS_RESULT;
1121d95e75fdSopenharmony_ci        auto noticeErrorEvent = AppExecFwk::InnerEvent::Get(0, ssNoticeResponse);
1122d95e75fdSopenharmony_ci        thirdhandler.SsNotifyResponse(noticeErrorEvent);
1123d95e75fdSopenharmony_ci        ssNoticeResponse->result = SUCCESS_RESULT;
1124d95e75fdSopenharmony_ci        auto noticeDefaultEvent = AppExecFwk::InnerEvent::Get(0, ssNoticeResponse);
1125d95e75fdSopenharmony_ci        thirdhandler.SsNotifyResponse(noticeDefaultEvent);
1126d95e75fdSopenharmony_ci        ssNoticeResponse->serviceType = static_cast<int32_t>(CallTransferType::TRANSFER_TYPE_UNCONDITIONAL);
1127d95e75fdSopenharmony_ci        auto noticeUnconditinalEvent = AppExecFwk::InnerEvent::Get(0, ssNoticeResponse);
1128d95e75fdSopenharmony_ci        thirdhandler.SsNotifyResponse(noticeUnconditinalEvent);
1129d95e75fdSopenharmony_ci        ssNoticeResponse->serviceType = static_cast<int32_t>(CallTransferType::TRANSFER_TYPE_BUSY);
1130d95e75fdSopenharmony_ci        auto noticeBusyEvent = AppExecFwk::InnerEvent::Get(0, ssNoticeResponse);
1131d95e75fdSopenharmony_ci        thirdhandler.SsNotifyResponse(noticeBusyEvent);
1132d95e75fdSopenharmony_ci        ssNoticeResponse->serviceType = static_cast<int32_t>(CallTransferType::TRANSFER_TYPE_NO_REPLY);
1133d95e75fdSopenharmony_ci        auto noticeNoReplyEvent = AppExecFwk::InnerEvent::Get(0, ssNoticeResponse);
1134d95e75fdSopenharmony_ci        thirdhandler.SsNotifyResponse(noticeNoReplyEvent);
1135d95e75fdSopenharmony_ci        ssNoticeResponse->serviceType = static_cast<int32_t>(CallTransferType::TRANSFER_TYPE_NOT_REACHABLE);
1136d95e75fdSopenharmony_ci        auto noticeNotReachableEvent = AppExecFwk::InnerEvent::Get(0, ssNoticeResponse);
1137d95e75fdSopenharmony_ci        thirdhandler.SsNotifyResponse(noticeNotReachableEvent);
1138d95e75fdSopenharmony_ci        ASSERT_EQ(thirdhandler.GetSlotId(), slotId);
1139d95e75fdSopenharmony_ci    }
1140d95e75fdSopenharmony_ci}
1141d95e75fdSopenharmony_ci
1142d95e75fdSopenharmony_ci/**
1143d95e75fdSopenharmony_ci * @tc.number   cellular_call_CellularCallHandler_0004
1144d95e75fdSopenharmony_ci * @tc.name     Test for CellularCallHandler
1145d95e75fdSopenharmony_ci * @tc.desc     Function test
1146d95e75fdSopenharmony_ci */
1147d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_CellularCallHandler_0004, Function | MediumTest | Level3)
1148d95e75fdSopenharmony_ci{
1149d95e75fdSopenharmony_ci    EventFwk::MatchingSkills matchingSkills;
1150d95e75fdSopenharmony_ci    matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED);
1151d95e75fdSopenharmony_ci    EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills);
1152d95e75fdSopenharmony_ci    CellularCallHandler fourthHandler { subscriberInfo };
1153d95e75fdSopenharmony_ci    auto callInfoList = std::make_shared<CallInfoList>();
1154d95e75fdSopenharmony_ci    callInfoList->callSize = 1;
1155d95e75fdSopenharmony_ci    std::string expectedPhoneNumber = "+861565910xxxx";
1156d95e75fdSopenharmony_ci    std::string unexpectedPhoneNumber = "00861565910xxxx";
1157d95e75fdSopenharmony_ci    std::vector<CallInfo> callInfoLists;
1158d95e75fdSopenharmony_ci    CallInfo callInfo;
1159d95e75fdSopenharmony_ci    callInfo.number = unexpectedPhoneNumber;
1160d95e75fdSopenharmony_ci    callInfoLists.push_back(callInfo);
1161d95e75fdSopenharmony_ci    callInfoList->calls = callInfoLists;
1162d95e75fdSopenharmony_ci    fourthHandler.ProcessCsPhoneNumber(*callInfoList);
1163d95e75fdSopenharmony_ci    EXPECT_EQ(callInfoList->calls[0].number, expectedPhoneNumber);
1164d95e75fdSopenharmony_ci    auto callInfoListFirst = std::make_shared<CallInfoList>();
1165d95e75fdSopenharmony_ci    callInfoListFirst->callSize = 0;
1166d95e75fdSopenharmony_ci    callInfoLists.clear();
1167d95e75fdSopenharmony_ci    callInfo.number = unexpectedPhoneNumber;
1168d95e75fdSopenharmony_ci    callInfoLists.push_back(callInfo);
1169d95e75fdSopenharmony_ci    callInfoListFirst->calls = callInfoLists;
1170d95e75fdSopenharmony_ci    fourthHandler.ProcessCsPhoneNumber(*callInfoListFirst);
1171d95e75fdSopenharmony_ci    EXPECT_EQ(callInfoListFirst->calls[0].number, unexpectedPhoneNumber);
1172d95e75fdSopenharmony_ci    auto callInfoListSecond = std::make_shared<CallInfoList>();
1173d95e75fdSopenharmony_ci    callInfoListSecond->callSize = 1;
1174d95e75fdSopenharmony_ci    fourthHandler.ProcessCsPhoneNumber(*callInfoListSecond);
1175d95e75fdSopenharmony_ci    EXPECT_EQ(callInfoListSecond->callSize, 1);
1176d95e75fdSopenharmony_ci    auto callInfoListThird = std::make_shared<CallInfoList>();
1177d95e75fdSopenharmony_ci    callInfoListThird->callSize = 1;
1178d95e75fdSopenharmony_ci    expectedPhoneNumber = "+861565910xxxx";
1179d95e75fdSopenharmony_ci    unexpectedPhoneNumber = "123";
1180d95e75fdSopenharmony_ci    callInfoLists.clear();
1181d95e75fdSopenharmony_ci    callInfo.number = unexpectedPhoneNumber;
1182d95e75fdSopenharmony_ci    callInfoLists.push_back(callInfo);
1183d95e75fdSopenharmony_ci    callInfoListThird->calls = callInfoLists;
1184d95e75fdSopenharmony_ci    fourthHandler.ProcessCsPhoneNumber(*callInfoListThird);
1185d95e75fdSopenharmony_ci    EXPECT_EQ(callInfoListThird->calls[0].number, unexpectedPhoneNumber);
1186d95e75fdSopenharmony_ci    callInfoLists.clear();
1187d95e75fdSopenharmony_ci    unexpectedPhoneNumber = "0861565910xxxx";
1188d95e75fdSopenharmony_ci    callInfo.number = unexpectedPhoneNumber;
1189d95e75fdSopenharmony_ci    callInfoLists.push_back(callInfo);
1190d95e75fdSopenharmony_ci    callInfoListThird->calls = callInfoLists;
1191d95e75fdSopenharmony_ci    fourthHandler.ProcessCsPhoneNumber(*callInfoListThird);
1192d95e75fdSopenharmony_ci    EXPECT_EQ(callInfoListThird->calls[0].number, unexpectedPhoneNumber);
1193d95e75fdSopenharmony_ci}
1194d95e75fdSopenharmony_ci
1195d95e75fdSopenharmony_ci /**
1196d95e75fdSopenharmony_ci * @tc.number   cellular_call_CellularCallHandler_0005
1197d95e75fdSopenharmony_ci * @tc.name     Test for CellularCallHandler
1198d95e75fdSopenharmony_ci * @tc.desc     Function test
1199d95e75fdSopenharmony_ci */
1200d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_CellularCallHandler_0005, Function | MediumTest | Level3)
1201d95e75fdSopenharmony_ci{
1202d95e75fdSopenharmony_ci    EventFwk::MatchingSkills matchingSkills;
1203d95e75fdSopenharmony_ci    matchingSkills.AddEvent(EventFwk::CommonEventSupport::COMMON_EVENT_OPERATOR_CONFIG_CHANGED);
1204d95e75fdSopenharmony_ci    EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills);
1205d95e75fdSopenharmony_ci    CellularCallHandler fifthHandler { subscriberInfo };
1206d95e75fdSopenharmony_ci    auto callInfoList = std::make_shared<CallInfoList>();
1207d95e75fdSopenharmony_ci    callInfoList->callSize = 1;
1208d95e75fdSopenharmony_ci    std::random_device rd;
1209d95e75fdSopenharmony_ci    std::mt19937 gen(rd());
1210d95e75fdSopenharmony_ci    std::uniform_int_distribution<> distrib(0, 9);
1211d95e75fdSopenharmony_ci    int randomNumber = 0;
1212d95e75fdSopenharmony_ci    int phonenumberLength = 8;
1213d95e75fdSopenharmony_ci    for (int i = 0; i < phonenumberLength; i++) {
1214d95e75fdSopenharmony_ci        randomNumber = randomNumber * 10 + distrib(gen);
1215d95e75fdSopenharmony_ci    }
1216d95e75fdSopenharmony_ci    std::string expectedPhoneNumber = "+86156" + std::to_string(randomNumber);
1217d95e75fdSopenharmony_ci    std::string unexpectedPhoneNumber = "+8686156" + std::to_string(randomNumber);
1218d95e75fdSopenharmony_ci    CallInfo callInfo;
1219d95e75fdSopenharmony_ci    callInfo.number = unexpectedPhoneNumber;
1220d95e75fdSopenharmony_ci    callInfo.type = 145;
1221d95e75fdSopenharmony_ci    callInfoList->calls.push_back(callInfo);
1222d95e75fdSopenharmony_ci    fifthHandler.ProcessRedundantCode(*callInfoList);
1223d95e75fdSopenharmony_ci    EXPECT_EQ(callInfoList->calls[0].number, expectedPhoneNumber);
1224d95e75fdSopenharmony_ci    callInfoList->callSize = 0;
1225d95e75fdSopenharmony_ci    fifthHandler.ProcessRedundantCode(*callInfoList);
1226d95e75fdSopenharmony_ci    EXPECT_EQ(callInfoList->calls[0].number, expectedPhoneNumber);
1227d95e75fdSopenharmony_ci    callInfoList->callSize = 1;
1228d95e75fdSopenharmony_ci    callInfoList->calls.clear();
1229d95e75fdSopenharmony_ci    fifthHandler.ProcessRedundantCode(*callInfoList);
1230d95e75fdSopenharmony_ci    EXPECT_EQ(callInfoList->callSize, 1);
1231d95e75fdSopenharmony_ci    callInfo.number = unexpectedPhoneNumber;
1232d95e75fdSopenharmony_ci    callInfo.type = 136;
1233d95e75fdSopenharmony_ci    callInfoList->calls.push_back(callInfo);
1234d95e75fdSopenharmony_ci    fifthHandler.ProcessRedundantCode(*callInfoList);
1235d95e75fdSopenharmony_ci    EXPECT_EQ(callInfoList->calls[0].number, unexpectedPhoneNumber);
1236d95e75fdSopenharmony_ci    unexpectedPhoneNumber = "+561565910xxxx";
1237d95e75fdSopenharmony_ci    callInfo.number = unexpectedPhoneNumber;
1238d95e75fdSopenharmony_ci    callInfo.type = 145;
1239d95e75fdSopenharmony_ci    callInfoList->calls.clear();
1240d95e75fdSopenharmony_ci    callInfoList->calls.push_back(callInfo);
1241d95e75fdSopenharmony_ci    fifthHandler.ProcessRedundantCode(*callInfoList);
1242d95e75fdSopenharmony_ci    EXPECT_EQ(callInfoList->calls[0].number, unexpectedPhoneNumber);
1243d95e75fdSopenharmony_ci    unexpectedPhoneNumber = "+861565910";
1244d95e75fdSopenharmony_ci    callInfo.number = unexpectedPhoneNumber;
1245d95e75fdSopenharmony_ci    callInfoList->calls.clear();
1246d95e75fdSopenharmony_ci    callInfoList->calls.push_back(callInfo);
1247d95e75fdSopenharmony_ci    fifthHandler.ProcessRedundantCode(*callInfoList);
1248d95e75fdSopenharmony_ci    EXPECT_EQ(callInfoList->calls[0].number, unexpectedPhoneNumber);
1249d95e75fdSopenharmony_ci}
1250d95e75fdSopenharmony_ci
1251d95e75fdSopenharmony_ci/**
1252d95e75fdSopenharmony_ci * @tc.number   cellular_call_TestDump_0001
1253d95e75fdSopenharmony_ci * @tc.name     TestDump
1254d95e75fdSopenharmony_ci * @tc.desc     Function test
1255d95e75fdSopenharmony_ci */
1256d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_TestDump_0001, Function | MediumTest | Level3)
1257d95e75fdSopenharmony_ci{
1258d95e75fdSopenharmony_ci    std::vector<std::u16string> emptyArgs = {};
1259d95e75fdSopenharmony_ci    std::vector<std::u16string> args = { u"test", u"test1" };
1260d95e75fdSopenharmony_ci    EXPECT_GE(DelayedSingleton<CellularCallService>::GetInstance()->Dump(-1, args), 0);
1261d95e75fdSopenharmony_ci    EXPECT_GE(DelayedSingleton<CellularCallService>::GetInstance()->Dump(0, emptyArgs), 0);
1262d95e75fdSopenharmony_ci    EXPECT_GE(DelayedSingleton<CellularCallService>::GetInstance()->Dump(0, args), 0);
1263d95e75fdSopenharmony_ci}
1264d95e75fdSopenharmony_ci
1265d95e75fdSopenharmony_ci/**
1266d95e75fdSopenharmony_ci * @tc.number   cellular_call_ModuleServiceUtils_0001
1267d95e75fdSopenharmony_ci * @tc.name     ModuleServiceUtils
1268d95e75fdSopenharmony_ci * @tc.desc     Function test
1269d95e75fdSopenharmony_ci */
1270d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_ModuleServiceUtils_0001, Function | MediumTest | Level3)
1271d95e75fdSopenharmony_ci{
1272d95e75fdSopenharmony_ci    ModuleServiceUtils moduleServiceUtils;
1273d95e75fdSopenharmony_ci    bool airplaneModeOn = false;
1274d95e75fdSopenharmony_ci    moduleServiceUtils.GetCsRegState(SIM1_SLOTID);
1275d95e75fdSopenharmony_ci    moduleServiceUtils.GetPsRegState(SIM1_SLOTID);
1276d95e75fdSopenharmony_ci    moduleServiceUtils.GetRadioState(SIM1_SLOTID);
1277d95e75fdSopenharmony_ci    moduleServiceUtils.GetNetworkStatus(SIM1_SLOTID);
1278d95e75fdSopenharmony_ci    moduleServiceUtils.GetIsoCountryCode(SIM1_SLOTID);
1279d95e75fdSopenharmony_ci    moduleServiceUtils.GetNetworkCountryCode(SIM1_SLOTID);
1280d95e75fdSopenharmony_ci    moduleServiceUtils.GetImsRegistrationState(SIM1_SLOTID);
1281d95e75fdSopenharmony_ci    moduleServiceUtils.GetImsUtSupportState(SIM1_SLOTID);
1282d95e75fdSopenharmony_ci    moduleServiceUtils.GetSatelliteStatus();
1283d95e75fdSopenharmony_ci    moduleServiceUtils.GetSlotInfo();
1284d95e75fdSopenharmony_ci    moduleServiceUtils.NeedCallImsService();
1285d95e75fdSopenharmony_ci    moduleServiceUtils.GetImsServiceRemoteObject();
1286d95e75fdSopenharmony_ci    EXPECT_NE(moduleServiceUtils.GetAirplaneMode(airplaneModeOn), TELEPHONY_SUCCESS);
1287d95e75fdSopenharmony_ci    EXPECT_NE(moduleServiceUtils.UpdateRadioOn(SIM1_SLOTID), TELEPHONY_SUCCESS);
1288d95e75fdSopenharmony_ci}
1289d95e75fdSopenharmony_ci
1290d95e75fdSopenharmony_ci/**
1291d95e75fdSopenharmony_ci * @tc.number   cellular_call_CellularCallConfig_0001
1292d95e75fdSopenharmony_ci * @tc.name     CellularCallConfig
1293d95e75fdSopenharmony_ci * @tc.desc     Function test
1294d95e75fdSopenharmony_ci */
1295d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_CellularCallConfig_0001, Function | MediumTest | Level3)
1296d95e75fdSopenharmony_ci{
1297d95e75fdSopenharmony_ci    CellularCallConfig CellularCallConfig;
1298d95e75fdSopenharmony_ci    bool isReadyToCall = false;
1299d95e75fdSopenharmony_ci    bool csType = 0;
1300d95e75fdSopenharmony_ci    CellularCallConfig.SetReadyToCall(SIM1_SLOTID, isReadyToCall);
1301d95e75fdSopenharmony_ci    CellularCallCallback cellularCallCallback;
1302d95e75fdSopenharmony_ci    cellularCallCallback.SetReadyToCall(SIM1_SLOTID, csType, isReadyToCall);
1303d95e75fdSopenharmony_ci    EXPECT_EQ(CellularCallConfig.IsReadyToCall(SIM1_SLOTID), TELEPHONY_SUCCESS);
1304d95e75fdSopenharmony_ci}
1305d95e75fdSopenharmony_ci} // namespace Telephony
1306d95e75fdSopenharmony_ci} // namespace OHOS
1307