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 std::string PHONE_NUMBER = "0000000"; 42d95e75fdSopenharmony_ciconst std::string PHONE_NUMBER_SECOND = "1111111"; 43d95e75fdSopenharmony_ciconst std::string PHONE_NUMBER_THIRD = "2222222"; 44d95e75fdSopenharmony_ci 45d95e75fdSopenharmony_ci/** 46d95e75fdSopenharmony_ci * @tc.number cellular_call_cs_test_001 47d95e75fdSopenharmony_ci * @tc.name Test the corresponding functions by entering commands, such as 1 -- Dial, 2 -- Hangup, 3 -- Reject, etc 48d95e75fdSopenharmony_ci * @tc.desc Function test 49d95e75fdSopenharmony_ci */ 50d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_cs_test_001, Function | MediumTest | Level0) 51d95e75fdSopenharmony_ci{ 52d95e75fdSopenharmony_ci auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); 53d95e75fdSopenharmony_ci ASSERT_TRUE(systemAbilityMgr != nullptr); 54d95e75fdSopenharmony_ci auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); 55d95e75fdSopenharmony_ci ASSERT_TRUE(remote != nullptr); 56d95e75fdSopenharmony_ci auto telephonyService = iface_cast<CellularCallInterface>(remote); 57d95e75fdSopenharmony_ci ASSERT_TRUE(telephonyService != nullptr); 58d95e75fdSopenharmony_ci std::cout << "HWTEST_F cellular_call_cs_test_001"; 59d95e75fdSopenharmony_ci} 60d95e75fdSopenharmony_ci 61d95e75fdSopenharmony_ci/** 62d95e75fdSopenharmony_ci * @tc.number cellular_call_cs_test_002 63d95e75fdSopenharmony_ci * @tc.name Test the corresponding functions by entering commands, such as 1 -- Dial, 2 -- Hangup, 3 -- Reject, etc 64d95e75fdSopenharmony_ci * @tc.desc Function test 65d95e75fdSopenharmony_ci */ 66d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_cs_test_002, Function | MediumTest | Level1) 67d95e75fdSopenharmony_ci{ 68d95e75fdSopenharmony_ci auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); 69d95e75fdSopenharmony_ci ASSERT_TRUE(systemAbilityMgr != nullptr); 70d95e75fdSopenharmony_ci auto remote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); 71d95e75fdSopenharmony_ci ASSERT_TRUE(remote != nullptr); 72d95e75fdSopenharmony_ci auto telephonyService = iface_cast<CellularCallInterface>(remote); 73d95e75fdSopenharmony_ci ASSERT_TRUE(telephonyService != nullptr); 74d95e75fdSopenharmony_ci std::cout << "HWTEST_F cellular_call_cs_test_002"; 75d95e75fdSopenharmony_ci} 76d95e75fdSopenharmony_ci 77d95e75fdSopenharmony_ci/** 78d95e75fdSopenharmony_ci * @tc.number Telephony_CallManager_SetEmergencyCallList_0101 79d95e75fdSopenharmony_ci * @tc.name SetEmergencyCallList "443,356,789",test SetEmergencyCallList(),return success 80d95e75fdSopenharmony_ci * @tc.desc Function test 81d95e75fdSopenharmony_ci */ 82d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_SetEmergencyCallList_0101, Function | MediumTest | Level3) 83d95e75fdSopenharmony_ci{ 84d95e75fdSopenharmony_ci AccessToken token; 85d95e75fdSopenharmony_ci auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); 86d95e75fdSopenharmony_ci ASSERT_TRUE(systemAbilityMgr != nullptr); 87d95e75fdSopenharmony_ci auto emergencyRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); 88d95e75fdSopenharmony_ci ASSERT_TRUE(emergencyRemote != nullptr); 89d95e75fdSopenharmony_ci auto telephonyService = iface_cast<CellularCallInterface>(emergencyRemote); 90d95e75fdSopenharmony_ci ASSERT_TRUE(telephonyService != nullptr); 91d95e75fdSopenharmony_ci 92d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 93d95e75fdSopenharmony_ci return; 94d95e75fdSopenharmony_ci } 95d95e75fdSopenharmony_ci 96d95e75fdSopenharmony_ci std::vector<EmergencyCall> eccVec; 97d95e75fdSopenharmony_ci EmergencyCall temp0 = { "499", "460", EccType::TYPE_CATEGORY, SimpresentType::TYPE_NO_CARD, 98d95e75fdSopenharmony_ci AbnormalServiceType::TYPE_ALL }; 99d95e75fdSopenharmony_ci EmergencyCall temp1 = { "443", "460", EccType::TYPE_POLICE, SimpresentType::TYPE_NO_CARD, 100d95e75fdSopenharmony_ci AbnormalServiceType::TYPE_ALL }; 101d95e75fdSopenharmony_ci EmergencyCall temp2 = { "356", "460", EccType::TYPE_AMBULANCE, SimpresentType::TYPE_NO_CARD, 102d95e75fdSopenharmony_ci AbnormalServiceType::TYPE_ALL }; 103d95e75fdSopenharmony_ci EmergencyCall temp3 = { "783", "460", EccType::TYPE_FIRE, SimpresentType::TYPE_NO_CARD, 104d95e75fdSopenharmony_ci AbnormalServiceType::TYPE_ALL }; 105d95e75fdSopenharmony_ci EmergencyCall temp4 = { "975", "460", EccType::TYPE_SEA, SimpresentType::TYPE_HAS_CARD, 106d95e75fdSopenharmony_ci AbnormalServiceType::TYPE_ONLY_CS }; 107d95e75fdSopenharmony_ci EmergencyCall temp5 = { "350", "460", EccType::TYPE_MOUNTAIN, SimpresentType::TYPE_HAS_CARD, 108d95e75fdSopenharmony_ci AbnormalServiceType::TYPE_ALL }; 109d95e75fdSopenharmony_ci eccVec.push_back(temp0); 110d95e75fdSopenharmony_ci eccVec.push_back(temp1); 111d95e75fdSopenharmony_ci eccVec.push_back(temp2); 112d95e75fdSopenharmony_ci eccVec.push_back(temp3); 113d95e75fdSopenharmony_ci eccVec.push_back(temp4); 114d95e75fdSopenharmony_ci eccVec.push_back(temp5); 115d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 116d95e75fdSopenharmony_ci EXPECT_EQ(telephonyService->SetEmergencyCallList(SIM1_SLOTID, eccVec), 0); 117d95e75fdSopenharmony_ci } 118d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 119d95e75fdSopenharmony_ci EXPECT_EQ(telephonyService->SetEmergencyCallList(SIM2_SLOTID, eccVec), 0); 120d95e75fdSopenharmony_ci } 121d95e75fdSopenharmony_ci JudgeIsEmergencyPhoneNumber(); 122d95e75fdSopenharmony_ci} 123d95e75fdSopenharmony_ci 124d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_IsOperatorConfigEmergencyCallList_0001, Function | MediumTest | Level3) 125d95e75fdSopenharmony_ci{ 126d95e75fdSopenharmony_ci AccessToken token; 127d95e75fdSopenharmony_ci auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); 128d95e75fdSopenharmony_ci ASSERT_TRUE(systemAbilityMgr != nullptr); 129d95e75fdSopenharmony_ci auto operatorRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); 130d95e75fdSopenharmony_ci ASSERT_TRUE(operatorRemote != nullptr); 131d95e75fdSopenharmony_ci auto telephonyService = iface_cast<CellularCallInterface>(operatorRemote); 132d95e75fdSopenharmony_ci ASSERT_TRUE(telephonyService != nullptr); 133d95e75fdSopenharmony_ci 134d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 135d95e75fdSopenharmony_ci return; 136d95e75fdSopenharmony_ci } 137d95e75fdSopenharmony_ci OperatorConfig opc; 138d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 139d95e75fdSopenharmony_ci DelayedRefSingleton<CoreServiceClient>::GetInstance().GetOperatorConfigs(SIM1_SLOTID, opc); 140d95e75fdSopenharmony_ci if (opc.stringArrayValue.find(KEY_EMERGENCY_CALL_STRING_ARRAY) != opc.stringArrayValue.end()) { 141d95e75fdSopenharmony_ci for (auto number : opc.stringArrayValue[KEY_EMERGENCY_CALL_STRING_ARRAY]) { 142d95e75fdSopenharmony_ci bool enabled = false; 143d95e75fdSopenharmony_ci int32_t errorCode = telephonyService->IsEmergencyPhoneNumber(SIM1_SLOTID, number, enabled); 144d95e75fdSopenharmony_ci EXPECT_EQ(TELEPHONY_SUCCESS, errorCode); 145d95e75fdSopenharmony_ci } 146d95e75fdSopenharmony_ci } 147d95e75fdSopenharmony_ci } 148d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 149d95e75fdSopenharmony_ci DelayedRefSingleton<CoreServiceClient>::GetInstance().GetOperatorConfigs(SIM2_SLOTID, opc); 150d95e75fdSopenharmony_ci if (opc.stringArrayValue.find(KEY_EMERGENCY_CALL_STRING_ARRAY) != opc.stringArrayValue.end()) { 151d95e75fdSopenharmony_ci for (auto number : opc.stringArrayValue[KEY_EMERGENCY_CALL_STRING_ARRAY]) { 152d95e75fdSopenharmony_ci bool enabled = false; 153d95e75fdSopenharmony_ci int32_t errorCode = telephonyService->IsEmergencyPhoneNumber(SIM2_SLOTID, number, enabled); 154d95e75fdSopenharmony_ci EXPECT_EQ(TELEPHONY_SUCCESS, errorCode); 155d95e75fdSopenharmony_ci } 156d95e75fdSopenharmony_ci } 157d95e75fdSopenharmony_ci } 158d95e75fdSopenharmony_ci} 159d95e75fdSopenharmony_ci 160d95e75fdSopenharmony_ci/** 161d95e75fdSopenharmony_ci * @tc.number cellular_call_DialCall_0001 162d95e75fdSopenharmony_ci * @tc.name Test for SetClip function by cs 163d95e75fdSopenharmony_ci * @tc.desc Function test 164d95e75fdSopenharmony_ci */ 165d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0001, Function | MediumTest | Level2) 166d95e75fdSopenharmony_ci{ 167d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 168d95e75fdSopenharmony_ci return; 169d95e75fdSopenharmony_ci } 170d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 171d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*30#"); 172d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 173d95e75fdSopenharmony_ci } 174d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 175d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*30#"); 176d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 177d95e75fdSopenharmony_ci } 178d95e75fdSopenharmony_ci} 179d95e75fdSopenharmony_ci 180d95e75fdSopenharmony_ci/** 181d95e75fdSopenharmony_ci * @tc.number cellular_call_DialCall_0002 182d95e75fdSopenharmony_ci * @tc.name Test for SetClip function by cs 183d95e75fdSopenharmony_ci * @tc.desc Function test 184d95e75fdSopenharmony_ci */ 185d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0002, Function | MediumTest | Level2) 186d95e75fdSopenharmony_ci{ 187d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 188d95e75fdSopenharmony_ci return; 189d95e75fdSopenharmony_ci } 190d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 191d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#30#"); 192d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 193d95e75fdSopenharmony_ci } 194d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 195d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#30#"); 196d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 197d95e75fdSopenharmony_ci } 198d95e75fdSopenharmony_ci} 199d95e75fdSopenharmony_ci 200d95e75fdSopenharmony_ci/** 201d95e75fdSopenharmony_ci * @tc.number cellular_call_DialCall_0003 202d95e75fdSopenharmony_ci * @tc.name Test for getClip function by cs 203d95e75fdSopenharmony_ci * @tc.desc Function test 204d95e75fdSopenharmony_ci */ 205d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0003, Function | MediumTest | Level2) 206d95e75fdSopenharmony_ci{ 207d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 208d95e75fdSopenharmony_ci return; 209d95e75fdSopenharmony_ci } 210d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 211d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#30#"); 212d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 213d95e75fdSopenharmony_ci } 214d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 215d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#30#"); 216d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 217d95e75fdSopenharmony_ci } 218d95e75fdSopenharmony_ci} 219d95e75fdSopenharmony_ci 220d95e75fdSopenharmony_ci/** 221d95e75fdSopenharmony_ci * @tc.number cellular_call_DialCall_0004 222d95e75fdSopenharmony_ci * @tc.name Test for SetClir function by cs 223d95e75fdSopenharmony_ci * @tc.desc Function test 224d95e75fdSopenharmony_ci */ 225d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0004, Function | MediumTest | Level2) 226d95e75fdSopenharmony_ci{ 227d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 228d95e75fdSopenharmony_ci return; 229d95e75fdSopenharmony_ci } 230d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 231d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*31#"); 232d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 233d95e75fdSopenharmony_ci } 234d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 235d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*31#"); 236d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 237d95e75fdSopenharmony_ci } 238d95e75fdSopenharmony_ci} 239d95e75fdSopenharmony_ci 240d95e75fdSopenharmony_ci/** 241d95e75fdSopenharmony_ci * @tc.number cellular_call_DialCall_0005 242d95e75fdSopenharmony_ci * @tc.name Test for SetClir function by cs 243d95e75fdSopenharmony_ci * @tc.desc Function test 244d95e75fdSopenharmony_ci */ 245d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0005, Function | MediumTest | Level2) 246d95e75fdSopenharmony_ci{ 247d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 248d95e75fdSopenharmony_ci return; 249d95e75fdSopenharmony_ci } 250d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 251d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#31#"); 252d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 253d95e75fdSopenharmony_ci } 254d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 255d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#31#"); 256d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 257d95e75fdSopenharmony_ci } 258d95e75fdSopenharmony_ci} 259d95e75fdSopenharmony_ci 260d95e75fdSopenharmony_ci/** 261d95e75fdSopenharmony_ci * @tc.number cellular_call_DialCall_0006 262d95e75fdSopenharmony_ci * @tc.name Test for GetClir function by cs 263d95e75fdSopenharmony_ci * @tc.desc Function test 264d95e75fdSopenharmony_ci */ 265d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0006, Function | MediumTest | Level2) 266d95e75fdSopenharmony_ci{ 267d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 268d95e75fdSopenharmony_ci return; 269d95e75fdSopenharmony_ci } 270d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 271d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#31#"); 272d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 273d95e75fdSopenharmony_ci } 274d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 275d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#31#"); 276d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 277d95e75fdSopenharmony_ci } 278d95e75fdSopenharmony_ci} 279d95e75fdSopenharmony_ci 280d95e75fdSopenharmony_ci/** 281d95e75fdSopenharmony_ci * @tc.number cellular_call_DialCall_0007 282d95e75fdSopenharmony_ci * @tc.name Test for SetCallTransfer function by cs 283d95e75fdSopenharmony_ci * @tc.desc Function test 284d95e75fdSopenharmony_ci */ 285d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0007, Function | MediumTest | Level2) 286d95e75fdSopenharmony_ci{ 287d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 288d95e75fdSopenharmony_ci return; 289d95e75fdSopenharmony_ci } 290d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 291d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*21#"); 292d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 293d95e75fdSopenharmony_ci } 294d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 295d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*21#"); 296d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 297d95e75fdSopenharmony_ci } 298d95e75fdSopenharmony_ci} 299d95e75fdSopenharmony_ci 300d95e75fdSopenharmony_ci/** 301d95e75fdSopenharmony_ci * @tc.number cellular_call_DialCall_0008 302d95e75fdSopenharmony_ci * @tc.name Test for SetCallTransfer function by cs 303d95e75fdSopenharmony_ci * @tc.desc Function test 304d95e75fdSopenharmony_ci */ 305d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0008, Function | MediumTest | Level2) 306d95e75fdSopenharmony_ci{ 307d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 308d95e75fdSopenharmony_ci return; 309d95e75fdSopenharmony_ci } 310d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 311d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#21#"); 312d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 313d95e75fdSopenharmony_ci } 314d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 315d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#21#"); 316d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 317d95e75fdSopenharmony_ci } 318d95e75fdSopenharmony_ci} 319d95e75fdSopenharmony_ci 320d95e75fdSopenharmony_ci/** 321d95e75fdSopenharmony_ci * @tc.number cellular_call_DialCall_0009 322d95e75fdSopenharmony_ci * @tc.name Test for GetCallTransfer function by cs 323d95e75fdSopenharmony_ci * @tc.desc Function test 324d95e75fdSopenharmony_ci */ 325d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0009, Function | MediumTest | Level2) 326d95e75fdSopenharmony_ci{ 327d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 328d95e75fdSopenharmony_ci return; 329d95e75fdSopenharmony_ci } 330d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 331d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#21#"); 332d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 333d95e75fdSopenharmony_ci } 334d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 335d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#21#"); 336d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 337d95e75fdSopenharmony_ci } 338d95e75fdSopenharmony_ci} 339d95e75fdSopenharmony_ci 340d95e75fdSopenharmony_ci/** 341d95e75fdSopenharmony_ci * @tc.number cellular_call_DialCall_0010 342d95e75fdSopenharmony_ci * @tc.name Test for SetCallRestriction function by cs 343d95e75fdSopenharmony_ci * @tc.desc Function test 344d95e75fdSopenharmony_ci */ 345d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0010, Function | MediumTest | Level2) 346d95e75fdSopenharmony_ci{ 347d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 348d95e75fdSopenharmony_ci return; 349d95e75fdSopenharmony_ci } 350d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 351d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*33#"); 352d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 353d95e75fdSopenharmony_ci } 354d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 355d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*33#"); 356d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 357d95e75fdSopenharmony_ci } 358d95e75fdSopenharmony_ci} 359d95e75fdSopenharmony_ci 360d95e75fdSopenharmony_ci/** 361d95e75fdSopenharmony_ci * @tc.number cellular_call_DialCall_0011 362d95e75fdSopenharmony_ci * @tc.name Test for SetCallRestriction function by cs 363d95e75fdSopenharmony_ci * @tc.desc Function test 364d95e75fdSopenharmony_ci */ 365d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0011, Function | MediumTest | Level2) 366d95e75fdSopenharmony_ci{ 367d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 368d95e75fdSopenharmony_ci return; 369d95e75fdSopenharmony_ci } 370d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 371d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#33#"); 372d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 373d95e75fdSopenharmony_ci } 374d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 375d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#33#"); 376d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 377d95e75fdSopenharmony_ci } 378d95e75fdSopenharmony_ci} 379d95e75fdSopenharmony_ci 380d95e75fdSopenharmony_ci/** 381d95e75fdSopenharmony_ci * @tc.number cellular_call_DialCall_0012 382d95e75fdSopenharmony_ci * @tc.name Test for GetCallRestriction function by cs 383d95e75fdSopenharmony_ci * @tc.desc Function test 384d95e75fdSopenharmony_ci */ 385d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0012, Function | MediumTest | Level2) 386d95e75fdSopenharmony_ci{ 387d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 388d95e75fdSopenharmony_ci return; 389d95e75fdSopenharmony_ci } 390d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 391d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#33#"); 392d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 393d95e75fdSopenharmony_ci } 394d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 395d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#33#"); 396d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 397d95e75fdSopenharmony_ci } 398d95e75fdSopenharmony_ci} 399d95e75fdSopenharmony_ci 400d95e75fdSopenharmony_ci/** 401d95e75fdSopenharmony_ci * @tc.number cellular_call_DialCall_0013 402d95e75fdSopenharmony_ci * @tc.name Test for SetCallWaiting function by cs 403d95e75fdSopenharmony_ci * @tc.desc Function test 404d95e75fdSopenharmony_ci */ 405d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0013, Function | MediumTest | Level2) 406d95e75fdSopenharmony_ci{ 407d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 408d95e75fdSopenharmony_ci return; 409d95e75fdSopenharmony_ci } 410d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 411d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*43#"); 412d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 413d95e75fdSopenharmony_ci } 414d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 415d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*43#"); 416d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 417d95e75fdSopenharmony_ci } 418d95e75fdSopenharmony_ci} 419d95e75fdSopenharmony_ci 420d95e75fdSopenharmony_ci/** 421d95e75fdSopenharmony_ci * @tc.number cellular_call_DialCall_0014 422d95e75fdSopenharmony_ci * @tc.name Test for SetCallWaiting function by cs 423d95e75fdSopenharmony_ci * @tc.desc Function test 424d95e75fdSopenharmony_ci */ 425d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0014, Function | MediumTest | Level2) 426d95e75fdSopenharmony_ci{ 427d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 428d95e75fdSopenharmony_ci return; 429d95e75fdSopenharmony_ci } 430d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 431d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM1_SLOTID, "#43#"); 432d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 433d95e75fdSopenharmony_ci } 434d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 435d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM2_SLOTID, "#43#"); 436d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 437d95e75fdSopenharmony_ci } 438d95e75fdSopenharmony_ci} 439d95e75fdSopenharmony_ci 440d95e75fdSopenharmony_ci/** 441d95e75fdSopenharmony_ci * @tc.number cellular_call_DialCall_0015 442d95e75fdSopenharmony_ci * @tc.name Test for GetCallWaiting function by cs 443d95e75fdSopenharmony_ci * @tc.desc Function test 444d95e75fdSopenharmony_ci */ 445d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0015, Function | MediumTest | Level2) 446d95e75fdSopenharmony_ci{ 447d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 448d95e75fdSopenharmony_ci return; 449d95e75fdSopenharmony_ci } 450d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 451d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*#43#"); 452d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 453d95e75fdSopenharmony_ci } 454d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 455d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*#43#"); 456d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 457d95e75fdSopenharmony_ci } 458d95e75fdSopenharmony_ci} 459d95e75fdSopenharmony_ci 460d95e75fdSopenharmony_ci/** 461d95e75fdSopenharmony_ci * @tc.number cellular_call_DialCall_0016 462d95e75fdSopenharmony_ci * @tc.name Test for AlterPinPassword function by cs 463d95e75fdSopenharmony_ci * @tc.desc Function test 464d95e75fdSopenharmony_ci */ 465d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0016, Function | MediumTest | Level2) 466d95e75fdSopenharmony_ci{ 467d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 468d95e75fdSopenharmony_ci return; 469d95e75fdSopenharmony_ci } 470d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 471d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*04#"); 472d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 473d95e75fdSopenharmony_ci } 474d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 475d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*04#"); 476d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 477d95e75fdSopenharmony_ci } 478d95e75fdSopenharmony_ci} 479d95e75fdSopenharmony_ci 480d95e75fdSopenharmony_ci/** 481d95e75fdSopenharmony_ci * @tc.number cellular_call_DialCall_0017 482d95e75fdSopenharmony_ci * @tc.name Test for UnlockPuk function by cs 483d95e75fdSopenharmony_ci * @tc.desc Function test 484d95e75fdSopenharmony_ci */ 485d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0017, Function | MediumTest | Level2) 486d95e75fdSopenharmony_ci{ 487d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 488d95e75fdSopenharmony_ci return; 489d95e75fdSopenharmony_ci } 490d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 491d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*05#"); 492d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 493d95e75fdSopenharmony_ci } 494d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 495d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*05#"); 496d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 497d95e75fdSopenharmony_ci } 498d95e75fdSopenharmony_ci} 499d95e75fdSopenharmony_ci 500d95e75fdSopenharmony_ci/** 501d95e75fdSopenharmony_ci * @tc.number cellular_call_DialCall_0018 502d95e75fdSopenharmony_ci * @tc.name Test for AlterPin2Password function by cs 503d95e75fdSopenharmony_ci * @tc.desc Function test 504d95e75fdSopenharmony_ci */ 505d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0018, Function | MediumTest | Level2) 506d95e75fdSopenharmony_ci{ 507d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 508d95e75fdSopenharmony_ci return; 509d95e75fdSopenharmony_ci } 510d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 511d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*042#"); 512d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 513d95e75fdSopenharmony_ci } 514d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 515d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*042#"); 516d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 517d95e75fdSopenharmony_ci } 518d95e75fdSopenharmony_ci} 519d95e75fdSopenharmony_ci 520d95e75fdSopenharmony_ci/** 521d95e75fdSopenharmony_ci * @tc.number cellular_call_DialCall_0019 522d95e75fdSopenharmony_ci * @tc.name Test for UnlockPuk2 function by cs 523d95e75fdSopenharmony_ci * @tc.desc Function test 524d95e75fdSopenharmony_ci */ 525d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0019, Function | MediumTest | Level2) 526d95e75fdSopenharmony_ci{ 527d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 528d95e75fdSopenharmony_ci return; 529d95e75fdSopenharmony_ci } 530d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 531d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM1_SLOTID, "*052#"); 532d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 533d95e75fdSopenharmony_ci } 534d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 535d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*052#"); 536d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 537d95e75fdSopenharmony_ci } 538d95e75fdSopenharmony_ci} 539d95e75fdSopenharmony_ci 540d95e75fdSopenharmony_ci/** 541d95e75fdSopenharmony_ci * @tc.number cellular_call_DialCall_0020 542d95e75fdSopenharmony_ci * @tc.name Test for SendUssd function by cs 543d95e75fdSopenharmony_ci * @tc.desc Function test 544d95e75fdSopenharmony_ci */ 545d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0020, Function | MediumTest | Level2) 546d95e75fdSopenharmony_ci{ 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 = TestDialCallByCs(SIM1_SLOTID, "*4444#"); 552d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 553d95e75fdSopenharmony_ci } 554d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 555d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(SIM2_SLOTID, "*4444#"); 556d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 557d95e75fdSopenharmony_ci } 558d95e75fdSopenharmony_ci} 559d95e75fdSopenharmony_ci 560d95e75fdSopenharmony_ci/** 561d95e75fdSopenharmony_ci * @tc.number cellular_call_DialCall_0021 562d95e75fdSopenharmony_ci * @tc.name Test for dial function with invalid slot by cs 563d95e75fdSopenharmony_ci * @tc.desc Function test 564d95e75fdSopenharmony_ci */ 565d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_DialCall_0021, Function | MediumTest | Level2) 566d95e75fdSopenharmony_ci{ 567d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 568d95e75fdSopenharmony_ci return; 569d95e75fdSopenharmony_ci } 570d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 571d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(INVALID_SLOTID, PHONE_NUMBER); 572d95e75fdSopenharmony_ci EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); 573d95e75fdSopenharmony_ci } 574d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 575d95e75fdSopenharmony_ci int32_t ret = TestDialCallByCs(INVALID_SLOTID, PHONE_NUMBER); 576d95e75fdSopenharmony_ci EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); 577d95e75fdSopenharmony_ci } 578d95e75fdSopenharmony_ci} 579d95e75fdSopenharmony_ci 580d95e75fdSopenharmony_ci/** 581d95e75fdSopenharmony_ci * @tc.number cellular_call_HangUpCall_0001 582d95e75fdSopenharmony_ci * @tc.name Test for HangUp function by cs 583d95e75fdSopenharmony_ci * @tc.desc Function test 584d95e75fdSopenharmony_ci */ 585d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_HangUpCall_0001, Function | MediumTest | Level2) 586d95e75fdSopenharmony_ci{ 587d95e75fdSopenharmony_ci AccessToken token; 588d95e75fdSopenharmony_ci auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); 589d95e75fdSopenharmony_ci ASSERT_TRUE(systemAbilityMgr != nullptr); 590d95e75fdSopenharmony_ci auto hangUpCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); 591d95e75fdSopenharmony_ci ASSERT_TRUE(hangUpCallRemote != nullptr); 592d95e75fdSopenharmony_ci auto telephonyService = iface_cast<CellularCallInterface>(hangUpCallRemote); 593d95e75fdSopenharmony_ci ASSERT_TRUE(telephonyService != nullptr); 594d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 595d95e75fdSopenharmony_ci return; 596d95e75fdSopenharmony_ci } 597d95e75fdSopenharmony_ci CellularCallInfo hangUpCallInfo; 598d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 599d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, hangUpCallInfo); 600d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 601d95e75fdSopenharmony_ci ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_DEFAULT); 602d95e75fdSopenharmony_ci EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); 603d95e75fdSopenharmony_ci ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE); 604d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 605d95e75fdSopenharmony_ci } 606d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 607d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, hangUpCallInfo); 608d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 609d95e75fdSopenharmony_ci ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_DEFAULT); 610d95e75fdSopenharmony_ci EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); 611d95e75fdSopenharmony_ci ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_HANG_UP_ACTIVE); 612d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 613d95e75fdSopenharmony_ci } 614d95e75fdSopenharmony_ci} 615d95e75fdSopenharmony_ci 616d95e75fdSopenharmony_ci/** 617d95e75fdSopenharmony_ci * @tc.number cellular_call_HangUpCall_0002 618d95e75fdSopenharmony_ci * @tc.name Test for HangUp function with invalid slot by cs 619d95e75fdSopenharmony_ci * @tc.desc Function test 620d95e75fdSopenharmony_ci */ 621d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_HangUpCall_0002, Function | MediumTest | Level2) 622d95e75fdSopenharmony_ci{ 623d95e75fdSopenharmony_ci AccessToken token; 624d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 625d95e75fdSopenharmony_ci return; 626d95e75fdSopenharmony_ci } 627d95e75fdSopenharmony_ci auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); 628d95e75fdSopenharmony_ci ASSERT_TRUE(systemAbilityMgr != nullptr); 629d95e75fdSopenharmony_ci auto hangUpCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); 630d95e75fdSopenharmony_ci ASSERT_TRUE(hangUpCallRemote != nullptr); 631d95e75fdSopenharmony_ci auto telephonyService = iface_cast<CellularCallInterface>(hangUpCallRemote); 632d95e75fdSopenharmony_ci ASSERT_TRUE(telephonyService != nullptr); 633d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 634d95e75fdSopenharmony_ci CellularCallInfo hangUpCallInfo; 635d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, hangUpCallInfo); 636d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 637d95e75fdSopenharmony_ci ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_DEFAULT); 638d95e75fdSopenharmony_ci EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); 639d95e75fdSopenharmony_ci } 640d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 641d95e75fdSopenharmony_ci CellularCallInfo hangUpCallInfo; 642d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, hangUpCallInfo); 643d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 644d95e75fdSopenharmony_ci ret = telephonyService->HangUp(hangUpCallInfo, CallSupplementType::TYPE_DEFAULT); 645d95e75fdSopenharmony_ci EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); 646d95e75fdSopenharmony_ci } 647d95e75fdSopenharmony_ci} 648d95e75fdSopenharmony_ci 649d95e75fdSopenharmony_ci/** 650d95e75fdSopenharmony_ci * @tc.number cellular_call_AnswerCall_0001 651d95e75fdSopenharmony_ci * @tc.name Test for answer function by cs 652d95e75fdSopenharmony_ci * @tc.desc Function test 653d95e75fdSopenharmony_ci */ 654d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_AnswerCall_0001, Function | MediumTest | Level2) 655d95e75fdSopenharmony_ci{ 656d95e75fdSopenharmony_ci AccessToken token; 657d95e75fdSopenharmony_ci auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); 658d95e75fdSopenharmony_ci ASSERT_TRUE(systemAbilityMgr != nullptr); 659d95e75fdSopenharmony_ci auto answerCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); 660d95e75fdSopenharmony_ci ASSERT_TRUE(answerCallRemote != nullptr); 661d95e75fdSopenharmony_ci auto telephonyService = iface_cast<CellularCallInterface>(answerCallRemote); 662d95e75fdSopenharmony_ci ASSERT_TRUE(telephonyService != nullptr); 663d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 664d95e75fdSopenharmony_ci return; 665d95e75fdSopenharmony_ci } 666d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 667d95e75fdSopenharmony_ci CellularCallInfo answerCallInfo; 668d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, answerCallInfo); 669d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 670d95e75fdSopenharmony_ci ret = telephonyService->Answer(answerCallInfo); 671d95e75fdSopenharmony_ci EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); 672d95e75fdSopenharmony_ci } 673d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 674d95e75fdSopenharmony_ci CellularCallInfo answerCallInfo; 675d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, answerCallInfo); 676d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 677d95e75fdSopenharmony_ci ret = telephonyService->Answer(answerCallInfo); 678d95e75fdSopenharmony_ci EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); 679d95e75fdSopenharmony_ci } 680d95e75fdSopenharmony_ci} 681d95e75fdSopenharmony_ci 682d95e75fdSopenharmony_ci/** 683d95e75fdSopenharmony_ci * @tc.number cellular_call_AnswerCall_0002 684d95e75fdSopenharmony_ci * @tc.name Test for answer function with invalid slot by cs 685d95e75fdSopenharmony_ci * @tc.desc Function test 686d95e75fdSopenharmony_ci */ 687d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_AnswerCall_0002, Function | MediumTest | Level2) 688d95e75fdSopenharmony_ci{ 689d95e75fdSopenharmony_ci AccessToken token; 690d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 691d95e75fdSopenharmony_ci return; 692d95e75fdSopenharmony_ci } 693d95e75fdSopenharmony_ci auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); 694d95e75fdSopenharmony_ci ASSERT_TRUE(systemAbilityMgr != nullptr); 695d95e75fdSopenharmony_ci auto answerCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); 696d95e75fdSopenharmony_ci ASSERT_TRUE(answerCallRemote != nullptr); 697d95e75fdSopenharmony_ci auto telephonyService = iface_cast<CellularCallInterface>(answerCallRemote); 698d95e75fdSopenharmony_ci ASSERT_TRUE(telephonyService != nullptr); 699d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 700d95e75fdSopenharmony_ci CellularCallInfo answerCallInfo; 701d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, answerCallInfo); 702d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 703d95e75fdSopenharmony_ci ret = telephonyService->Answer(answerCallInfo); 704d95e75fdSopenharmony_ci EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); 705d95e75fdSopenharmony_ci } 706d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 707d95e75fdSopenharmony_ci CellularCallInfo answerCallInfo; 708d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, answerCallInfo); 709d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 710d95e75fdSopenharmony_ci ret = telephonyService->Answer(answerCallInfo); 711d95e75fdSopenharmony_ci EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); 712d95e75fdSopenharmony_ci } 713d95e75fdSopenharmony_ci} 714d95e75fdSopenharmony_ci 715d95e75fdSopenharmony_ci/** 716d95e75fdSopenharmony_ci * @tc.number cellular_call_RejectCall_0001 717d95e75fdSopenharmony_ci * @tc.name Test for reject function by cs 718d95e75fdSopenharmony_ci * @tc.desc Function test 719d95e75fdSopenharmony_ci */ 720d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_RejectCall_0001, Function | MediumTest | Level2) 721d95e75fdSopenharmony_ci{ 722d95e75fdSopenharmony_ci AccessToken token; 723d95e75fdSopenharmony_ci auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); 724d95e75fdSopenharmony_ci ASSERT_TRUE(systemAbilityMgr != nullptr); 725d95e75fdSopenharmony_ci auto rejectCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); 726d95e75fdSopenharmony_ci ASSERT_TRUE(rejectCallRemote != nullptr); 727d95e75fdSopenharmony_ci auto telephonyService = iface_cast<CellularCallInterface>(rejectCallRemote); 728d95e75fdSopenharmony_ci ASSERT_TRUE(telephonyService != nullptr); 729d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 730d95e75fdSopenharmony_ci return; 731d95e75fdSopenharmony_ci } 732d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 733d95e75fdSopenharmony_ci CellularCallInfo rejectCallInfo; 734d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, rejectCallInfo); 735d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 736d95e75fdSopenharmony_ci ret = telephonyService->Reject(rejectCallInfo); 737d95e75fdSopenharmony_ci EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); 738d95e75fdSopenharmony_ci } 739d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 740d95e75fdSopenharmony_ci CellularCallInfo rejectCallInfo; 741d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, rejectCallInfo); 742d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 743d95e75fdSopenharmony_ci ret = telephonyService->Reject(rejectCallInfo); 744d95e75fdSopenharmony_ci EXPECT_EQ(ret, CALL_ERR_CALL_CONNECTION_NOT_EXIST); 745d95e75fdSopenharmony_ci } 746d95e75fdSopenharmony_ci} 747d95e75fdSopenharmony_ci 748d95e75fdSopenharmony_ci/** 749d95e75fdSopenharmony_ci * @tc.number cellular_call_RejectCall_0002 750d95e75fdSopenharmony_ci * @tc.name Test for reject function with invalid slot by cs 751d95e75fdSopenharmony_ci * @tc.desc Function test 752d95e75fdSopenharmony_ci */ 753d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_RejectCall_0002, Function | MediumTest | Level2) 754d95e75fdSopenharmony_ci{ 755d95e75fdSopenharmony_ci AccessToken token; 756d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 757d95e75fdSopenharmony_ci return; 758d95e75fdSopenharmony_ci } 759d95e75fdSopenharmony_ci auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); 760d95e75fdSopenharmony_ci ASSERT_TRUE(systemAbilityMgr != nullptr); 761d95e75fdSopenharmony_ci auto rejectCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); 762d95e75fdSopenharmony_ci ASSERT_TRUE(rejectCallRemote != nullptr); 763d95e75fdSopenharmony_ci auto telephonyService = iface_cast<CellularCallInterface>(rejectCallRemote); 764d95e75fdSopenharmony_ci ASSERT_TRUE(telephonyService != nullptr); 765d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 766d95e75fdSopenharmony_ci CellularCallInfo rejectCallInfo; 767d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, rejectCallInfo); 768d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 769d95e75fdSopenharmony_ci ret = telephonyService->Reject(rejectCallInfo); 770d95e75fdSopenharmony_ci EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); 771d95e75fdSopenharmony_ci } 772d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 773d95e75fdSopenharmony_ci CellularCallInfo rejectCallInfo; 774d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, rejectCallInfo); 775d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 776d95e75fdSopenharmony_ci ret = telephonyService->Reject(rejectCallInfo); 777d95e75fdSopenharmony_ci EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); 778d95e75fdSopenharmony_ci } 779d95e75fdSopenharmony_ci} 780d95e75fdSopenharmony_ci 781d95e75fdSopenharmony_ci/** 782d95e75fdSopenharmony_ci * @tc.number cellular_call_HoldCall_0001 783d95e75fdSopenharmony_ci * @tc.name Test for hold call function by cs 784d95e75fdSopenharmony_ci * @tc.desc Function test 785d95e75fdSopenharmony_ci */ 786d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_HoldCall_0001, Function | MediumTest | Level2) 787d95e75fdSopenharmony_ci{ 788d95e75fdSopenharmony_ci AccessToken token; 789d95e75fdSopenharmony_ci auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); 790d95e75fdSopenharmony_ci ASSERT_TRUE(systemAbilityMgr != nullptr); 791d95e75fdSopenharmony_ci auto holdCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); 792d95e75fdSopenharmony_ci ASSERT_TRUE(holdCallRemote != nullptr); 793d95e75fdSopenharmony_ci auto telephonyService = iface_cast<CellularCallInterface>(holdCallRemote); 794d95e75fdSopenharmony_ci ASSERT_TRUE(telephonyService != nullptr); 795d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 796d95e75fdSopenharmony_ci return; 797d95e75fdSopenharmony_ci } 798d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 799d95e75fdSopenharmony_ci CellularCallInfo holdCallInfo; 800d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, holdCallInfo); 801d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 802d95e75fdSopenharmony_ci ret = telephonyService->HoldCall(holdCallInfo); 803d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 804d95e75fdSopenharmony_ci } 805d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 806d95e75fdSopenharmony_ci CellularCallInfo holdCallInfo; 807d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, holdCallInfo); 808d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 809d95e75fdSopenharmony_ci ret = telephonyService->HoldCall(holdCallInfo); 810d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 811d95e75fdSopenharmony_ci } 812d95e75fdSopenharmony_ci} 813d95e75fdSopenharmony_ci 814d95e75fdSopenharmony_ci/** 815d95e75fdSopenharmony_ci * @tc.number cellular_call_HoldCall_0002 816d95e75fdSopenharmony_ci * @tc.name Test for hold function with invalid slot by cs 817d95e75fdSopenharmony_ci * @tc.desc Function test 818d95e75fdSopenharmony_ci */ 819d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_HoldCall_0002, Function | MediumTest | Level2) 820d95e75fdSopenharmony_ci{ 821d95e75fdSopenharmony_ci AccessToken token; 822d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 823d95e75fdSopenharmony_ci return; 824d95e75fdSopenharmony_ci } 825d95e75fdSopenharmony_ci auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); 826d95e75fdSopenharmony_ci ASSERT_TRUE(systemAbilityMgr != nullptr); 827d95e75fdSopenharmony_ci auto holdCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); 828d95e75fdSopenharmony_ci ASSERT_TRUE(holdCallRemote != nullptr); 829d95e75fdSopenharmony_ci auto telephonyService = iface_cast<CellularCallInterface>(holdCallRemote); 830d95e75fdSopenharmony_ci ASSERT_TRUE(telephonyService != nullptr); 831d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 832d95e75fdSopenharmony_ci CellularCallInfo holdCallInfo; 833d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, holdCallInfo); 834d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 835d95e75fdSopenharmony_ci ret = telephonyService->HoldCall(holdCallInfo); 836d95e75fdSopenharmony_ci EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); 837d95e75fdSopenharmony_ci } 838d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 839d95e75fdSopenharmony_ci CellularCallInfo holdCallInfo; 840d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, holdCallInfo); 841d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 842d95e75fdSopenharmony_ci ret = telephonyService->HoldCall(holdCallInfo); 843d95e75fdSopenharmony_ci EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); 844d95e75fdSopenharmony_ci } 845d95e75fdSopenharmony_ci} 846d95e75fdSopenharmony_ci 847d95e75fdSopenharmony_ci/** 848d95e75fdSopenharmony_ci * @tc.number cellular_call_UnHoldCall_0001 849d95e75fdSopenharmony_ci * @tc.name Test for unhold call function by cs 850d95e75fdSopenharmony_ci * @tc.desc Function test 851d95e75fdSopenharmony_ci */ 852d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_UnHoldCall_0001, Function | MediumTest | Level2) 853d95e75fdSopenharmony_ci{ 854d95e75fdSopenharmony_ci AccessToken token; 855d95e75fdSopenharmony_ci auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); 856d95e75fdSopenharmony_ci ASSERT_TRUE(systemAbilityMgr != nullptr); 857d95e75fdSopenharmony_ci auto unHoldCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); 858d95e75fdSopenharmony_ci ASSERT_TRUE(unHoldCallRemote != nullptr); 859d95e75fdSopenharmony_ci auto telephonyService = iface_cast<CellularCallInterface>(unHoldCallRemote); 860d95e75fdSopenharmony_ci ASSERT_TRUE(telephonyService != nullptr); 861d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 862d95e75fdSopenharmony_ci return; 863d95e75fdSopenharmony_ci } 864d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 865d95e75fdSopenharmony_ci CellularCallInfo unHoldCallInfo; 866d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, unHoldCallInfo); 867d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 868d95e75fdSopenharmony_ci ret = telephonyService->UnHoldCall(unHoldCallInfo); 869d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 870d95e75fdSopenharmony_ci } 871d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 872d95e75fdSopenharmony_ci CellularCallInfo unHoldCallInfo; 873d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, unHoldCallInfo); 874d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 875d95e75fdSopenharmony_ci ret = telephonyService->UnHoldCall(unHoldCallInfo); 876d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 877d95e75fdSopenharmony_ci } 878d95e75fdSopenharmony_ci} 879d95e75fdSopenharmony_ci 880d95e75fdSopenharmony_ci/** 881d95e75fdSopenharmony_ci * @tc.number cellular_call_UnHoldCall_0002 882d95e75fdSopenharmony_ci * @tc.name Test for unhold function with invalid slot by cs 883d95e75fdSopenharmony_ci * @tc.desc Function test 884d95e75fdSopenharmony_ci */ 885d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_UnHoldCall_0002, Function | MediumTest | Level2) 886d95e75fdSopenharmony_ci{ 887d95e75fdSopenharmony_ci AccessToken token; 888d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 889d95e75fdSopenharmony_ci return; 890d95e75fdSopenharmony_ci } 891d95e75fdSopenharmony_ci auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); 892d95e75fdSopenharmony_ci ASSERT_TRUE(systemAbilityMgr != nullptr); 893d95e75fdSopenharmony_ci auto unHoldCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); 894d95e75fdSopenharmony_ci ASSERT_TRUE(unHoldCallRemote != nullptr); 895d95e75fdSopenharmony_ci auto telephonyService = iface_cast<CellularCallInterface>(unHoldCallRemote); 896d95e75fdSopenharmony_ci ASSERT_TRUE(telephonyService != nullptr); 897d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 898d95e75fdSopenharmony_ci CellularCallInfo unHoldCallInfo; 899d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, unHoldCallInfo); 900d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 901d95e75fdSopenharmony_ci ret = telephonyService->UnHoldCall(unHoldCallInfo); 902d95e75fdSopenharmony_ci EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); 903d95e75fdSopenharmony_ci } 904d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 905d95e75fdSopenharmony_ci CellularCallInfo unHoldCallInfo; 906d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, unHoldCallInfo); 907d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 908d95e75fdSopenharmony_ci ret = telephonyService->UnHoldCall(unHoldCallInfo); 909d95e75fdSopenharmony_ci EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); 910d95e75fdSopenharmony_ci } 911d95e75fdSopenharmony_ci} 912d95e75fdSopenharmony_ci 913d95e75fdSopenharmony_ci/** 914d95e75fdSopenharmony_ci * @tc.number cellular_call_SwitchCall_0001 915d95e75fdSopenharmony_ci * @tc.name Test for switch call function by cs 916d95e75fdSopenharmony_ci * @tc.desc Function test 917d95e75fdSopenharmony_ci */ 918d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_SwitchCall_0001, Function | MediumTest | Level2) 919d95e75fdSopenharmony_ci{ 920d95e75fdSopenharmony_ci AccessToken token; 921d95e75fdSopenharmony_ci auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); 922d95e75fdSopenharmony_ci ASSERT_TRUE(systemAbilityMgr != nullptr); 923d95e75fdSopenharmony_ci auto switchCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); 924d95e75fdSopenharmony_ci ASSERT_TRUE(switchCallRemote != nullptr); 925d95e75fdSopenharmony_ci auto telephonyService = iface_cast<CellularCallInterface>(switchCallRemote); 926d95e75fdSopenharmony_ci ASSERT_TRUE(telephonyService != nullptr); 927d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 928d95e75fdSopenharmony_ci return; 929d95e75fdSopenharmony_ci } 930d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 931d95e75fdSopenharmony_ci CellularCallInfo switchCallInfo; 932d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(SIM1_SLOTID, PHONE_NUMBER, switchCallInfo); 933d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 934d95e75fdSopenharmony_ci ret = telephonyService->SwitchCall(switchCallInfo); 935d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 936d95e75fdSopenharmony_ci } 937d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 938d95e75fdSopenharmony_ci CellularCallInfo switchCallInfo; 939d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(SIM2_SLOTID, PHONE_NUMBER, switchCallInfo); 940d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 941d95e75fdSopenharmony_ci ret = telephonyService->SwitchCall(switchCallInfo); 942d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 943d95e75fdSopenharmony_ci } 944d95e75fdSopenharmony_ci} 945d95e75fdSopenharmony_ci 946d95e75fdSopenharmony_ci/** 947d95e75fdSopenharmony_ci * @tc.number cellular_call_SwitchCall_0002 948d95e75fdSopenharmony_ci * @tc.name Test for switch function with invalid slot by cs 949d95e75fdSopenharmony_ci * @tc.desc Function test 950d95e75fdSopenharmony_ci */ 951d95e75fdSopenharmony_ciHWTEST_F(CsTest, cellular_call_SwitchCall_0002, Function | MediumTest | Level2) 952d95e75fdSopenharmony_ci{ 953d95e75fdSopenharmony_ci AccessToken token; 954d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 955d95e75fdSopenharmony_ci return; 956d95e75fdSopenharmony_ci } 957d95e75fdSopenharmony_ci auto systemAbilityMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); 958d95e75fdSopenharmony_ci ASSERT_TRUE(systemAbilityMgr != nullptr); 959d95e75fdSopenharmony_ci auto switchCallRemote = systemAbilityMgr->CheckSystemAbility(TELEPHONY_CELLULAR_CALL_SYS_ABILITY_ID); 960d95e75fdSopenharmony_ci ASSERT_TRUE(switchCallRemote != nullptr); 961d95e75fdSopenharmony_ci auto telephonyService = iface_cast<CellularCallInterface>(switchCallRemote); 962d95e75fdSopenharmony_ci ASSERT_TRUE(telephonyService != nullptr); 963d95e75fdSopenharmony_ci if (HasSimCard(SIM1_SLOTID)) { 964d95e75fdSopenharmony_ci CellularCallInfo switchCallInfo; 965d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, switchCallInfo); 966d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 967d95e75fdSopenharmony_ci ret = telephonyService->SwitchCall(switchCallInfo); 968d95e75fdSopenharmony_ci EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); 969d95e75fdSopenharmony_ci } 970d95e75fdSopenharmony_ci if (HasSimCard(SIM2_SLOTID)) { 971d95e75fdSopenharmony_ci CellularCallInfo switchCallInfo; 972d95e75fdSopenharmony_ci int32_t ret = InitCellularCallInfo(INVALID_SLOTID, PHONE_NUMBER, switchCallInfo); 973d95e75fdSopenharmony_ci EXPECT_EQ(ret, TELEPHONY_SUCCESS); 974d95e75fdSopenharmony_ci ret = telephonyService->SwitchCall(switchCallInfo); 975d95e75fdSopenharmony_ci EXPECT_EQ(ret, CALL_ERR_INVALID_SLOT_ID); 976d95e75fdSopenharmony_ci } 977d95e75fdSopenharmony_ci} 978d95e75fdSopenharmony_ci} // namespace Telephony 979d95e75fdSopenharmony_ci} // namespace OHOS 980