1d95e75fdSopenharmony_ci/* 2d95e75fdSopenharmony_ci * Copyright (C) 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#define private public 17d95e75fdSopenharmony_ci#define protected public 18d95e75fdSopenharmony_ci#include "cellular_call_config.h" 19d95e75fdSopenharmony_ci#include "cellular_call_handler.h" 20d95e75fdSopenharmony_ci#include "cellular_call_proxy.h" 21d95e75fdSopenharmony_ci#include "cellular_call_register.h" 22d95e75fdSopenharmony_ci#include "cellular_call_service.h" 23d95e75fdSopenharmony_ci#include "tel_ril_call_parcel.h" 24d95e75fdSopenharmony_ci#include "ims_call_callback_proxy.h" 25d95e75fdSopenharmony_ci#include "ims_call_callback_stub.h" 26d95e75fdSopenharmony_ci#include "ims_call_client.h" 27d95e75fdSopenharmony_ci#include "ims_control.h" 28d95e75fdSopenharmony_ci#include "ims_error.h" 29d95e75fdSopenharmony_ci#include "ims_test.h" 30d95e75fdSopenharmony_ci#include "securec.h" 31d95e75fdSopenharmony_ci 32d95e75fdSopenharmony_cinamespace OHOS { 33d95e75fdSopenharmony_cinamespace Telephony { 34d95e75fdSopenharmony_ciusing namespace testing::ext; 35d95e75fdSopenharmony_ciconst int32_t SIM1_SLOTID = 0; 36d95e75fdSopenharmony_ciconst int32_t SIM2_SLOTID = 1; 37d95e75fdSopenharmony_ciconst int32_t SLOT_COUNT = 2; 38d95e75fdSopenharmony_ciconst std::string PHONE_NUMBER = "0000000"; 39d95e75fdSopenharmony_ciconst int32_t DEFAULT_INDEX = 1; 40d95e75fdSopenharmony_ci 41d95e75fdSopenharmony_ci/** 42d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0009 43d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 44d95e75fdSopenharmony_ci * @tc.desc Function test 45d95e75fdSopenharmony_ci */ 46d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0009, Function | MediumTest | Level3) 47d95e75fdSopenharmony_ci{ 48d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 49d95e75fdSopenharmony_ci return; 50d95e75fdSopenharmony_ci } 51d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stubTestNight = (std::make_unique<ImsCallCallbackStub>()).release(); 52d95e75fdSopenharmony_ci ASSERT_TRUE(stubTestNight != nullptr); 53d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { 54d95e75fdSopenharmony_ci if (!HasSimCard(slotId)) { 55d95e75fdSopenharmony_ci continue; 56d95e75fdSopenharmony_ci } 57d95e75fdSopenharmony_ci GetClirResult clirResult; 58d95e75fdSopenharmony_ci clirResult.result.index = INVALID_INDEX; 59d95e75fdSopenharmony_ci MessageParcel clirErrorData; 60d95e75fdSopenharmony_ci MessageParcel clirErrorReply; 61d95e75fdSopenharmony_ci ASSERT_TRUE(clirErrorData.WriteInt32(slotId)); 62d95e75fdSopenharmony_ci ASSERT_EQ( 63d95e75fdSopenharmony_ci WriteSsResult(clirErrorData, clirResult.result, clirResult.action, clirResult.clirStat), TELEPHONY_SUCCESS); 64d95e75fdSopenharmony_ci ASSERT_EQ(stubTestNight->OnGetClirResponseInner(clirErrorData, clirErrorReply), TELEPHONY_SUCCESS); 65d95e75fdSopenharmony_ci 66d95e75fdSopenharmony_ci clirResult.result.index = DEFAULT_INDEX; 67d95e75fdSopenharmony_ci MessageParcel clirData; 68d95e75fdSopenharmony_ci MessageParcel clirReply; 69d95e75fdSopenharmony_ci ASSERT_TRUE(clirData.WriteInt32(slotId)); 70d95e75fdSopenharmony_ci ASSERT_EQ( 71d95e75fdSopenharmony_ci WriteSsResult(clirData, clirResult.result, clirResult.action, clirResult.clirStat), TELEPHONY_SUCCESS); 72d95e75fdSopenharmony_ci ASSERT_EQ(stubTestNight->OnGetClirResponseInner(clirData, clirReply), TELEPHONY_SUCCESS); 73d95e75fdSopenharmony_ci clirResult.result.result = IMS_ERROR_UT_CS_FALLBACK; 74d95e75fdSopenharmony_ci ASSERT_NE(stubTestNight->GetClirResponse(slotId, clirResult), TELEPHONY_SUCCESS); 75d95e75fdSopenharmony_ci 76d95e75fdSopenharmony_ci GetColpResult colpResult; 77d95e75fdSopenharmony_ci colpResult.result.index = INVALID_INDEX; 78d95e75fdSopenharmony_ci MessageParcel colpErrorData; 79d95e75fdSopenharmony_ci MessageParcel colpErrorReply; 80d95e75fdSopenharmony_ci ASSERT_TRUE(colpErrorData.WriteInt32(slotId)); 81d95e75fdSopenharmony_ci ASSERT_EQ( 82d95e75fdSopenharmony_ci WriteSsResult(colpErrorData, colpResult.result, colpResult.action, colpResult.colpStat), TELEPHONY_SUCCESS); 83d95e75fdSopenharmony_ci ASSERT_EQ(stubTestNight->OnGetColpResponseInner(colpErrorData, colpErrorReply), TELEPHONY_SUCCESS); 84d95e75fdSopenharmony_ci 85d95e75fdSopenharmony_ci colpResult.result.index = DEFAULT_INDEX; 86d95e75fdSopenharmony_ci MessageParcel colpData; 87d95e75fdSopenharmony_ci MessageParcel colpReply; 88d95e75fdSopenharmony_ci ASSERT_TRUE(colpData.WriteInt32(slotId)); 89d95e75fdSopenharmony_ci ASSERT_EQ( 90d95e75fdSopenharmony_ci WriteSsResult(colpData, colpResult.result, colpResult.action, colpResult.colpStat), TELEPHONY_SUCCESS); 91d95e75fdSopenharmony_ci ASSERT_EQ(stubTestNight->OnGetColpResponseInner(colpData, colpReply), TELEPHONY_SUCCESS); 92d95e75fdSopenharmony_ci } 93d95e75fdSopenharmony_ci} 94d95e75fdSopenharmony_ci 95d95e75fdSopenharmony_ci/** 96d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0010 97d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 98d95e75fdSopenharmony_ci * @tc.desc Function test 99d95e75fdSopenharmony_ci */ 100d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0010, Function | MediumTest | Level3) 101d95e75fdSopenharmony_ci{ 102d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 103d95e75fdSopenharmony_ci return; 104d95e75fdSopenharmony_ci } 105d95e75fdSopenharmony_ci 106d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stubTestTen = (std::make_unique<ImsCallCallbackStub>()).release(); 107d95e75fdSopenharmony_ci ASSERT_TRUE(stubTestTen != nullptr); 108d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { 109d95e75fdSopenharmony_ci if (!HasSimCard(slotId)) { 110d95e75fdSopenharmony_ci continue; 111d95e75fdSopenharmony_ci } 112d95e75fdSopenharmony_ci GetColrResult colrResult; 113d95e75fdSopenharmony_ci colrResult.result.index = INVALID_INDEX; 114d95e75fdSopenharmony_ci MessageParcel colrErrorData; 115d95e75fdSopenharmony_ci MessageParcel colrErrorReply; 116d95e75fdSopenharmony_ci ASSERT_TRUE(colrErrorData.WriteInt32(slotId)); 117d95e75fdSopenharmony_ci ASSERT_EQ( 118d95e75fdSopenharmony_ci WriteSsResult(colrErrorData, colrResult.result, colrResult.action, colrResult.colrStat), TELEPHONY_SUCCESS); 119d95e75fdSopenharmony_ci ASSERT_EQ(stubTestTen->OnGetColrResponseInner(colrErrorData, colrErrorReply), TELEPHONY_SUCCESS); 120d95e75fdSopenharmony_ci 121d95e75fdSopenharmony_ci colrResult.result.index = DEFAULT_INDEX; 122d95e75fdSopenharmony_ci MessageParcel colrData; 123d95e75fdSopenharmony_ci MessageParcel colrReply; 124d95e75fdSopenharmony_ci ASSERT_TRUE(colrData.WriteInt32(slotId)); 125d95e75fdSopenharmony_ci ASSERT_EQ( 126d95e75fdSopenharmony_ci WriteSsResult(colrData, colrResult.result, colrResult.action, colrResult.colrStat), TELEPHONY_SUCCESS); 127d95e75fdSopenharmony_ci ASSERT_EQ(stubTestTen->OnGetColrResponseInner(colrData, colrReply), TELEPHONY_SUCCESS); 128d95e75fdSopenharmony_ci 129d95e75fdSopenharmony_ci SsBaseResult normalResult; 130d95e75fdSopenharmony_ci normalResult.index = DEFAULT_INDEX; 131d95e75fdSopenharmony_ci MessageParcel ctErrorData; 132d95e75fdSopenharmony_ci MessageParcel ctReply; 133d95e75fdSopenharmony_ci ASSERT_TRUE(ctErrorData.WriteInt32(slotId)); 134d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(ctErrorData, normalResult), TELEPHONY_SUCCESS); 135d95e75fdSopenharmony_ci ASSERT_TRUE(ctErrorData.WriteInt32(INVALID_INDEX)); 136d95e75fdSopenharmony_ci ASSERT_TRUE(ctErrorData.WriteInt32(INVALID_INDEX)); 137d95e75fdSopenharmony_ci ASSERT_TRUE(ctErrorData.WriteInt32(INVALID_INDEX)); 138d95e75fdSopenharmony_ci ASSERT_NE(stubTestTen->OnGetCallTransferResponseInner(ctErrorData, ctReply), TELEPHONY_SUCCESS); 139d95e75fdSopenharmony_ci 140d95e75fdSopenharmony_ci MessageParcel icErrorData; 141d95e75fdSopenharmony_ci MessageParcel icReply; 142d95e75fdSopenharmony_ci ASSERT_TRUE(icErrorData.WriteInt32(slotId)); 143d95e75fdSopenharmony_ci ASSERT_TRUE(icErrorData.WriteInt32(INVALID_INDEX)); 144d95e75fdSopenharmony_ci ASSERT_TRUE(icErrorData.WriteInt32(INVALID_INDEX)); 145d95e75fdSopenharmony_ci ASSERT_TRUE(icErrorData.WriteInt32(INVALID_INDEX)); 146d95e75fdSopenharmony_ci ASSERT_TRUE(icErrorData.WriteInt32(INVALID_INDEX)); 147d95e75fdSopenharmony_ci ASSERT_NE(stubTestTen->OnGetImsCallsDataResponseInner(icErrorData, icReply), TELEPHONY_SUCCESS); 148d95e75fdSopenharmony_ci } 149d95e75fdSopenharmony_ci} 150d95e75fdSopenharmony_ci 151d95e75fdSopenharmony_ci/** 152d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0011 153d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 154d95e75fdSopenharmony_ci * @tc.desc Function test 155d95e75fdSopenharmony_ci */ 156d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0011, Function | MediumTest | Level3) 157d95e75fdSopenharmony_ci{ 158d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 159d95e75fdSopenharmony_ci return; 160d95e75fdSopenharmony_ci } 161d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stubTestEleven = (std::make_unique<ImsCallCallbackStub>()).release(); 162d95e75fdSopenharmony_ci ASSERT_TRUE(stubTestEleven != nullptr); 163d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { 164d95e75fdSopenharmony_ci if (!HasSimCard(slotId)) { 165d95e75fdSopenharmony_ci continue; 166d95e75fdSopenharmony_ci } 167d95e75fdSopenharmony_ci MessageParcel callModeReceiveRequestData; 168d95e75fdSopenharmony_ci MessageParcel callModeReceiveRequestReply; 169d95e75fdSopenharmony_ci ImsCallModeReceiveInfo callModeReceiveRequesInfo; 170d95e75fdSopenharmony_ci callModeReceiveRequesInfo.callIndex = DEFAULT_INDEX; 171d95e75fdSopenharmony_ci ASSERT_TRUE(callModeReceiveRequestData.WriteInt32(slotId)); 172d95e75fdSopenharmony_ci ASSERT_TRUE(callModeReceiveRequestData.WriteRawData( 173d95e75fdSopenharmony_ci (const void *)&callModeReceiveRequesInfo, sizeof(ImsCallModeReceiveInfo))); 174d95e75fdSopenharmony_ci ASSERT_EQ(stubTestEleven->OnReceiveUpdateCallMediaModeRequestInner( 175d95e75fdSopenharmony_ci callModeReceiveRequestData, callModeReceiveRequestReply), TELEPHONY_SUCCESS); 176d95e75fdSopenharmony_ci MessageParcel callModeReceiveResponseData; 177d95e75fdSopenharmony_ci MessageParcel callModeReceiveResponseReply; 178d95e75fdSopenharmony_ci ImsCallModeReceiveInfo callModeReceiveResponseInfo; 179d95e75fdSopenharmony_ci callModeReceiveResponseInfo.callIndex = DEFAULT_INDEX; 180d95e75fdSopenharmony_ci ASSERT_TRUE(callModeReceiveResponseData.WriteInt32(slotId)); 181d95e75fdSopenharmony_ci ASSERT_TRUE(callModeReceiveResponseData.WriteRawData( 182d95e75fdSopenharmony_ci (const void *)&callModeReceiveResponseInfo, sizeof(ImsCallModeReceiveInfo))); 183d95e75fdSopenharmony_ci ASSERT_EQ(stubTestEleven->OnReceiveUpdateCallMediaModeResponseInner( 184d95e75fdSopenharmony_ci callModeReceiveResponseData, callModeReceiveResponseReply), TELEPHONY_SUCCESS); 185d95e75fdSopenharmony_ci MessageParcel callSessionEventInfoData; 186d95e75fdSopenharmony_ci MessageParcel callSessionEventInfoReply; 187d95e75fdSopenharmony_ci ImsCallSessionEventInfo callSessionEventInfo; 188d95e75fdSopenharmony_ci callSessionEventInfo.callIndex = DEFAULT_INDEX; 189d95e75fdSopenharmony_ci ASSERT_TRUE(callSessionEventInfoData.WriteInt32(slotId)); 190d95e75fdSopenharmony_ci ASSERT_TRUE(callSessionEventInfoData.WriteRawData( 191d95e75fdSopenharmony_ci (const void *)&callSessionEventInfo, sizeof(ImsCallSessionEventInfo))); 192d95e75fdSopenharmony_ci ASSERT_EQ(stubTestEleven->OnCallSessionEventChangedInner( 193d95e75fdSopenharmony_ci callSessionEventInfoData, callSessionEventInfoReply), TELEPHONY_SUCCESS); 194d95e75fdSopenharmony_ci } 195d95e75fdSopenharmony_ci} 196d95e75fdSopenharmony_ci 197d95e75fdSopenharmony_ci/** 198d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0012 199d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 200d95e75fdSopenharmony_ci * @tc.desc Function test 201d95e75fdSopenharmony_ci */ 202d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0012, Function | MediumTest | Level3) 203d95e75fdSopenharmony_ci{ 204d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 205d95e75fdSopenharmony_ci return; 206d95e75fdSopenharmony_ci } 207d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stubTestEleven = (std::make_unique<ImsCallCallbackStub>()).release(); 208d95e75fdSopenharmony_ci ASSERT_TRUE(stubTestEleven != nullptr); 209d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { 210d95e75fdSopenharmony_ci if (!HasSimCard(slotId)) { 211d95e75fdSopenharmony_ci continue; 212d95e75fdSopenharmony_ci } 213d95e75fdSopenharmony_ci MessageParcel callPeerDimensionsInfoData; 214d95e75fdSopenharmony_ci MessageParcel callPeerDimensionsInfoReply; 215d95e75fdSopenharmony_ci ImsCallPeerDimensionsInfo callPeerDimensionsInfo; 216d95e75fdSopenharmony_ci callPeerDimensionsInfo.callIndex = DEFAULT_INDEX; 217d95e75fdSopenharmony_ci ASSERT_TRUE(callPeerDimensionsInfoData.WriteInt32(slotId)); 218d95e75fdSopenharmony_ci ASSERT_TRUE(callPeerDimensionsInfoData.WriteRawData( 219d95e75fdSopenharmony_ci (const void *)&callPeerDimensionsInfo, sizeof(ImsCallPeerDimensionsInfo))); 220d95e75fdSopenharmony_ci ASSERT_EQ(stubTestEleven->OnPeerDimensionsChangedInner( 221d95e75fdSopenharmony_ci callPeerDimensionsInfoData, callPeerDimensionsInfoReply), TELEPHONY_SUCCESS); 222d95e75fdSopenharmony_ci MessageParcel callDataUsageInfoData; 223d95e75fdSopenharmony_ci MessageParcel callDataUsageInfoReply; 224d95e75fdSopenharmony_ci ImsCallDataUsageInfo callDataUsageInfo; 225d95e75fdSopenharmony_ci callDataUsageInfo.callIndex = DEFAULT_INDEX; 226d95e75fdSopenharmony_ci ASSERT_TRUE(callDataUsageInfoData.WriteInt32(slotId)); 227d95e75fdSopenharmony_ci ASSERT_TRUE(callDataUsageInfoData.WriteRawData( 228d95e75fdSopenharmony_ci (const void *)&callDataUsageInfo, sizeof(ImsCallDataUsageInfo))); 229d95e75fdSopenharmony_ci ASSERT_EQ(stubTestEleven->OnCallDataUsageChangedInner( 230d95e75fdSopenharmony_ci callDataUsageInfoData, callDataUsageInfoReply), TELEPHONY_SUCCESS); 231d95e75fdSopenharmony_ci MessageParcel cameraCapabilitiesInfoData; 232d95e75fdSopenharmony_ci MessageParcel cameraCapabilitiesInfoReply; 233d95e75fdSopenharmony_ci CameraCapabilitiesInfo cameraCapabilitiesInfo; 234d95e75fdSopenharmony_ci cameraCapabilitiesInfo.callIndex = DEFAULT_INDEX; 235d95e75fdSopenharmony_ci ASSERT_TRUE(cameraCapabilitiesInfoData.WriteInt32(slotId)); 236d95e75fdSopenharmony_ci ASSERT_TRUE(cameraCapabilitiesInfoData.WriteRawData( 237d95e75fdSopenharmony_ci (const void *)&cameraCapabilitiesInfo, sizeof(CameraCapabilitiesInfo))); 238d95e75fdSopenharmony_ci ASSERT_EQ(stubTestEleven->OnCameraCapabilitiesChangedInner( 239d95e75fdSopenharmony_ci cameraCapabilitiesInfoData, cameraCapabilitiesInfoReply), TELEPHONY_SUCCESS); 240d95e75fdSopenharmony_ci } 241d95e75fdSopenharmony_ci} 242d95e75fdSopenharmony_ci/** 243d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0013 244d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 245d95e75fdSopenharmony_ci * @tc.desc Function test 246d95e75fdSopenharmony_ci */ 247d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0013, Function | MediumTest | Level3) 248d95e75fdSopenharmony_ci{ 249d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stub = (std::make_unique<ImsCallCallbackStub>()).release(); 250d95e75fdSopenharmony_ci ASSERT_TRUE(stub != nullptr); 251d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SLOT_COUNT; slotId++) { 252d95e75fdSopenharmony_ci RadioResponseInfo rilRadioResponse; 253d95e75fdSopenharmony_ci rilRadioResponse.error = ErrType::ERR_GENERIC_FAILURE; 254d95e75fdSopenharmony_ci MessageParcel answerData; 255d95e75fdSopenharmony_ci MessageParcel answerReply; 256d95e75fdSopenharmony_ci ASSERT_TRUE(answerData.WriteInt32(slotId)); 257d95e75fdSopenharmony_ci ASSERT_TRUE(answerData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 258d95e75fdSopenharmony_ci ASSERT_EQ(stub->OnAnswerResponseInner(answerData, answerReply), TELEPHONY_SUCCESS); 259d95e75fdSopenharmony_ci 260d95e75fdSopenharmony_ci MessageParcel dialData; 261d95e75fdSopenharmony_ci MessageParcel dialReply; 262d95e75fdSopenharmony_ci ASSERT_TRUE(dialData.WriteInt32(slotId)); 263d95e75fdSopenharmony_ci ASSERT_TRUE(dialData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 264d95e75fdSopenharmony_ci ASSERT_EQ(stub->OnDialResponseInner(dialData, dialReply), TELEPHONY_SUCCESS); 265d95e75fdSopenharmony_ci 266d95e75fdSopenharmony_ci MessageParcel imsCallsData; 267d95e75fdSopenharmony_ci MessageParcel imsCallsReply; 268d95e75fdSopenharmony_ci ASSERT_TRUE(imsCallsData.WriteInt32(slotId)); 269d95e75fdSopenharmony_ci ASSERT_TRUE(imsCallsData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 270d95e75fdSopenharmony_ci ASSERT_EQ(stub->OnGetImsCallsDataResponseInner(imsCallsData, imsCallsReply), TELEPHONY_SUCCESS); 271d95e75fdSopenharmony_ci 272d95e75fdSopenharmony_ci MessageParcel hangupData; 273d95e75fdSopenharmony_ci MessageParcel hangupReply; 274d95e75fdSopenharmony_ci ASSERT_TRUE(hangupData.WriteInt32(slotId)); 275d95e75fdSopenharmony_ci ASSERT_TRUE(hangupData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 276d95e75fdSopenharmony_ci ASSERT_EQ(stub->OnHangUpResponseInner(hangupData, hangupReply), TELEPHONY_SUCCESS); 277d95e75fdSopenharmony_ci 278d95e75fdSopenharmony_ci MessageParcel holdCallData; 279d95e75fdSopenharmony_ci MessageParcel holdCallReply; 280d95e75fdSopenharmony_ci ASSERT_TRUE(holdCallData.WriteInt32(slotId)); 281d95e75fdSopenharmony_ci ASSERT_TRUE(holdCallData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 282d95e75fdSopenharmony_ci ASSERT_EQ(stub->OnHoldCallResponseInner(holdCallData, holdCallReply), TELEPHONY_SUCCESS); 283d95e75fdSopenharmony_ci 284d95e75fdSopenharmony_ci MessageParcel rejectData; 285d95e75fdSopenharmony_ci MessageParcel rejectReply; 286d95e75fdSopenharmony_ci ASSERT_TRUE(rejectData.WriteInt32(slotId)); 287d95e75fdSopenharmony_ci ASSERT_TRUE(rejectData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 288d95e75fdSopenharmony_ci ASSERT_EQ(stub->OnRejectResponseInner(rejectData, rejectReply), TELEPHONY_SUCCESS); 289d95e75fdSopenharmony_ci } 290d95e75fdSopenharmony_ci} 291d95e75fdSopenharmony_ci 292d95e75fdSopenharmony_ci/** 293d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0014 294d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 295d95e75fdSopenharmony_ci * @tc.desc Function test 296d95e75fdSopenharmony_ci */ 297d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0014, Function | MediumTest | Level3) 298d95e75fdSopenharmony_ci{ 299d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stubTestTwo = (std::make_unique<ImsCallCallbackStub>()).release(); 300d95e75fdSopenharmony_ci ASSERT_TRUE(stubTestTwo != nullptr); 301d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SLOT_COUNT; slotId++) { 302d95e75fdSopenharmony_ci RadioResponseInfo rilRadioResponse; 303d95e75fdSopenharmony_ci rilRadioResponse.error = ErrType::ERR_GENERIC_FAILURE; 304d95e75fdSopenharmony_ci MessageParcel sendDtmfData; 305d95e75fdSopenharmony_ci MessageParcel sendDtmfReply; 306d95e75fdSopenharmony_ci ASSERT_TRUE(sendDtmfData.WriteInt32(slotId)); 307d95e75fdSopenharmony_ci ASSERT_TRUE(sendDtmfData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 308d95e75fdSopenharmony_ci ASSERT_GE(stubTestTwo->OnSendDtmfResponseInner(sendDtmfData, sendDtmfReply), TELEPHONY_SUCCESS); 309d95e75fdSopenharmony_ci 310d95e75fdSopenharmony_ci MessageParcel setImsSwitchData; 311d95e75fdSopenharmony_ci MessageParcel setImsSwitchReply; 312d95e75fdSopenharmony_ci ASSERT_TRUE(setImsSwitchData.WriteInt32(slotId)); 313d95e75fdSopenharmony_ci ASSERT_TRUE(setImsSwitchData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 314d95e75fdSopenharmony_ci ASSERT_EQ(stubTestTwo->OnSetImsSwitchResponseInner(setImsSwitchData, setImsSwitchReply), TELEPHONY_SUCCESS); 315d95e75fdSopenharmony_ci 316d95e75fdSopenharmony_ci MessageParcel startDtmfData; 317d95e75fdSopenharmony_ci MessageParcel startDtmfReply; 318d95e75fdSopenharmony_ci ASSERT_TRUE(startDtmfData.WriteInt32(slotId)); 319d95e75fdSopenharmony_ci ASSERT_TRUE(startDtmfData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 320d95e75fdSopenharmony_ci ASSERT_EQ(stubTestTwo->OnStartDtmfResponseInner(startDtmfData, startDtmfReply), TELEPHONY_SUCCESS); 321d95e75fdSopenharmony_ci 322d95e75fdSopenharmony_ci MessageParcel stopDtmfData; 323d95e75fdSopenharmony_ci MessageParcel stopDtmfReply; 324d95e75fdSopenharmony_ci ASSERT_TRUE(stopDtmfData.WriteInt32(slotId)); 325d95e75fdSopenharmony_ci ASSERT_TRUE(stopDtmfData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 326d95e75fdSopenharmony_ci ASSERT_EQ(stubTestTwo->OnStopDtmfResponseInner(stopDtmfData, stopDtmfReply), TELEPHONY_SUCCESS); 327d95e75fdSopenharmony_ci 328d95e75fdSopenharmony_ci MessageParcel switchCallData; 329d95e75fdSopenharmony_ci MessageParcel switchCallReply; 330d95e75fdSopenharmony_ci ASSERT_TRUE(switchCallData.WriteInt32(slotId)); 331d95e75fdSopenharmony_ci ASSERT_TRUE(switchCallData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 332d95e75fdSopenharmony_ci ASSERT_EQ(stubTestTwo->OnSwitchCallResponseInner(switchCallData, switchCallReply), TELEPHONY_SUCCESS); 333d95e75fdSopenharmony_ci 334d95e75fdSopenharmony_ci MessageParcel unholdData; 335d95e75fdSopenharmony_ci MessageParcel unholdReply; 336d95e75fdSopenharmony_ci ASSERT_TRUE(unholdData.WriteInt32(slotId)); 337d95e75fdSopenharmony_ci ASSERT_TRUE(unholdData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 338d95e75fdSopenharmony_ci ASSERT_EQ(stubTestTwo->OnUnHoldCallResponseInner(unholdData, unholdReply), TELEPHONY_SUCCESS); 339d95e75fdSopenharmony_ci 340d95e75fdSopenharmony_ci MessageParcel getImsSwitchData; 341d95e75fdSopenharmony_ci MessageParcel getImsSwitchReply; 342d95e75fdSopenharmony_ci ASSERT_TRUE(getImsSwitchData.WriteInt32(slotId)); 343d95e75fdSopenharmony_ci ASSERT_TRUE(getImsSwitchData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 344d95e75fdSopenharmony_ci ASSERT_EQ(stubTestTwo->OnGetImsSwitchResponseInner(getImsSwitchData, getImsSwitchReply), TELEPHONY_SUCCESS); 345d95e75fdSopenharmony_ci } 346d95e75fdSopenharmony_ci} 347d95e75fdSopenharmony_ci 348d95e75fdSopenharmony_ci/** 349d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0015 350d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 351d95e75fdSopenharmony_ci * @tc.desc Function test 352d95e75fdSopenharmony_ci */ 353d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0015, Function | MediumTest | Level3) 354d95e75fdSopenharmony_ci{ 355d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stubTestThree = (std::make_unique<ImsCallCallbackStub>()).release(); 356d95e75fdSopenharmony_ci ASSERT_TRUE(stubTestThree != nullptr); 357d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SLOT_COUNT; slotId++) { 358d95e75fdSopenharmony_ci MessageParcel data; 359d95e75fdSopenharmony_ci MessageParcel reply; 360d95e75fdSopenharmony_ci ASSERT_TRUE(data.WriteInt32(slotId)); 361d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnAnswerResponseInner(data, reply), TELEPHONY_SUCCESS); 362d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnCallRingBackReportInner(data, reply), TELEPHONY_SUCCESS); 363d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnDialResponseInner(data, reply), TELEPHONY_SUCCESS); 364d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnHangUpResponseInner(data, reply), TELEPHONY_SUCCESS); 365d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnHoldCallResponseInner(data, reply), TELEPHONY_SUCCESS); 366d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnRejectResponseInner(data, reply), TELEPHONY_SUCCESS); 367d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnSendDtmfResponseInner(data, reply), TELEPHONY_SUCCESS); 368d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnSetImsSwitchResponseInner(data, reply), TELEPHONY_SUCCESS); 369d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnStartDtmfResponseInner(data, reply), TELEPHONY_SUCCESS); 370d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnStopDtmfResponseInner(data, reply), TELEPHONY_SUCCESS); 371d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnSwitchCallResponseInner(data, reply), TELEPHONY_SUCCESS); 372d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnUnHoldCallResponseInner(data, reply), TELEPHONY_SUCCESS); 373d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnSetMuteResponseInner(data, reply), TELEPHONY_SUCCESS); 374d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnCombineConferenceResponseInner(data, reply), TELEPHONY_SUCCESS); 375d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnInviteToConferenceResponseInner(data, reply), TELEPHONY_SUCCESS); 376d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnReceiveUpdateCallMediaModeRequestInner(data, reply), TELEPHONY_SUCCESS); 377d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnReceiveUpdateCallMediaModeResponseInner(data, reply), TELEPHONY_SUCCESS); 378d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnCallSessionEventChangedInner(data, reply), TELEPHONY_SUCCESS); 379d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnPeerDimensionsChangedInner(data, reply), TELEPHONY_SUCCESS); 380d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnCallDataUsageChangedInner(data, reply), TELEPHONY_SUCCESS); 381d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnCameraCapabilitiesChangedInner(data, reply), TELEPHONY_SUCCESS); 382d95e75fdSopenharmony_ci } 383d95e75fdSopenharmony_ci} 384d95e75fdSopenharmony_ci 385d95e75fdSopenharmony_ci/** 386d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0016 387d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 388d95e75fdSopenharmony_ci * @tc.desc Function test 389d95e75fdSopenharmony_ci */ 390d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0016, Function | MediumTest | Level3) 391d95e75fdSopenharmony_ci{ 392d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stubTestFour = (std::make_unique<ImsCallCallbackStub>()).release(); 393d95e75fdSopenharmony_ci ASSERT_TRUE(stubTestFour != nullptr); 394d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SLOT_COUNT; slotId++) { 395d95e75fdSopenharmony_ci SsBaseResult normalResult; 396d95e75fdSopenharmony_ci normalResult.index = DEFAULT_INDEX; 397d95e75fdSopenharmony_ci MessageParcel crData; 398d95e75fdSopenharmony_ci MessageParcel crReply; 399d95e75fdSopenharmony_ci ASSERT_TRUE(crData.WriteInt32(slotId)); 400d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(crData, normalResult), TELEPHONY_SUCCESS); 401d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFour->OnSetCallRestrictionResponseInner(crData, crReply), TELEPHONY_SUCCESS); 402d95e75fdSopenharmony_ci MessageParcel ctData; 403d95e75fdSopenharmony_ci MessageParcel ctReply; 404d95e75fdSopenharmony_ci ASSERT_TRUE(ctData.WriteInt32(slotId)); 405d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(ctData, normalResult), TELEPHONY_SUCCESS); 406d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFour->OnSetCallTransferResponseInner(ctData, ctReply), TELEPHONY_SUCCESS); 407d95e75fdSopenharmony_ci MessageParcel cwData; 408d95e75fdSopenharmony_ci MessageParcel cwReply; 409d95e75fdSopenharmony_ci ASSERT_TRUE(cwData.WriteInt32(slotId)); 410d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(cwData, normalResult), TELEPHONY_SUCCESS); 411d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFour->OnSetCallWaitingResponseInner(cwData, cwReply), TELEPHONY_SUCCESS); 412d95e75fdSopenharmony_ci MessageParcel clipData; 413d95e75fdSopenharmony_ci MessageParcel clipReply; 414d95e75fdSopenharmony_ci ASSERT_TRUE(clipData.WriteInt32(slotId)); 415d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(clipData, normalResult), TELEPHONY_SUCCESS); 416d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFour->OnSetClipResponseInner(clipData, clipReply), TELEPHONY_SUCCESS); 417d95e75fdSopenharmony_ci MessageParcel clirData; 418d95e75fdSopenharmony_ci MessageParcel clirReply; 419d95e75fdSopenharmony_ci ASSERT_TRUE(clirData.WriteInt32(slotId)); 420d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(clirData, normalResult), TELEPHONY_SUCCESS); 421d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFour->OnSetClirResponseInner(clirData, clirReply), TELEPHONY_SUCCESS); 422d95e75fdSopenharmony_ci MessageParcel colpData; 423d95e75fdSopenharmony_ci MessageParcel colpReply; 424d95e75fdSopenharmony_ci ASSERT_TRUE(colpData.WriteInt32(slotId)); 425d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(colpData, normalResult), TELEPHONY_SUCCESS); 426d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFour->OnSetColpResponseInner(colpData, colpReply), TELEPHONY_SUCCESS); 427d95e75fdSopenharmony_ci MessageParcel colrData; 428d95e75fdSopenharmony_ci MessageParcel colrReply; 429d95e75fdSopenharmony_ci ASSERT_TRUE(colrData.WriteInt32(slotId)); 430d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(colrData, normalResult), TELEPHONY_SUCCESS); 431d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFour->OnSetColrResponseInner(colrData, colrReply), TELEPHONY_SUCCESS); 432d95e75fdSopenharmony_ci } 433d95e75fdSopenharmony_ci} 434d95e75fdSopenharmony_ci 435d95e75fdSopenharmony_ci/** 436d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0017 437d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 438d95e75fdSopenharmony_ci * @tc.desc Function test 439d95e75fdSopenharmony_ci */ 440d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0017, Function | MediumTest | Level3) 441d95e75fdSopenharmony_ci{ 442d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stubTestFive = (std::make_unique<ImsCallCallbackStub>()).release(); 443d95e75fdSopenharmony_ci ASSERT_TRUE(stubTestFive != nullptr); 444d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SLOT_COUNT; slotId++) { 445d95e75fdSopenharmony_ci SsBaseResult normalResult; 446d95e75fdSopenharmony_ci normalResult.index = INVALID_INDEX; 447d95e75fdSopenharmony_ci MessageParcel crData; 448d95e75fdSopenharmony_ci MessageParcel crReply; 449d95e75fdSopenharmony_ci ASSERT_TRUE(crData.WriteInt32(slotId)); 450d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(crData, normalResult), TELEPHONY_SUCCESS); 451d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFive->OnSetCallRestrictionResponseInner(crData, crReply), TELEPHONY_SUCCESS); 452d95e75fdSopenharmony_ci MessageParcel ctData; 453d95e75fdSopenharmony_ci MessageParcel ctReply; 454d95e75fdSopenharmony_ci ASSERT_TRUE(ctData.WriteInt32(slotId)); 455d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(ctData, normalResult), TELEPHONY_SUCCESS); 456d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFive->OnSetCallTransferResponseInner(ctData, ctReply), TELEPHONY_SUCCESS); 457d95e75fdSopenharmony_ci MessageParcel cwData; 458d95e75fdSopenharmony_ci MessageParcel cwReply; 459d95e75fdSopenharmony_ci ASSERT_TRUE(cwData.WriteInt32(slotId)); 460d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(cwData, normalResult), TELEPHONY_SUCCESS); 461d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFive->OnSetCallWaitingResponseInner(cwData, cwReply), TELEPHONY_SUCCESS); 462d95e75fdSopenharmony_ci MessageParcel clipData; 463d95e75fdSopenharmony_ci MessageParcel clipReply; 464d95e75fdSopenharmony_ci ASSERT_TRUE(clipData.WriteInt32(slotId)); 465d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(clipData, normalResult), TELEPHONY_SUCCESS); 466d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFive->OnSetClipResponseInner(clipData, clipReply), TELEPHONY_SUCCESS); 467d95e75fdSopenharmony_ci MessageParcel clirData; 468d95e75fdSopenharmony_ci MessageParcel clirReply; 469d95e75fdSopenharmony_ci ASSERT_TRUE(clirData.WriteInt32(slotId)); 470d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(clirData, normalResult), TELEPHONY_SUCCESS); 471d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFive->OnSetClirResponseInner(clirData, clirReply), TELEPHONY_SUCCESS); 472d95e75fdSopenharmony_ci MessageParcel colpData; 473d95e75fdSopenharmony_ci MessageParcel colpReply; 474d95e75fdSopenharmony_ci ASSERT_TRUE(colpData.WriteInt32(slotId)); 475d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(colpData, normalResult), TELEPHONY_SUCCESS); 476d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFive->OnSetColpResponseInner(colpData, colpReply), TELEPHONY_SUCCESS); 477d95e75fdSopenharmony_ci MessageParcel colrData; 478d95e75fdSopenharmony_ci MessageParcel colrReply; 479d95e75fdSopenharmony_ci ASSERT_TRUE(colrData.WriteInt32(slotId)); 480d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(colrData, normalResult), TELEPHONY_SUCCESS); 481d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFive->OnSetColrResponseInner(colrData, colrReply), TELEPHONY_SUCCESS); 482d95e75fdSopenharmony_ci } 483d95e75fdSopenharmony_ci} 484d95e75fdSopenharmony_ci 485d95e75fdSopenharmony_ci/** 486d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0018 487d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 488d95e75fdSopenharmony_ci * @tc.desc Function test 489d95e75fdSopenharmony_ci */ 490d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0018, Function | MediumTest | Level3) 491d95e75fdSopenharmony_ci{ 492d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stubTestSix = (std::make_unique<ImsCallCallbackStub>()).release(); 493d95e75fdSopenharmony_ci ASSERT_TRUE(stubTestSix != nullptr); 494d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SLOT_COUNT; slotId++) { 495d95e75fdSopenharmony_ci SsBaseResult ssBaseResult; 496d95e75fdSopenharmony_ci ssBaseResult.index = DEFAULT_INDEX; 497d95e75fdSopenharmony_ci ssBaseResult.result = IMS_ERROR_UT_CS_FALLBACK; 498d95e75fdSopenharmony_ci ASSERT_NE(stubTestSix->SetCallRestrictionResponse(slotId, ssBaseResult), TELEPHONY_SUCCESS); 499d95e75fdSopenharmony_ci ASSERT_NE(stubTestSix->SetCallTransferResponse(slotId, ssBaseResult), TELEPHONY_SUCCESS); 500d95e75fdSopenharmony_ci ASSERT_NE(stubTestSix->SetCallWaitingResponse(slotId, ssBaseResult), TELEPHONY_SUCCESS); 501d95e75fdSopenharmony_ci ASSERT_NE(stubTestSix->SetClirResponse(slotId, ssBaseResult), TELEPHONY_SUCCESS); 502d95e75fdSopenharmony_ci MessageParcel muteData; 503d95e75fdSopenharmony_ci MessageParcel muteReply; 504d95e75fdSopenharmony_ci MuteControlResponse muteResponse; 505d95e75fdSopenharmony_ci ASSERT_TRUE(muteData.WriteInt32(slotId)); 506d95e75fdSopenharmony_ci ASSERT_TRUE(muteData.WriteRawData((const void *)&muteResponse, sizeof(MuteControlResponse))); 507d95e75fdSopenharmony_ci ASSERT_EQ(stubTestSix->OnSetMuteResponseInner(muteData, muteReply), TELEPHONY_SUCCESS); 508d95e75fdSopenharmony_ci MessageParcel ringData; 509d95e75fdSopenharmony_ci MessageParcel ringReply; 510d95e75fdSopenharmony_ci RingbackVoice ringback; 511d95e75fdSopenharmony_ci ASSERT_TRUE(ringData.WriteInt32(slotId)); 512d95e75fdSopenharmony_ci ASSERT_TRUE(ringData.WriteRawData((const void *)&ringback, sizeof(RingbackVoice))); 513d95e75fdSopenharmony_ci ASSERT_EQ(stubTestSix->OnCallRingBackReportInner(ringData, ringReply), TELEPHONY_SUCCESS); 514d95e75fdSopenharmony_ci MessageParcel failData; 515d95e75fdSopenharmony_ci MessageParcel failReply; 516d95e75fdSopenharmony_ci DisconnectedDetails details; 517d95e75fdSopenharmony_ci ASSERT_TRUE(failData.WriteInt32(slotId)); 518d95e75fdSopenharmony_ci ASSERT_TRUE(failData.WriteInt32(static_cast<int32_t>(details.reason))); 519d95e75fdSopenharmony_ci ASSERT_TRUE(failData.WriteString(details.message)); 520d95e75fdSopenharmony_ci ASSERT_EQ(stubTestSix->OnLastCallFailReasonResponseInner(failData, failReply), TELEPHONY_SUCCESS); 521d95e75fdSopenharmony_ci } 522d95e75fdSopenharmony_ci} 523d95e75fdSopenharmony_ci 524d95e75fdSopenharmony_ci/** 525d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0019 526d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 527d95e75fdSopenharmony_ci * @tc.desc Function test 528d95e75fdSopenharmony_ci */ 529d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0019, Function | MediumTest | Level3) 530d95e75fdSopenharmony_ci{ 531d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stubTestSeven = (std::make_unique<ImsCallCallbackStub>()).release(); 532d95e75fdSopenharmony_ci ASSERT_TRUE(stubTestSeven != nullptr); 533d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SLOT_COUNT; slotId++) { 534d95e75fdSopenharmony_ci CallRestrictionResult crResult; 535d95e75fdSopenharmony_ci crResult.result.index = INVALID_INDEX; 536d95e75fdSopenharmony_ci MessageParcel crErrorData; 537d95e75fdSopenharmony_ci MessageParcel crErrorReply; 538d95e75fdSopenharmony_ci ASSERT_TRUE(crErrorData.WriteInt32(slotId)); 539d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsResult(crErrorData, crResult.result, crResult.status, crResult.classCw), TELEPHONY_SUCCESS); 540d95e75fdSopenharmony_ci ASSERT_EQ(stubTestSeven->OnGetCallRestrictionResponseInner(crErrorData, crErrorReply), TELEPHONY_SUCCESS); 541d95e75fdSopenharmony_ci 542d95e75fdSopenharmony_ci crResult.result.index = DEFAULT_INDEX; 543d95e75fdSopenharmony_ci MessageParcel crData; 544d95e75fdSopenharmony_ci MessageParcel crReply; 545d95e75fdSopenharmony_ci ASSERT_TRUE(crData.WriteInt32(slotId)); 546d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsResult(crData, crResult.result, crResult.status, crResult.classCw), TELEPHONY_SUCCESS); 547d95e75fdSopenharmony_ci ASSERT_EQ(stubTestSeven->OnGetCallRestrictionResponseInner(crData, crReply), TELEPHONY_SUCCESS); 548d95e75fdSopenharmony_ci crResult.result.result = IMS_ERROR_UT_CS_FALLBACK; 549d95e75fdSopenharmony_ci ASSERT_NE(stubTestSeven->GetCallRestrictionResponse(slotId, crResult), TELEPHONY_SUCCESS); 550d95e75fdSopenharmony_ci 551d95e75fdSopenharmony_ci CallForwardQueryInfoList callList; 552d95e75fdSopenharmony_ci callList.result.index = INVALID_INDEX; 553d95e75fdSopenharmony_ci MessageParcel ctErrorData; 554d95e75fdSopenharmony_ci MessageParcel ctErrorReply; 555d95e75fdSopenharmony_ci ASSERT_TRUE(ctErrorData.WriteInt32(slotId)); 556d95e75fdSopenharmony_ci ASSERT_EQ(WriteCallForwardResult(ctErrorData, callList), TELEPHONY_SUCCESS); 557d95e75fdSopenharmony_ci ASSERT_EQ(stubTestSeven->OnGetCallTransferResponseInner(ctErrorData, ctErrorReply), TELEPHONY_SUCCESS); 558d95e75fdSopenharmony_ci 559d95e75fdSopenharmony_ci callList.result.index = DEFAULT_INDEX; 560d95e75fdSopenharmony_ci MessageParcel ctData; 561d95e75fdSopenharmony_ci MessageParcel ctReply; 562d95e75fdSopenharmony_ci ASSERT_TRUE(ctData.WriteInt32(slotId)); 563d95e75fdSopenharmony_ci ASSERT_EQ(WriteCallForwardResult(ctData, callList), TELEPHONY_SUCCESS); 564d95e75fdSopenharmony_ci ASSERT_EQ(stubTestSeven->OnGetCallTransferResponseInner(ctData, ctReply), TELEPHONY_SUCCESS); 565d95e75fdSopenharmony_ci callList.result.result = IMS_ERROR_UT_CS_FALLBACK; 566d95e75fdSopenharmony_ci ASSERT_NE(stubTestSeven->GetCallTransferResponse(slotId, callList), TELEPHONY_SUCCESS); 567d95e75fdSopenharmony_ci } 568d95e75fdSopenharmony_ci} 569d95e75fdSopenharmony_ci 570d95e75fdSopenharmony_ci/** 571d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0020 572d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 573d95e75fdSopenharmony_ci * @tc.desc Function test 574d95e75fdSopenharmony_ci */ 575d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0020, Function | MediumTest | Level3) 576d95e75fdSopenharmony_ci{ 577d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stubTestEigth = (std::make_unique<ImsCallCallbackStub>()).release(); 578d95e75fdSopenharmony_ci ASSERT_TRUE(stubTestEigth != nullptr); 579d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SLOT_COUNT; slotId++) { 580d95e75fdSopenharmony_ci CallWaitResult cwResult; 581d95e75fdSopenharmony_ci cwResult.result.index = INVALID_INDEX; 582d95e75fdSopenharmony_ci MessageParcel cwErrorData; 583d95e75fdSopenharmony_ci MessageParcel cwErrorReply; 584d95e75fdSopenharmony_ci ASSERT_TRUE(cwErrorData.WriteInt32(slotId)); 585d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsResult(cwErrorData, cwResult.result, cwResult.status, cwResult.classCw), TELEPHONY_SUCCESS); 586d95e75fdSopenharmony_ci ASSERT_EQ(stubTestEigth->OnGetCallWaitingResponseInner(cwErrorData, cwErrorReply), TELEPHONY_SUCCESS); 587d95e75fdSopenharmony_ci 588d95e75fdSopenharmony_ci cwResult.result.index = DEFAULT_INDEX; 589d95e75fdSopenharmony_ci MessageParcel cwData; 590d95e75fdSopenharmony_ci MessageParcel cwReply; 591d95e75fdSopenharmony_ci ASSERT_TRUE(cwData.WriteInt32(slotId)); 592d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsResult(cwData, cwResult.result, cwResult.status, cwResult.classCw), TELEPHONY_SUCCESS); 593d95e75fdSopenharmony_ci ASSERT_EQ(stubTestEigth->OnGetCallWaitingResponseInner(cwData, cwReply), TELEPHONY_SUCCESS); 594d95e75fdSopenharmony_ci cwResult.result.result = IMS_ERROR_UT_CS_FALLBACK; 595d95e75fdSopenharmony_ci ASSERT_NE(stubTestEigth->GetCallWaitingResponse(slotId, cwResult), TELEPHONY_SUCCESS); 596d95e75fdSopenharmony_ci 597d95e75fdSopenharmony_ci GetClipResult clipResult; 598d95e75fdSopenharmony_ci clipResult.result.index = INVALID_INDEX; 599d95e75fdSopenharmony_ci MessageParcel clipErrorData; 600d95e75fdSopenharmony_ci MessageParcel clipErrorReply; 601d95e75fdSopenharmony_ci ASSERT_TRUE(clipErrorData.WriteInt32(slotId)); 602d95e75fdSopenharmony_ci ASSERT_EQ( 603d95e75fdSopenharmony_ci WriteSsResult(clipErrorData, clipResult.result, clipResult.action, clipResult.clipStat), TELEPHONY_SUCCESS); 604d95e75fdSopenharmony_ci ASSERT_EQ(stubTestEigth->OnGetClipResponseInner(clipErrorData, clipErrorReply), TELEPHONY_SUCCESS); 605d95e75fdSopenharmony_ci 606d95e75fdSopenharmony_ci clipResult.result.index = DEFAULT_INDEX; 607d95e75fdSopenharmony_ci MessageParcel clipData; 608d95e75fdSopenharmony_ci MessageParcel clipReply; 609d95e75fdSopenharmony_ci ASSERT_TRUE(clipData.WriteInt32(slotId)); 610d95e75fdSopenharmony_ci ASSERT_EQ( 611d95e75fdSopenharmony_ci WriteSsResult(clipData, clipResult.result, clipResult.action, clipResult.clipStat), TELEPHONY_SUCCESS); 612d95e75fdSopenharmony_ci ASSERT_EQ(stubTestEigth->OnGetClipResponseInner(clipData, clipReply), TELEPHONY_SUCCESS); 613d95e75fdSopenharmony_ci clipResult.result.result = IMS_ERROR_UT_CS_FALLBACK; 614d95e75fdSopenharmony_ci ASSERT_NE(stubTestEigth->GetClipResponse(slotId, clipResult), TELEPHONY_SUCCESS); 615d95e75fdSopenharmony_ci } 616d95e75fdSopenharmony_ci} 617d95e75fdSopenharmony_ci 618d95e75fdSopenharmony_ci/** 619d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0021 620d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 621d95e75fdSopenharmony_ci * @tc.desc Function test 622d95e75fdSopenharmony_ci */ 623d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0021, Function | MediumTest | Level3) 624d95e75fdSopenharmony_ci{ 625d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stubTestNight = (std::make_unique<ImsCallCallbackStub>()).release(); 626d95e75fdSopenharmony_ci ASSERT_TRUE(stubTestNight != nullptr); 627d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SLOT_COUNT; slotId++) { 628d95e75fdSopenharmony_ci GetClirResult clirResult; 629d95e75fdSopenharmony_ci clirResult.result.index = INVALID_INDEX; 630d95e75fdSopenharmony_ci MessageParcel clirErrorData; 631d95e75fdSopenharmony_ci MessageParcel clirErrorReply; 632d95e75fdSopenharmony_ci ASSERT_TRUE(clirErrorData.WriteInt32(slotId)); 633d95e75fdSopenharmony_ci ASSERT_EQ( 634d95e75fdSopenharmony_ci WriteSsResult(clirErrorData, clirResult.result, clirResult.action, clirResult.clirStat), TELEPHONY_SUCCESS); 635d95e75fdSopenharmony_ci ASSERT_EQ(stubTestNight->OnGetClirResponseInner(clirErrorData, clirErrorReply), TELEPHONY_SUCCESS); 636d95e75fdSopenharmony_ci 637d95e75fdSopenharmony_ci clirResult.result.index = DEFAULT_INDEX; 638d95e75fdSopenharmony_ci MessageParcel clirData; 639d95e75fdSopenharmony_ci MessageParcel clirReply; 640d95e75fdSopenharmony_ci ASSERT_TRUE(clirData.WriteInt32(slotId)); 641d95e75fdSopenharmony_ci ASSERT_EQ( 642d95e75fdSopenharmony_ci WriteSsResult(clirData, clirResult.result, clirResult.action, clirResult.clirStat), TELEPHONY_SUCCESS); 643d95e75fdSopenharmony_ci ASSERT_EQ(stubTestNight->OnGetClirResponseInner(clirData, clirReply), TELEPHONY_SUCCESS); 644d95e75fdSopenharmony_ci clirResult.result.result = IMS_ERROR_UT_CS_FALLBACK; 645d95e75fdSopenharmony_ci ASSERT_NE(stubTestNight->GetClirResponse(slotId, clirResult), TELEPHONY_SUCCESS); 646d95e75fdSopenharmony_ci 647d95e75fdSopenharmony_ci GetColpResult colpResult; 648d95e75fdSopenharmony_ci colpResult.result.index = INVALID_INDEX; 649d95e75fdSopenharmony_ci MessageParcel colpErrorData; 650d95e75fdSopenharmony_ci MessageParcel colpErrorReply; 651d95e75fdSopenharmony_ci ASSERT_TRUE(colpErrorData.WriteInt32(slotId)); 652d95e75fdSopenharmony_ci ASSERT_EQ( 653d95e75fdSopenharmony_ci WriteSsResult(colpErrorData, colpResult.result, colpResult.action, colpResult.colpStat), TELEPHONY_SUCCESS); 654d95e75fdSopenharmony_ci ASSERT_EQ(stubTestNight->OnGetColpResponseInner(colpErrorData, colpErrorReply), TELEPHONY_SUCCESS); 655d95e75fdSopenharmony_ci 656d95e75fdSopenharmony_ci colpResult.result.index = DEFAULT_INDEX; 657d95e75fdSopenharmony_ci MessageParcel colpData; 658d95e75fdSopenharmony_ci MessageParcel colpReply; 659d95e75fdSopenharmony_ci ASSERT_TRUE(colpData.WriteInt32(slotId)); 660d95e75fdSopenharmony_ci ASSERT_EQ( 661d95e75fdSopenharmony_ci WriteSsResult(colpData, colpResult.result, colpResult.action, colpResult.colpStat), TELEPHONY_SUCCESS); 662d95e75fdSopenharmony_ci ASSERT_EQ(stubTestNight->OnGetColpResponseInner(colpData, colpReply), TELEPHONY_SUCCESS); 663d95e75fdSopenharmony_ci } 664d95e75fdSopenharmony_ci} 665d95e75fdSopenharmony_ci 666d95e75fdSopenharmony_ci/** 667d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0022 668d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 669d95e75fdSopenharmony_ci * @tc.desc Function test 670d95e75fdSopenharmony_ci */ 671d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0022, Function | MediumTest | Level3) 672d95e75fdSopenharmony_ci{ 673d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stubTestTen = (std::make_unique<ImsCallCallbackStub>()).release(); 674d95e75fdSopenharmony_ci ASSERT_TRUE(stubTestTen != nullptr); 675d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SLOT_COUNT; slotId++) { 676d95e75fdSopenharmony_ci GetColrResult colrResult; 677d95e75fdSopenharmony_ci colrResult.result.index = INVALID_INDEX; 678d95e75fdSopenharmony_ci MessageParcel colrErrorData; 679d95e75fdSopenharmony_ci MessageParcel colrErrorReply; 680d95e75fdSopenharmony_ci ASSERT_TRUE(colrErrorData.WriteInt32(slotId)); 681d95e75fdSopenharmony_ci ASSERT_EQ( 682d95e75fdSopenharmony_ci WriteSsResult(colrErrorData, colrResult.result, colrResult.action, colrResult.colrStat), TELEPHONY_SUCCESS); 683d95e75fdSopenharmony_ci ASSERT_EQ(stubTestTen->OnGetColrResponseInner(colrErrorData, colrErrorReply), TELEPHONY_SUCCESS); 684d95e75fdSopenharmony_ci 685d95e75fdSopenharmony_ci colrResult.result.index = DEFAULT_INDEX; 686d95e75fdSopenharmony_ci MessageParcel colrData; 687d95e75fdSopenharmony_ci MessageParcel colrReply; 688d95e75fdSopenharmony_ci ASSERT_TRUE(colrData.WriteInt32(slotId)); 689d95e75fdSopenharmony_ci ASSERT_EQ( 690d95e75fdSopenharmony_ci WriteSsResult(colrData, colrResult.result, colrResult.action, colrResult.colrStat), TELEPHONY_SUCCESS); 691d95e75fdSopenharmony_ci ASSERT_EQ(stubTestTen->OnGetColrResponseInner(colrData, colrReply), TELEPHONY_SUCCESS); 692d95e75fdSopenharmony_ci 693d95e75fdSopenharmony_ci SsBaseResult normalResult; 694d95e75fdSopenharmony_ci normalResult.index = DEFAULT_INDEX; 695d95e75fdSopenharmony_ci MessageParcel ctErrorData; 696d95e75fdSopenharmony_ci MessageParcel ctReply; 697d95e75fdSopenharmony_ci ASSERT_TRUE(ctErrorData.WriteInt32(slotId)); 698d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(ctErrorData, normalResult), TELEPHONY_SUCCESS); 699d95e75fdSopenharmony_ci ASSERT_TRUE(ctErrorData.WriteInt32(INVALID_INDEX)); 700d95e75fdSopenharmony_ci ASSERT_TRUE(ctErrorData.WriteInt32(INVALID_INDEX)); 701d95e75fdSopenharmony_ci ASSERT_TRUE(ctErrorData.WriteInt32(INVALID_INDEX)); 702d95e75fdSopenharmony_ci ASSERT_NE(stubTestTen->OnGetCallTransferResponseInner(ctErrorData, ctReply), TELEPHONY_SUCCESS); 703d95e75fdSopenharmony_ci 704d95e75fdSopenharmony_ci MessageParcel icErrorData; 705d95e75fdSopenharmony_ci MessageParcel icReply; 706d95e75fdSopenharmony_ci ASSERT_TRUE(icErrorData.WriteInt32(slotId)); 707d95e75fdSopenharmony_ci ASSERT_TRUE(icErrorData.WriteInt32(INVALID_INDEX)); 708d95e75fdSopenharmony_ci ASSERT_TRUE(icErrorData.WriteInt32(INVALID_INDEX)); 709d95e75fdSopenharmony_ci ASSERT_TRUE(icErrorData.WriteInt32(INVALID_INDEX)); 710d95e75fdSopenharmony_ci ASSERT_TRUE(icErrorData.WriteInt32(INVALID_INDEX)); 711d95e75fdSopenharmony_ci ASSERT_NE(stubTestTen->OnGetImsCallsDataResponseInner(icErrorData, icReply), TELEPHONY_SUCCESS); 712d95e75fdSopenharmony_ci } 713d95e75fdSopenharmony_ci} 714d95e75fdSopenharmony_ci 715d95e75fdSopenharmony_ci/** 716d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0023 717d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 718d95e75fdSopenharmony_ci * @tc.desc Function test 719d95e75fdSopenharmony_ci */ 720d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0023, Function | MediumTest | Level3) 721d95e75fdSopenharmony_ci{ 722d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stubTestEleven = (std::make_unique<ImsCallCallbackStub>()).release(); 723d95e75fdSopenharmony_ci ASSERT_TRUE(stubTestEleven != nullptr); 724d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SLOT_COUNT; slotId++) { 725d95e75fdSopenharmony_ci MessageParcel callModeReceiveRequestData; 726d95e75fdSopenharmony_ci MessageParcel callModeReceiveRequestReply; 727d95e75fdSopenharmony_ci ImsCallModeReceiveInfo callModeReceiveRequesInfo; 728d95e75fdSopenharmony_ci callModeReceiveRequesInfo.callIndex = DEFAULT_INDEX; 729d95e75fdSopenharmony_ci ASSERT_TRUE(callModeReceiveRequestData.WriteInt32(slotId)); 730d95e75fdSopenharmony_ci ASSERT_TRUE(callModeReceiveRequestData.WriteRawData( 731d95e75fdSopenharmony_ci (const void *)&callModeReceiveRequesInfo, sizeof(ImsCallModeReceiveInfo))); 732d95e75fdSopenharmony_ci ASSERT_EQ(stubTestEleven->OnReceiveUpdateCallMediaModeRequestInner( 733d95e75fdSopenharmony_ci callModeReceiveRequestData, callModeReceiveRequestReply), TELEPHONY_SUCCESS); 734d95e75fdSopenharmony_ci MessageParcel callModeReceiveResponseData; 735d95e75fdSopenharmony_ci MessageParcel callModeReceiveResponseReply; 736d95e75fdSopenharmony_ci ImsCallModeReceiveInfo callModeReceiveResponseInfo; 737d95e75fdSopenharmony_ci callModeReceiveResponseInfo.callIndex = DEFAULT_INDEX; 738d95e75fdSopenharmony_ci ASSERT_TRUE(callModeReceiveResponseData.WriteInt32(slotId)); 739d95e75fdSopenharmony_ci ASSERT_TRUE(callModeReceiveResponseData.WriteRawData( 740d95e75fdSopenharmony_ci (const void *)&callModeReceiveResponseInfo, sizeof(ImsCallModeReceiveInfo))); 741d95e75fdSopenharmony_ci ASSERT_EQ(stubTestEleven->OnReceiveUpdateCallMediaModeResponseInner( 742d95e75fdSopenharmony_ci callModeReceiveResponseData, callModeReceiveResponseReply), TELEPHONY_SUCCESS); 743d95e75fdSopenharmony_ci MessageParcel callSessionEventInfoData; 744d95e75fdSopenharmony_ci MessageParcel callSessionEventInfoReply; 745d95e75fdSopenharmony_ci ImsCallSessionEventInfo callSessionEventInfo; 746d95e75fdSopenharmony_ci callSessionEventInfo.callIndex = DEFAULT_INDEX; 747d95e75fdSopenharmony_ci ASSERT_TRUE(callSessionEventInfoData.WriteInt32(slotId)); 748d95e75fdSopenharmony_ci ASSERT_TRUE(callSessionEventInfoData.WriteRawData( 749d95e75fdSopenharmony_ci (const void *)&callSessionEventInfo, sizeof(ImsCallSessionEventInfo))); 750d95e75fdSopenharmony_ci ASSERT_EQ(stubTestEleven->OnCallSessionEventChangedInner( 751d95e75fdSopenharmony_ci callSessionEventInfoData, callSessionEventInfoReply), TELEPHONY_SUCCESS); 752d95e75fdSopenharmony_ci } 753d95e75fdSopenharmony_ci} 754d95e75fdSopenharmony_ci 755d95e75fdSopenharmony_ci/** 756d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0024 757d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 758d95e75fdSopenharmony_ci * @tc.desc Function test 759d95e75fdSopenharmony_ci */ 760d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0024, Function | MediumTest | Level3) 761d95e75fdSopenharmony_ci{ 762d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stubTestEleven = (std::make_unique<ImsCallCallbackStub>()).release(); 763d95e75fdSopenharmony_ci ASSERT_TRUE(stubTestEleven != nullptr); 764d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SLOT_COUNT; slotId++) { 765d95e75fdSopenharmony_ci MessageParcel callPeerDimensionsInfoData; 766d95e75fdSopenharmony_ci MessageParcel callPeerDimensionsInfoReply; 767d95e75fdSopenharmony_ci ImsCallPeerDimensionsInfo callPeerDimensionsInfo; 768d95e75fdSopenharmony_ci callPeerDimensionsInfo.callIndex = DEFAULT_INDEX; 769d95e75fdSopenharmony_ci ASSERT_TRUE(callPeerDimensionsInfoData.WriteInt32(slotId)); 770d95e75fdSopenharmony_ci ASSERT_TRUE(callPeerDimensionsInfoData.WriteRawData( 771d95e75fdSopenharmony_ci (const void *)&callPeerDimensionsInfo, sizeof(ImsCallPeerDimensionsInfo))); 772d95e75fdSopenharmony_ci ASSERT_EQ(stubTestEleven->OnPeerDimensionsChangedInner( 773d95e75fdSopenharmony_ci callPeerDimensionsInfoData, callPeerDimensionsInfoReply), TELEPHONY_SUCCESS); 774d95e75fdSopenharmony_ci MessageParcel callDataUsageInfoData; 775d95e75fdSopenharmony_ci MessageParcel callDataUsageInfoReply; 776d95e75fdSopenharmony_ci ImsCallDataUsageInfo callDataUsageInfo; 777d95e75fdSopenharmony_ci callDataUsageInfo.callIndex = DEFAULT_INDEX; 778d95e75fdSopenharmony_ci ASSERT_TRUE(callDataUsageInfoData.WriteInt32(slotId)); 779d95e75fdSopenharmony_ci ASSERT_TRUE(callDataUsageInfoData.WriteRawData( 780d95e75fdSopenharmony_ci (const void *)&callDataUsageInfo, sizeof(ImsCallDataUsageInfo))); 781d95e75fdSopenharmony_ci ASSERT_EQ(stubTestEleven->OnCallDataUsageChangedInner( 782d95e75fdSopenharmony_ci callDataUsageInfoData, callDataUsageInfoReply), TELEPHONY_SUCCESS); 783d95e75fdSopenharmony_ci MessageParcel cameraCapabilitiesInfoData; 784d95e75fdSopenharmony_ci MessageParcel cameraCapabilitiesInfoReply; 785d95e75fdSopenharmony_ci CameraCapabilitiesInfo cameraCapabilitiesInfo; 786d95e75fdSopenharmony_ci cameraCapabilitiesInfo.callIndex = DEFAULT_INDEX; 787d95e75fdSopenharmony_ci ASSERT_TRUE(cameraCapabilitiesInfoData.WriteInt32(slotId)); 788d95e75fdSopenharmony_ci ASSERT_TRUE(cameraCapabilitiesInfoData.WriteRawData( 789d95e75fdSopenharmony_ci (const void *)&cameraCapabilitiesInfo, sizeof(CameraCapabilitiesInfo))); 790d95e75fdSopenharmony_ci ASSERT_EQ(stubTestEleven->OnCameraCapabilitiesChangedInner( 791d95e75fdSopenharmony_ci cameraCapabilitiesInfoData, cameraCapabilitiesInfoReply), TELEPHONY_SUCCESS); 792d95e75fdSopenharmony_ci } 793d95e75fdSopenharmony_ci} 794d95e75fdSopenharmony_ci 795d95e75fdSopenharmony_ci/** 796d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0001 797d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 798d95e75fdSopenharmony_ci * @tc.desc Function test 799d95e75fdSopenharmony_ci */ 800d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0001, Function | MediumTest | Level3) 801d95e75fdSopenharmony_ci{ 802d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stub = (std::make_unique<ImsCallCallbackStub>()).release(); 803d95e75fdSopenharmony_ci ASSERT_TRUE(stub != nullptr); 804d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 805d95e75fdSopenharmony_ci return; 806d95e75fdSopenharmony_ci } 807d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { 808d95e75fdSopenharmony_ci if (!HasSimCard(slotId)) { 809d95e75fdSopenharmony_ci continue; 810d95e75fdSopenharmony_ci } 811d95e75fdSopenharmony_ci RadioResponseInfo rilRadioResponse; 812d95e75fdSopenharmony_ci rilRadioResponse.error = ErrType::ERR_GENERIC_FAILURE; 813d95e75fdSopenharmony_ci MessageParcel answerData; 814d95e75fdSopenharmony_ci MessageParcel answerReply; 815d95e75fdSopenharmony_ci ASSERT_TRUE(answerData.WriteInt32(slotId)); 816d95e75fdSopenharmony_ci ASSERT_TRUE(answerData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 817d95e75fdSopenharmony_ci ASSERT_EQ(stub->OnAnswerResponseInner(answerData, answerReply), TELEPHONY_SUCCESS); 818d95e75fdSopenharmony_ci 819d95e75fdSopenharmony_ci MessageParcel dialData; 820d95e75fdSopenharmony_ci MessageParcel dialReply; 821d95e75fdSopenharmony_ci ASSERT_TRUE(dialData.WriteInt32(slotId)); 822d95e75fdSopenharmony_ci ASSERT_TRUE(dialData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 823d95e75fdSopenharmony_ci ASSERT_EQ(stub->OnDialResponseInner(dialData, dialReply), TELEPHONY_SUCCESS); 824d95e75fdSopenharmony_ci 825d95e75fdSopenharmony_ci MessageParcel imsCallsData; 826d95e75fdSopenharmony_ci MessageParcel imsCallsReply; 827d95e75fdSopenharmony_ci ASSERT_TRUE(imsCallsData.WriteInt32(slotId)); 828d95e75fdSopenharmony_ci ASSERT_TRUE(imsCallsData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 829d95e75fdSopenharmony_ci ASSERT_EQ(stub->OnGetImsCallsDataResponseInner(imsCallsData, imsCallsReply), TELEPHONY_SUCCESS); 830d95e75fdSopenharmony_ci 831d95e75fdSopenharmony_ci MessageParcel hangupData; 832d95e75fdSopenharmony_ci MessageParcel hangupReply; 833d95e75fdSopenharmony_ci ASSERT_TRUE(hangupData.WriteInt32(slotId)); 834d95e75fdSopenharmony_ci ASSERT_TRUE(hangupData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 835d95e75fdSopenharmony_ci ASSERT_EQ(stub->OnHangUpResponseInner(hangupData, hangupReply), TELEPHONY_SUCCESS); 836d95e75fdSopenharmony_ci 837d95e75fdSopenharmony_ci MessageParcel holdCallData; 838d95e75fdSopenharmony_ci MessageParcel holdCallReply; 839d95e75fdSopenharmony_ci ASSERT_TRUE(holdCallData.WriteInt32(slotId)); 840d95e75fdSopenharmony_ci ASSERT_TRUE(holdCallData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 841d95e75fdSopenharmony_ci ASSERT_EQ(stub->OnHoldCallResponseInner(holdCallData, holdCallReply), TELEPHONY_SUCCESS); 842d95e75fdSopenharmony_ci 843d95e75fdSopenharmony_ci MessageParcel rejectData; 844d95e75fdSopenharmony_ci MessageParcel rejectReply; 845d95e75fdSopenharmony_ci ASSERT_TRUE(rejectData.WriteInt32(slotId)); 846d95e75fdSopenharmony_ci ASSERT_TRUE(rejectData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 847d95e75fdSopenharmony_ci ASSERT_EQ(stub->OnRejectResponseInner(rejectData, rejectReply), TELEPHONY_SUCCESS); 848d95e75fdSopenharmony_ci } 849d95e75fdSopenharmony_ci} 850d95e75fdSopenharmony_ci 851d95e75fdSopenharmony_ci/** 852d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0002 853d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 854d95e75fdSopenharmony_ci * @tc.desc Function test 855d95e75fdSopenharmony_ci */ 856d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0002, Function | MediumTest | Level3) 857d95e75fdSopenharmony_ci{ 858d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 859d95e75fdSopenharmony_ci return; 860d95e75fdSopenharmony_ci } 861d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stubTestTwo = (std::make_unique<ImsCallCallbackStub>()).release(); 862d95e75fdSopenharmony_ci ASSERT_TRUE(stubTestTwo != nullptr); 863d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { 864d95e75fdSopenharmony_ci if (!HasSimCard(slotId)) { 865d95e75fdSopenharmony_ci continue; 866d95e75fdSopenharmony_ci } 867d95e75fdSopenharmony_ci RadioResponseInfo rilRadioResponse; 868d95e75fdSopenharmony_ci rilRadioResponse.error = ErrType::ERR_GENERIC_FAILURE; 869d95e75fdSopenharmony_ci MessageParcel sendDtmfData; 870d95e75fdSopenharmony_ci MessageParcel sendDtmfReply; 871d95e75fdSopenharmony_ci ASSERT_TRUE(sendDtmfData.WriteInt32(slotId)); 872d95e75fdSopenharmony_ci ASSERT_TRUE(sendDtmfData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 873d95e75fdSopenharmony_ci ASSERT_GE(stubTestTwo->OnSendDtmfResponseInner(sendDtmfData, sendDtmfReply), TELEPHONY_SUCCESS); 874d95e75fdSopenharmony_ci 875d95e75fdSopenharmony_ci MessageParcel setImsSwitchData; 876d95e75fdSopenharmony_ci MessageParcel setImsSwitchReply; 877d95e75fdSopenharmony_ci ASSERT_TRUE(setImsSwitchData.WriteInt32(slotId)); 878d95e75fdSopenharmony_ci ASSERT_TRUE(setImsSwitchData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 879d95e75fdSopenharmony_ci ASSERT_EQ(stubTestTwo->OnSetImsSwitchResponseInner(setImsSwitchData, setImsSwitchReply), TELEPHONY_SUCCESS); 880d95e75fdSopenharmony_ci 881d95e75fdSopenharmony_ci MessageParcel startDtmfData; 882d95e75fdSopenharmony_ci MessageParcel startDtmfReply; 883d95e75fdSopenharmony_ci ASSERT_TRUE(startDtmfData.WriteInt32(slotId)); 884d95e75fdSopenharmony_ci ASSERT_TRUE(startDtmfData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 885d95e75fdSopenharmony_ci ASSERT_EQ(stubTestTwo->OnStartDtmfResponseInner(startDtmfData, startDtmfReply), TELEPHONY_SUCCESS); 886d95e75fdSopenharmony_ci 887d95e75fdSopenharmony_ci MessageParcel stopDtmfData; 888d95e75fdSopenharmony_ci MessageParcel stopDtmfReply; 889d95e75fdSopenharmony_ci ASSERT_TRUE(stopDtmfData.WriteInt32(slotId)); 890d95e75fdSopenharmony_ci ASSERT_TRUE(stopDtmfData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 891d95e75fdSopenharmony_ci ASSERT_EQ(stubTestTwo->OnStopDtmfResponseInner(stopDtmfData, stopDtmfReply), TELEPHONY_SUCCESS); 892d95e75fdSopenharmony_ci 893d95e75fdSopenharmony_ci MessageParcel switchCallData; 894d95e75fdSopenharmony_ci MessageParcel switchCallReply; 895d95e75fdSopenharmony_ci ASSERT_TRUE(switchCallData.WriteInt32(slotId)); 896d95e75fdSopenharmony_ci ASSERT_TRUE(switchCallData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 897d95e75fdSopenharmony_ci ASSERT_EQ(stubTestTwo->OnSwitchCallResponseInner(switchCallData, switchCallReply), TELEPHONY_SUCCESS); 898d95e75fdSopenharmony_ci 899d95e75fdSopenharmony_ci MessageParcel unholdData; 900d95e75fdSopenharmony_ci MessageParcel unholdReply; 901d95e75fdSopenharmony_ci ASSERT_TRUE(unholdData.WriteInt32(slotId)); 902d95e75fdSopenharmony_ci ASSERT_TRUE(unholdData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 903d95e75fdSopenharmony_ci ASSERT_EQ(stubTestTwo->OnUnHoldCallResponseInner(unholdData, unholdReply), TELEPHONY_SUCCESS); 904d95e75fdSopenharmony_ci 905d95e75fdSopenharmony_ci MessageParcel getImsSwitchData; 906d95e75fdSopenharmony_ci MessageParcel getImsSwitchReply; 907d95e75fdSopenharmony_ci ASSERT_TRUE(getImsSwitchData.WriteInt32(slotId)); 908d95e75fdSopenharmony_ci ASSERT_TRUE(getImsSwitchData.WriteRawData((const void *)&rilRadioResponse, sizeof(RadioResponseInfo))); 909d95e75fdSopenharmony_ci ASSERT_EQ(stubTestTwo->OnGetImsSwitchResponseInner(getImsSwitchData, getImsSwitchReply), TELEPHONY_SUCCESS); 910d95e75fdSopenharmony_ci } 911d95e75fdSopenharmony_ci} 912d95e75fdSopenharmony_ci 913d95e75fdSopenharmony_ci/** 914d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0003 915d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 916d95e75fdSopenharmony_ci * @tc.desc Function test 917d95e75fdSopenharmony_ci */ 918d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0003, Function | MediumTest | Level3) 919d95e75fdSopenharmony_ci{ 920d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 921d95e75fdSopenharmony_ci return; 922d95e75fdSopenharmony_ci } 923d95e75fdSopenharmony_ci 924d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stubTestThree = (std::make_unique<ImsCallCallbackStub>()).release(); 925d95e75fdSopenharmony_ci ASSERT_TRUE(stubTestThree != nullptr); 926d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { 927d95e75fdSopenharmony_ci if (!HasSimCard(slotId)) { 928d95e75fdSopenharmony_ci continue; 929d95e75fdSopenharmony_ci } 930d95e75fdSopenharmony_ci MessageParcel data; 931d95e75fdSopenharmony_ci MessageParcel reply; 932d95e75fdSopenharmony_ci ASSERT_TRUE(data.WriteInt32(slotId)); 933d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnAnswerResponseInner(data, reply), TELEPHONY_SUCCESS); 934d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnCallRingBackReportInner(data, reply), TELEPHONY_SUCCESS); 935d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnDialResponseInner(data, reply), TELEPHONY_SUCCESS); 936d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnHangUpResponseInner(data, reply), TELEPHONY_SUCCESS); 937d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnHoldCallResponseInner(data, reply), TELEPHONY_SUCCESS); 938d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnRejectResponseInner(data, reply), TELEPHONY_SUCCESS); 939d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnSendDtmfResponseInner(data, reply), TELEPHONY_SUCCESS); 940d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnSetImsSwitchResponseInner(data, reply), TELEPHONY_SUCCESS); 941d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnStartDtmfResponseInner(data, reply), TELEPHONY_SUCCESS); 942d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnStopDtmfResponseInner(data, reply), TELEPHONY_SUCCESS); 943d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnSwitchCallResponseInner(data, reply), TELEPHONY_SUCCESS); 944d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnUnHoldCallResponseInner(data, reply), TELEPHONY_SUCCESS); 945d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnSetMuteResponseInner(data, reply), TELEPHONY_SUCCESS); 946d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnCombineConferenceResponseInner(data, reply), TELEPHONY_SUCCESS); 947d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnInviteToConferenceResponseInner(data, reply), TELEPHONY_SUCCESS); 948d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnReceiveUpdateCallMediaModeRequestInner(data, reply), TELEPHONY_SUCCESS); 949d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnReceiveUpdateCallMediaModeResponseInner(data, reply), TELEPHONY_SUCCESS); 950d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnCallSessionEventChangedInner(data, reply), TELEPHONY_SUCCESS); 951d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnPeerDimensionsChangedInner(data, reply), TELEPHONY_SUCCESS); 952d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnCallDataUsageChangedInner(data, reply), TELEPHONY_SUCCESS); 953d95e75fdSopenharmony_ci ASSERT_NE(stubTestThree->OnCameraCapabilitiesChangedInner(data, reply), TELEPHONY_SUCCESS); 954d95e75fdSopenharmony_ci } 955d95e75fdSopenharmony_ci} 956d95e75fdSopenharmony_ci 957d95e75fdSopenharmony_ci/** 958d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0004 959d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 960d95e75fdSopenharmony_ci * @tc.desc Function test 961d95e75fdSopenharmony_ci */ 962d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0004, Function | MediumTest | Level3) 963d95e75fdSopenharmony_ci{ 964d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 965d95e75fdSopenharmony_ci return; 966d95e75fdSopenharmony_ci } 967d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stubTestFour = (std::make_unique<ImsCallCallbackStub>()).release(); 968d95e75fdSopenharmony_ci ASSERT_TRUE(stubTestFour != nullptr); 969d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { 970d95e75fdSopenharmony_ci if (!HasSimCard(slotId)) { 971d95e75fdSopenharmony_ci continue; 972d95e75fdSopenharmony_ci } 973d95e75fdSopenharmony_ci SsBaseResult normalResult; 974d95e75fdSopenharmony_ci normalResult.index = DEFAULT_INDEX; 975d95e75fdSopenharmony_ci MessageParcel crData; 976d95e75fdSopenharmony_ci MessageParcel crReply; 977d95e75fdSopenharmony_ci ASSERT_TRUE(crData.WriteInt32(slotId)); 978d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(crData, normalResult), TELEPHONY_SUCCESS); 979d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFour->OnSetCallRestrictionResponseInner(crData, crReply), TELEPHONY_SUCCESS); 980d95e75fdSopenharmony_ci MessageParcel ctData; 981d95e75fdSopenharmony_ci MessageParcel ctReply; 982d95e75fdSopenharmony_ci ASSERT_TRUE(ctData.WriteInt32(slotId)); 983d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(ctData, normalResult), TELEPHONY_SUCCESS); 984d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFour->OnSetCallTransferResponseInner(ctData, ctReply), TELEPHONY_SUCCESS); 985d95e75fdSopenharmony_ci MessageParcel cwData; 986d95e75fdSopenharmony_ci MessageParcel cwReply; 987d95e75fdSopenharmony_ci ASSERT_TRUE(cwData.WriteInt32(slotId)); 988d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(cwData, normalResult), TELEPHONY_SUCCESS); 989d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFour->OnSetCallWaitingResponseInner(cwData, cwReply), TELEPHONY_SUCCESS); 990d95e75fdSopenharmony_ci MessageParcel clipData; 991d95e75fdSopenharmony_ci MessageParcel clipReply; 992d95e75fdSopenharmony_ci ASSERT_TRUE(clipData.WriteInt32(slotId)); 993d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(clipData, normalResult), TELEPHONY_SUCCESS); 994d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFour->OnSetClipResponseInner(clipData, clipReply), TELEPHONY_SUCCESS); 995d95e75fdSopenharmony_ci MessageParcel clirData; 996d95e75fdSopenharmony_ci MessageParcel clirReply; 997d95e75fdSopenharmony_ci ASSERT_TRUE(clirData.WriteInt32(slotId)); 998d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(clirData, normalResult), TELEPHONY_SUCCESS); 999d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFour->OnSetClirResponseInner(clirData, clirReply), TELEPHONY_SUCCESS); 1000d95e75fdSopenharmony_ci MessageParcel colpData; 1001d95e75fdSopenharmony_ci MessageParcel colpReply; 1002d95e75fdSopenharmony_ci ASSERT_TRUE(colpData.WriteInt32(slotId)); 1003d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(colpData, normalResult), TELEPHONY_SUCCESS); 1004d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFour->OnSetColpResponseInner(colpData, colpReply), TELEPHONY_SUCCESS); 1005d95e75fdSopenharmony_ci MessageParcel colrData; 1006d95e75fdSopenharmony_ci MessageParcel colrReply; 1007d95e75fdSopenharmony_ci ASSERT_TRUE(colrData.WriteInt32(slotId)); 1008d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(colrData, normalResult), TELEPHONY_SUCCESS); 1009d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFour->OnSetColrResponseInner(colrData, colrReply), TELEPHONY_SUCCESS); 1010d95e75fdSopenharmony_ci } 1011d95e75fdSopenharmony_ci} 1012d95e75fdSopenharmony_ci 1013d95e75fdSopenharmony_ci/** 1014d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0005 1015d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 1016d95e75fdSopenharmony_ci * @tc.desc Function test 1017d95e75fdSopenharmony_ci */ 1018d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0005, Function | MediumTest | Level3) 1019d95e75fdSopenharmony_ci{ 1020d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 1021d95e75fdSopenharmony_ci return; 1022d95e75fdSopenharmony_ci } 1023d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stubTestFive = (std::make_unique<ImsCallCallbackStub>()).release(); 1024d95e75fdSopenharmony_ci ASSERT_TRUE(stubTestFive != nullptr); 1025d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { 1026d95e75fdSopenharmony_ci if (!HasSimCard(slotId)) { 1027d95e75fdSopenharmony_ci continue; 1028d95e75fdSopenharmony_ci } 1029d95e75fdSopenharmony_ci SsBaseResult normalResult; 1030d95e75fdSopenharmony_ci normalResult.index = INVALID_INDEX; 1031d95e75fdSopenharmony_ci MessageParcel crData; 1032d95e75fdSopenharmony_ci MessageParcel crReply; 1033d95e75fdSopenharmony_ci ASSERT_TRUE(crData.WriteInt32(slotId)); 1034d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(crData, normalResult), TELEPHONY_SUCCESS); 1035d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFive->OnSetCallRestrictionResponseInner(crData, crReply), TELEPHONY_SUCCESS); 1036d95e75fdSopenharmony_ci MessageParcel ctData; 1037d95e75fdSopenharmony_ci MessageParcel ctReply; 1038d95e75fdSopenharmony_ci ASSERT_TRUE(ctData.WriteInt32(slotId)); 1039d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(ctData, normalResult), TELEPHONY_SUCCESS); 1040d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFive->OnSetCallTransferResponseInner(ctData, ctReply), TELEPHONY_SUCCESS); 1041d95e75fdSopenharmony_ci MessageParcel cwData; 1042d95e75fdSopenharmony_ci MessageParcel cwReply; 1043d95e75fdSopenharmony_ci ASSERT_TRUE(cwData.WriteInt32(slotId)); 1044d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(cwData, normalResult), TELEPHONY_SUCCESS); 1045d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFive->OnSetCallWaitingResponseInner(cwData, cwReply), TELEPHONY_SUCCESS); 1046d95e75fdSopenharmony_ci MessageParcel clipData; 1047d95e75fdSopenharmony_ci MessageParcel clipReply; 1048d95e75fdSopenharmony_ci ASSERT_TRUE(clipData.WriteInt32(slotId)); 1049d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(clipData, normalResult), TELEPHONY_SUCCESS); 1050d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFive->OnSetClipResponseInner(clipData, clipReply), TELEPHONY_SUCCESS); 1051d95e75fdSopenharmony_ci MessageParcel clirData; 1052d95e75fdSopenharmony_ci MessageParcel clirReply; 1053d95e75fdSopenharmony_ci ASSERT_TRUE(clirData.WriteInt32(slotId)); 1054d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(clirData, normalResult), TELEPHONY_SUCCESS); 1055d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFive->OnSetClirResponseInner(clirData, clirReply), TELEPHONY_SUCCESS); 1056d95e75fdSopenharmony_ci MessageParcel colpData; 1057d95e75fdSopenharmony_ci MessageParcel colpReply; 1058d95e75fdSopenharmony_ci ASSERT_TRUE(colpData.WriteInt32(slotId)); 1059d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(colpData, normalResult), TELEPHONY_SUCCESS); 1060d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFive->OnSetColpResponseInner(colpData, colpReply), TELEPHONY_SUCCESS); 1061d95e75fdSopenharmony_ci MessageParcel colrData; 1062d95e75fdSopenharmony_ci MessageParcel colrReply; 1063d95e75fdSopenharmony_ci ASSERT_TRUE(colrData.WriteInt32(slotId)); 1064d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsBaseResult(colrData, normalResult), TELEPHONY_SUCCESS); 1065d95e75fdSopenharmony_ci ASSERT_EQ(stubTestFive->OnSetColrResponseInner(colrData, colrReply), TELEPHONY_SUCCESS); 1066d95e75fdSopenharmony_ci } 1067d95e75fdSopenharmony_ci} 1068d95e75fdSopenharmony_ci 1069d95e75fdSopenharmony_ci/** 1070d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0006 1071d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 1072d95e75fdSopenharmony_ci * @tc.desc Function test 1073d95e75fdSopenharmony_ci */ 1074d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0006, Function | MediumTest | Level3) 1075d95e75fdSopenharmony_ci{ 1076d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stubTestSix = (std::make_unique<ImsCallCallbackStub>()).release(); 1077d95e75fdSopenharmony_ci ASSERT_TRUE(stubTestSix != nullptr); 1078d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 1079d95e75fdSopenharmony_ci return; 1080d95e75fdSopenharmony_ci } 1081d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { 1082d95e75fdSopenharmony_ci if (!HasSimCard(slotId)) { 1083d95e75fdSopenharmony_ci continue; 1084d95e75fdSopenharmony_ci } 1085d95e75fdSopenharmony_ci SsBaseResult ssBaseResult; 1086d95e75fdSopenharmony_ci ssBaseResult.index = DEFAULT_INDEX; 1087d95e75fdSopenharmony_ci ssBaseResult.result = IMS_ERROR_UT_CS_FALLBACK; 1088d95e75fdSopenharmony_ci ASSERT_NE(stubTestSix->SetCallRestrictionResponse(slotId, ssBaseResult), TELEPHONY_SUCCESS); 1089d95e75fdSopenharmony_ci ASSERT_NE(stubTestSix->SetCallTransferResponse(slotId, ssBaseResult), TELEPHONY_SUCCESS); 1090d95e75fdSopenharmony_ci ASSERT_NE(stubTestSix->SetCallWaitingResponse(slotId, ssBaseResult), TELEPHONY_SUCCESS); 1091d95e75fdSopenharmony_ci ASSERT_NE(stubTestSix->SetClirResponse(slotId, ssBaseResult), TELEPHONY_SUCCESS); 1092d95e75fdSopenharmony_ci MessageParcel muteData; 1093d95e75fdSopenharmony_ci MessageParcel muteReply; 1094d95e75fdSopenharmony_ci MuteControlResponse muteResponse; 1095d95e75fdSopenharmony_ci ASSERT_TRUE(muteData.WriteInt32(slotId)); 1096d95e75fdSopenharmony_ci ASSERT_TRUE(muteData.WriteRawData((const void *)&muteResponse, sizeof(MuteControlResponse))); 1097d95e75fdSopenharmony_ci ASSERT_EQ(stubTestSix->OnSetMuteResponseInner(muteData, muteReply), TELEPHONY_SUCCESS); 1098d95e75fdSopenharmony_ci MessageParcel ringData; 1099d95e75fdSopenharmony_ci MessageParcel ringReply; 1100d95e75fdSopenharmony_ci RingbackVoice ringback; 1101d95e75fdSopenharmony_ci ASSERT_TRUE(ringData.WriteInt32(slotId)); 1102d95e75fdSopenharmony_ci ASSERT_TRUE(ringData.WriteRawData((const void *)&ringback, sizeof(RingbackVoice))); 1103d95e75fdSopenharmony_ci ASSERT_EQ(stubTestSix->OnCallRingBackReportInner(ringData, ringReply), TELEPHONY_SUCCESS); 1104d95e75fdSopenharmony_ci MessageParcel failData; 1105d95e75fdSopenharmony_ci MessageParcel failReply; 1106d95e75fdSopenharmony_ci DisconnectedDetails details; 1107d95e75fdSopenharmony_ci ASSERT_TRUE(failData.WriteInt32(slotId)); 1108d95e75fdSopenharmony_ci ASSERT_TRUE(failData.WriteInt32(static_cast<int32_t>(details.reason))); 1109d95e75fdSopenharmony_ci ASSERT_TRUE(failData.WriteString(details.message)); 1110d95e75fdSopenharmony_ci ASSERT_EQ(stubTestSix->OnLastCallFailReasonResponseInner(failData, failReply), TELEPHONY_SUCCESS); 1111d95e75fdSopenharmony_ci } 1112d95e75fdSopenharmony_ci} 1113d95e75fdSopenharmony_ci 1114d95e75fdSopenharmony_ci/** 1115d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0007 1116d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 1117d95e75fdSopenharmony_ci * @tc.desc Function test 1118d95e75fdSopenharmony_ci */ 1119d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0007, Function | MediumTest | Level3) 1120d95e75fdSopenharmony_ci{ 1121d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 1122d95e75fdSopenharmony_ci return; 1123d95e75fdSopenharmony_ci } 1124d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stubTestSeven = (std::make_unique<ImsCallCallbackStub>()).release(); 1125d95e75fdSopenharmony_ci ASSERT_TRUE(stubTestSeven != nullptr); 1126d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { 1127d95e75fdSopenharmony_ci if (!HasSimCard(slotId)) { 1128d95e75fdSopenharmony_ci continue; 1129d95e75fdSopenharmony_ci } 1130d95e75fdSopenharmony_ci CallRestrictionResult crResult; 1131d95e75fdSopenharmony_ci crResult.result.index = INVALID_INDEX; 1132d95e75fdSopenharmony_ci MessageParcel crErrorData; 1133d95e75fdSopenharmony_ci MessageParcel crErrorReply; 1134d95e75fdSopenharmony_ci ASSERT_TRUE(crErrorData.WriteInt32(slotId)); 1135d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsResult(crErrorData, crResult.result, crResult.status, crResult.classCw), TELEPHONY_SUCCESS); 1136d95e75fdSopenharmony_ci ASSERT_EQ(stubTestSeven->OnGetCallRestrictionResponseInner(crErrorData, crErrorReply), TELEPHONY_SUCCESS); 1137d95e75fdSopenharmony_ci 1138d95e75fdSopenharmony_ci crResult.result.index = DEFAULT_INDEX; 1139d95e75fdSopenharmony_ci MessageParcel crData; 1140d95e75fdSopenharmony_ci MessageParcel crReply; 1141d95e75fdSopenharmony_ci ASSERT_TRUE(crData.WriteInt32(slotId)); 1142d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsResult(crData, crResult.result, crResult.status, crResult.classCw), TELEPHONY_SUCCESS); 1143d95e75fdSopenharmony_ci ASSERT_EQ(stubTestSeven->OnGetCallRestrictionResponseInner(crData, crReply), TELEPHONY_SUCCESS); 1144d95e75fdSopenharmony_ci crResult.result.result = IMS_ERROR_UT_CS_FALLBACK; 1145d95e75fdSopenharmony_ci ASSERT_NE(stubTestSeven->GetCallRestrictionResponse(slotId, crResult), TELEPHONY_SUCCESS); 1146d95e75fdSopenharmony_ci 1147d95e75fdSopenharmony_ci CallForwardQueryInfoList callList; 1148d95e75fdSopenharmony_ci callList.result.index = INVALID_INDEX; 1149d95e75fdSopenharmony_ci MessageParcel ctErrorData; 1150d95e75fdSopenharmony_ci MessageParcel ctErrorReply; 1151d95e75fdSopenharmony_ci ASSERT_TRUE(ctErrorData.WriteInt32(slotId)); 1152d95e75fdSopenharmony_ci ASSERT_EQ(WriteCallForwardResult(ctErrorData, callList), TELEPHONY_SUCCESS); 1153d95e75fdSopenharmony_ci ASSERT_EQ(stubTestSeven->OnGetCallTransferResponseInner(ctErrorData, ctErrorReply), TELEPHONY_SUCCESS); 1154d95e75fdSopenharmony_ci 1155d95e75fdSopenharmony_ci callList.result.index = DEFAULT_INDEX; 1156d95e75fdSopenharmony_ci MessageParcel ctData; 1157d95e75fdSopenharmony_ci MessageParcel ctReply; 1158d95e75fdSopenharmony_ci ASSERT_TRUE(ctData.WriteInt32(slotId)); 1159d95e75fdSopenharmony_ci ASSERT_EQ(WriteCallForwardResult(ctData, callList), TELEPHONY_SUCCESS); 1160d95e75fdSopenharmony_ci ASSERT_EQ(stubTestSeven->OnGetCallTransferResponseInner(ctData, ctReply), TELEPHONY_SUCCESS); 1161d95e75fdSopenharmony_ci callList.result.result = IMS_ERROR_UT_CS_FALLBACK; 1162d95e75fdSopenharmony_ci ASSERT_NE(stubTestSeven->GetCallTransferResponse(slotId, callList), TELEPHONY_SUCCESS); 1163d95e75fdSopenharmony_ci } 1164d95e75fdSopenharmony_ci} 1165d95e75fdSopenharmony_ci 1166d95e75fdSopenharmony_ci/** 1167d95e75fdSopenharmony_ci * @tc.number cellular_call_ImsCallCallbackStub_0008 1168d95e75fdSopenharmony_ci * @tc.name Test for ImsCallCallbackStub 1169d95e75fdSopenharmony_ci * @tc.desc Function test 1170d95e75fdSopenharmony_ci */ 1171d95e75fdSopenharmony_ciHWTEST_F(ImsTest, cellular_call_ImsCallCallbackStub_0008, Function | MediumTest | Level3) 1172d95e75fdSopenharmony_ci{ 1173d95e75fdSopenharmony_ci if (!HasSimCard(SIM1_SLOTID) && !HasSimCard(SIM2_SLOTID)) { 1174d95e75fdSopenharmony_ci return; 1175d95e75fdSopenharmony_ci } 1176d95e75fdSopenharmony_ci sptr<ImsCallCallbackStub> stubTestEigth = (std::make_unique<ImsCallCallbackStub>()).release(); 1177d95e75fdSopenharmony_ci ASSERT_TRUE(stubTestEigth != nullptr); 1178d95e75fdSopenharmony_ci for (int32_t slotId = 0; slotId < SIM_SLOT_COUNT; slotId++) { 1179d95e75fdSopenharmony_ci if (!HasSimCard(slotId)) { 1180d95e75fdSopenharmony_ci continue; 1181d95e75fdSopenharmony_ci } 1182d95e75fdSopenharmony_ci CallWaitResult cwResult; 1183d95e75fdSopenharmony_ci cwResult.result.index = INVALID_INDEX; 1184d95e75fdSopenharmony_ci MessageParcel cwErrorData; 1185d95e75fdSopenharmony_ci MessageParcel cwErrorReply; 1186d95e75fdSopenharmony_ci ASSERT_TRUE(cwErrorData.WriteInt32(slotId)); 1187d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsResult(cwErrorData, cwResult.result, cwResult.status, cwResult.classCw), TELEPHONY_SUCCESS); 1188d95e75fdSopenharmony_ci ASSERT_EQ(stubTestEigth->OnGetCallWaitingResponseInner(cwErrorData, cwErrorReply), TELEPHONY_SUCCESS); 1189d95e75fdSopenharmony_ci 1190d95e75fdSopenharmony_ci cwResult.result.index = DEFAULT_INDEX; 1191d95e75fdSopenharmony_ci MessageParcel cwData; 1192d95e75fdSopenharmony_ci MessageParcel cwReply; 1193d95e75fdSopenharmony_ci ASSERT_TRUE(cwData.WriteInt32(slotId)); 1194d95e75fdSopenharmony_ci ASSERT_EQ(WriteSsResult(cwData, cwResult.result, cwResult.status, cwResult.classCw), TELEPHONY_SUCCESS); 1195d95e75fdSopenharmony_ci ASSERT_EQ(stubTestEigth->OnGetCallWaitingResponseInner(cwData, cwReply), TELEPHONY_SUCCESS); 1196d95e75fdSopenharmony_ci cwResult.result.result = IMS_ERROR_UT_CS_FALLBACK; 1197d95e75fdSopenharmony_ci ASSERT_NE(stubTestEigth->GetCallWaitingResponse(slotId, cwResult), TELEPHONY_SUCCESS); 1198d95e75fdSopenharmony_ci 1199d95e75fdSopenharmony_ci GetClipResult clipResult; 1200d95e75fdSopenharmony_ci clipResult.result.index = INVALID_INDEX; 1201d95e75fdSopenharmony_ci MessageParcel clipErrorData; 1202d95e75fdSopenharmony_ci MessageParcel clipErrorReply; 1203d95e75fdSopenharmony_ci ASSERT_TRUE(clipErrorData.WriteInt32(slotId)); 1204d95e75fdSopenharmony_ci ASSERT_EQ( 1205d95e75fdSopenharmony_ci WriteSsResult(clipErrorData, clipResult.result, clipResult.action, clipResult.clipStat), TELEPHONY_SUCCESS); 1206d95e75fdSopenharmony_ci ASSERT_EQ(stubTestEigth->OnGetClipResponseInner(clipErrorData, clipErrorReply), TELEPHONY_SUCCESS); 1207d95e75fdSopenharmony_ci 1208d95e75fdSopenharmony_ci clipResult.result.index = DEFAULT_INDEX; 1209d95e75fdSopenharmony_ci MessageParcel clipData; 1210d95e75fdSopenharmony_ci MessageParcel clipReply; 1211d95e75fdSopenharmony_ci ASSERT_TRUE(clipData.WriteInt32(slotId)); 1212d95e75fdSopenharmony_ci ASSERT_EQ( 1213d95e75fdSopenharmony_ci WriteSsResult(clipData, clipResult.result, clipResult.action, clipResult.clipStat), TELEPHONY_SUCCESS); 1214d95e75fdSopenharmony_ci ASSERT_EQ(stubTestEigth->OnGetClipResponseInner(clipData, clipReply), TELEPHONY_SUCCESS); 1215d95e75fdSopenharmony_ci clipResult.result.result = IMS_ERROR_UT_CS_FALLBACK; 1216d95e75fdSopenharmony_ci ASSERT_NE(stubTestEigth->GetClipResponse(slotId, clipResult), TELEPHONY_SUCCESS); 1217d95e75fdSopenharmony_ci } 1218d95e75fdSopenharmony_ci} 1219d95e75fdSopenharmony_ci} // namespace Telephony 1220d95e75fdSopenharmony_ci} // namespace OHOS 1221