add tdd testcases

Signed-off-by: qian-nan-xu <xuqiannan@huawei.com>
This commit is contained in:
qian-nan-xu 2022-07-01 17:50:49 +08:00
parent 4dec505481
commit 677f2f8f3e
13 changed files with 679 additions and 3 deletions

View File

@ -74,6 +74,7 @@ void ReqSetMute(const ReqDataInfo *requestInfo, int32_t mute);
void ReqGetEmergencyCallList(const ReqDataInfo *requestInfo);
void ReqSetEmergencyCallList(const ReqDataInfo *requestInfo, HRilEmergencyInfo *emergencyInfo, const int len);
void ReqGetCallFailReason(const ReqDataInfo *requestInfo);
void ReqSetBarringPassword(const ReqDataInfo *requestInfo, HRilSetBarringInfo info);
void ReportImsServiceStatusInfo(const char *str);
void ReportCallStateUpdated(const char *str);

View File

@ -1103,6 +1103,37 @@ void ReqSetCallRestriction(const ReqDataInfo *requestInfo, CallRestrictionInfo i
FreeResponseInfo(pResponse);
}
void ReqSetBarringPassword(const ReqDataInfo *requestInfo, HRilSetBarringInfo info)
{
long long timeOut = DEFAULT_TIMEOUT;
char cmd[MAX_CMD_LENGTH] = { 0 };
ResponseInfo *pResponse = NULL;
int32_t ret = GenerateCommand(cmd, MAX_CMD_LENGTH, "AT+CPWD=\"%s\",\"%s\",\"%s\"", info.fac,
info.oldPassword, info.newPassword);
if (ret < 0) {
TELEPHONY_LOGE("GenerateCommand is failed!");
OnCallReportErrorMessages(requestInfo, HRIL_ERR_GENERIC_FAILURE, NULL);
return;
}
int32_t err = SendCommandLock(cmd, NULL, timeOut, &pResponse);
if (err != HRIL_ERR_SUCCESS) {
TELEPHONY_LOGE("CPWD send failed");
err = HRIL_ERR_CMD_SEND_FAILURE;
} else if (pResponse != NULL) {
if (!pResponse->success) {
TELEPHONY_LOGE("ERROR: ReqSetBarringPassword return ERROR");
err = HRIL_ERR_GENERIC_FAILURE;
}
} else {
TELEPHONY_LOGE("ERROR: ReqSetBarringPassword pResponse is null");
err = HRIL_ERR_GENERIC_FAILURE;
}
struct ReportInfo reportInfo = CreateReportInfo(requestInfo, err, HRIL_RESPONSE, 0);
OnCallReport(GetSlotId(requestInfo), reportInfo, NULL, 0);
FreeResponseInfo(pResponse);
}
void ReqGetImsCallList(const ReqDataInfo *requestInfo)
{
int32_t ret;

View File

@ -78,6 +78,7 @@ static const HRilCallReq g_callReqOps = {
.GetEmergencyCallList = ReqGetEmergencyCallList,
.GetCallFailReason = ReqGetCallFailReason,
.SetEmergencyCallList = ReqSetEmergencyCallList,
.SetBarringPassword = ReqSetBarringPassword,
};
static const HRilSimReq g_simReqOps = {

View File

@ -93,6 +93,8 @@ public:
void GetEmergencyList(const AppExecFwk::InnerEvent::Pointer &result);
int32_t SetEmergencyCallList(const AppExecFwk::InnerEvent::Pointer &result);
void GetFailReason(const AppExecFwk::InnerEvent::Pointer &result);
void SetBarringPassword(const std::string &fac, const std::string &oldPwd, const std::string &newPwd,
const AppExecFwk::InnerEvent::Pointer &result);
void GetImsi(std::string aid, const AppExecFwk::InnerEvent::Pointer &response);

View File

@ -56,6 +56,7 @@ public:
void GetEmergencyListTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result);
void SetEmergencyCallListTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result);
void GetFailReasonTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result);
void SetBarringPasswordTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result);
void IccRilSimIoForAppTest(const AppExecFwk::InnerEvent::Pointer &result);
void GetRilCmImsiForAppTest(const AppExecFwk::InnerEvent::Pointer &result);

View File

@ -58,6 +58,7 @@ public:
void OnInit();
int32_t SendInt32Event(int32_t dispatchId, int32_t value);
int32_t SendInt32sEvent(int32_t dispatchId, int32_t argCount, ...);
int32_t SendStringEvent(int32_t dispatchId, const char *value);
int32_t SendBufferEvent(int32_t dispatchId, OHOS::MessageParcel &eventData);
int32_t SendCommonBufferEvent(int32_t dispatchId, const void *eventData, size_t dataLength);
@ -99,8 +100,22 @@ public:
int32_t GetSimStatus(const AppExecFwk::InnerEvent::Pointer &result);
int32_t SetUssd(std::string str, const AppExecFwk::InnerEvent::Pointer &result);
int32_t GetUssd(const AppExecFwk::InnerEvent::Pointer &result);
int32_t SetClip(int32_t action, const AppExecFwk::InnerEvent::Pointer &result);
int32_t GetClip(const AppExecFwk::InnerEvent::Pointer &result);
int32_t SetCallWaiting(int32_t activate, const AppExecFwk::InnerEvent::Pointer &result);
int32_t GetCallWaiting(const AppExecFwk::InnerEvent::Pointer &result);
int32_t SetCallRestriction(std::string fac, int32_t mode, std::string password,
const AppExecFwk::InnerEvent::Pointer &result);
int32_t GetCallRestriction(std::string fac, const AppExecFwk::InnerEvent::Pointer &result);
int32_t SetCallTransferInfo(int32_t reason, int32_t mode, std::string number, int32_t classx,
const AppExecFwk::InnerEvent::Pointer &result);
int32_t GetCallTransferInfo(int32_t reason, const AppExecFwk::InnerEvent::Pointer &result);
int32_t SetClir(int32_t action, const AppExecFwk::InnerEvent::Pointer &result);
int32_t GetClir(const AppExecFwk::InnerEvent::Pointer &result);
int32_t GetLinkBandwidthInfo(const int32_t cid, const AppExecFwk::InnerEvent::Pointer &result);
int32_t SetEmergencyCallList(const AppExecFwk::InnerEvent::Pointer &result);
int32_t SetBarringPassword(const std::string &fac, const std::string &oldPwd, const std::string &newPwd,
const AppExecFwk::InnerEvent::Pointer &result);
int32_t SimOpenLogicalChannel(std::string appID, int32_t p2, const AppExecFwk::InnerEvent::Pointer &response);
int32_t SimCloseLogicalChannel(int32_t channelId, const AppExecFwk::InnerEvent::Pointer &response);
int32_t SimTransmitApduLogicalChannel(ApduSimIORequestInfo reqInfo,
@ -115,6 +130,8 @@ public:
static const int32_t HRIL_ADAPTER_RADIO_RESPONSE = 2002;
static const int32_t RIL_ADAPTER_OEM_INDICATION = 2003;
static const int32_t RIL_ADAPTER_OEM_RESPONSE = 2004;
static const int32_t TELEPHONY_ERR_LOCAL_PTR_NULL = -1;
static const int32_t TELEPHONY_ERR_SUCCESS = 0;
sptr<IRemoteObject> cellularRadio_;
int32_t cdmaSubscription_ = 0;

View File

@ -72,6 +72,16 @@ public:
void OnRequestSetUssdTest(MessageParcel &data);
void OnRequestGetUssdTest(MessageParcel &data);
void OnRequestGetLinkBandwidthInfoTest(MessageParcel &data);
void OnRequestSetClipTest(MessageParcel &data);
void OnRequestGetClipTest(MessageParcel &data);
void OnRequestSetCallWaitingTest(MessageParcel &data);
void OnRequestGetCallWaitingTest(MessageParcel &data);
void OnRequestSetCallRestrictionTest(MessageParcel &data);
void OnRequestGetCallRestrictionTest(MessageParcel &data);
void OnRequestSetCallTransferInfoTest(MessageParcel &data);
void OnRequestGetCallTransferInfoTest(MessageParcel &data);
void OnRequestSetClirTest(MessageParcel &data);
void OnRequestGetClirTest(MessageParcel &data);
private:
RilManagerTest *mRilManager_;

View File

@ -74,8 +74,19 @@ private:
void DeactivatePdpContextTest(const AppExecFwk::InnerEvent::Pointer &result);
void SetUssdTest(const AppExecFwk::InnerEvent::Pointer &result);
void GetUssdTest(const AppExecFwk::InnerEvent::Pointer &result);
void SetClipTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result);
void GetClipTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result);
void SetCallWaitingTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result);
void GetCallWaitingTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result);
void SetCallRestrictionTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result);
void GetCallRestrictionTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result);
void SetCallTransferInfoTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result);
void GetCallTransferInfoTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result);
void SetClirTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result);
void GetClirTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result);
void GetLinkBandwidthInfoTest(const AppExecFwk::InnerEvent::Pointer &result);
void SetEmergencyCallListTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result);
void SetBarringPasswordTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result);
void SimOpenLogicalChannelTest(const AppExecFwk::InnerEvent::Pointer &result);
void SimTransmitApduLogicalChannelTest(const AppExecFwk::InnerEvent::Pointer &result);
void SimTransmitApduBasicChannelTest(const AppExecFwk::InnerEvent::Pointer &result);

View File

@ -47,6 +47,30 @@ int32_t RilManagerTest::SendInt32Event(int32_t dispatchId, int32_t value)
return status;
}
int32_t RilManagerTest::SendInt32sEvent(int32_t dispatchId, int32_t argCount, ...)
{
if (cellularRadio_ == nullptr) {
TELEPHONY_LOGE("cellularRadio_ is nullptr!!!");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
MessageParcel data;
MessageParcel reply;
va_list list;
va_start(list, argCount);
int32_t i = 0;
while (i < argCount) {
int32_t value = va_arg(list, int32_t);
data.WriteInt32(value);
i++;
}
va_end(list);
OHOS::MessageOption option = {OHOS::MessageOption::TF_ASYNC};
TELEPHONY_LOGI("Send Event %{public}d", dispatchId);
return cellularRadio_->SendRequest(dispatchId, data, reply, option);
}
int32_t RilManagerTest::SendStringEvent(int32_t dispatchId, const char *value)
{
int32_t status = 0;
@ -64,7 +88,7 @@ int32_t RilManagerTest::SendStringEvent(int32_t dispatchId, const char *value)
return status;
}
int32_t RilManagerTest::SendBufferEvent(int32_t dispatchId, MessageParcel &eventData)
int32_t RilManagerTest::SendBufferEvent(int32_t dispatchId, OHOS::MessageParcel &eventData)
{
int32_t status = 0;
if (cellularRadio_ != nullptr) {
@ -474,6 +498,30 @@ int32_t RilManagerTest::SetEmergencyCallList(const AppExecFwk::InnerEvent::Point
}
}
int32_t RilManagerTest::SetBarringPassword(const std::string &fac, const std::string &oldPwd, const std::string &newPwd,
const AppExecFwk::InnerEvent::Pointer &result)
{
TELEPHONY_LOGI("RilManagerTest::SetBarringPassword -->");
if (cellularRadio_ == nullptr) {
TELEPHONY_LOGE("%{public}s cellularRadio_ == nullptr", __func__);
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
std::shared_ptr<HRilRequestTest> telRilRequest = CreateRequest(HREQ_CALL_SET_BARRING_PASSWORD, result);
if (telRilRequest == nullptr) {
TELEPHONY_LOGE("telRilRequest is nullptr");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
MessageParcel data;
data.WriteInt32(telRilRequest->serialId_);
data.WriteCString(fac.c_str());
data.WriteCString(oldPwd.c_str());
data.WriteCString(newPwd.c_str());
int32_t ret = SendBufferEvent(HREQ_CALL_SET_BARRING_PASSWORD, data);
TELEPHONY_LOGI("SendBufferEvent(ID:%{public}d) return: %{public}d", HREQ_CALL_SET_BARRING_PASSWORD, ret);
return ret;
}
int32_t RilManagerTest::RilCmSplit(int32_t callIndex, int32_t callType, const AppExecFwk::InnerEvent::Pointer &result)
{
TELEPHONY_LOGI("RilCmSplit Request ");
@ -942,6 +990,213 @@ int32_t RilManagerTest::GetUssd(const AppExecFwk::InnerEvent::Pointer &result)
}
}
int32_t RilManagerTest::SetClip(int32_t action, const AppExecFwk::InnerEvent::Pointer &result)
{
std::shared_ptr<HRilRequestTest> telRilRequest = CreateRequest(HREQ_CALL_SET_CLIP, result);
if (telRilRequest == nullptr) {
TELEPHONY_LOGE("telRilRequest is nullptr");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
if (cellularRadio_ == nullptr) {
TELEPHONY_LOGE("%{public}s cellularRadio_ is nullptr", __func__);
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
int32_t ret = SendInt32sEvent(HREQ_CALL_SET_CLIP, HRIL_EVENT_COUNT_2, telRilRequest->serialId_, action);
if (ret != TELEPHONY_ERR_SUCCESS) {
TELEPHONY_LOGE("function is failed, error: %{public}d", ret);
}
return ret;
}
int32_t RilManagerTest::GetClip(const AppExecFwk::InnerEvent::Pointer &result)
{
std::shared_ptr<HRilRequestTest> telRilRequest = CreateRequest(HREQ_CALL_GET_CLIR, result);
if (telRilRequest == nullptr) {
TELEPHONY_LOGE("telRilRequest is nullptr");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
if (cellularRadio_ == nullptr) {
TELEPHONY_LOGE("%{public}s cellularRadio_ is nullptr", __func__);
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
return SendInt32Event(HREQ_CALL_GET_CLIR, telRilRequest->serialId_);
}
int32_t RilManagerTest::SetCallWaiting(int32_t activate, const AppExecFwk::InnerEvent::Pointer &result)
{
std::shared_ptr<HRilRequestTest> telRilRequest = CreateRequest(HREQ_CALL_SET_CALL_WAITING, result);
if (telRilRequest == nullptr) {
TELEPHONY_LOGE("telRilRequest is nullptr");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
if (cellularRadio_ == nullptr) {
TELEPHONY_LOGE("%{public}s cellularRadio_ is nullptr", __func__);
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
int32_t ret = SendInt32sEvent(HREQ_CALL_SET_CALL_WAITING, HRIL_EVENT_COUNT_2, telRilRequest->serialId_, activate);
if (ret != TELEPHONY_ERR_SUCCESS) {
TELEPHONY_LOGE("function is failed, error: %{public}d", ret);
}
return ret;
}
int32_t RilManagerTest::GetCallWaiting(const AppExecFwk::InnerEvent::Pointer &result)
{
std::shared_ptr<HRilRequestTest> telRilRequest = CreateRequest(HREQ_CALL_GET_CALL_WAITING, result);
if (telRilRequest == nullptr) {
TELEPHONY_LOGE("telRilRequest is nullptr");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
if (cellularRadio_ == nullptr) {
TELEPHONY_LOGE("%{public}s cellularRadio_ is nullptr", __func__);
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
return SendInt32Event(HREQ_CALL_GET_CALL_WAITING, telRilRequest->serialId_);
}
int32_t RilManagerTest::SetCallRestriction(
std::string fac, int32_t mode, std::string password, const AppExecFwk::InnerEvent::Pointer &result)
{
std::shared_ptr<HRilRequestTest> telRilRequest = CreateRequest(HREQ_CALL_SET_CALL_RESTRICTION, result);
if (telRilRequest == nullptr) {
TELEPHONY_LOGE("telRilRequest is nullptr");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
if (cellularRadio_ == nullptr) {
TELEPHONY_LOGE("%{public}s cellularRadio_ is nullptr", __func__);
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
MessageParcel data = {};
MessageParcel reply = {};
data.WriteInt32(telRilRequest->serialId_);
data.WriteInt32(mode);
data.WriteCString(fac.c_str());
data.WriteCString(password.c_str());
OHOS::MessageOption option = {OHOS::MessageOption::TF_ASYNC};
int32_t ret = cellularRadio_->SendRequest(HREQ_CALL_SET_CALL_RESTRICTION, data, reply, option);
if (ret != TELEPHONY_ERR_SUCCESS) {
TELEPHONY_LOGE("function is failed, error: %{public}d", ret);
}
return ret;
}
int32_t RilManagerTest::GetCallRestriction(std::string fac, const AppExecFwk::InnerEvent::Pointer &result)
{
std::shared_ptr<HRilRequestTest> telRilRequest = CreateRequest(HREQ_CALL_GET_CALL_RESTRICTION, result);
if (telRilRequest == nullptr) {
TELEPHONY_LOGE("telRilRequest is nullptr");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
if (cellularRadio_ == nullptr) {
TELEPHONY_LOGE("%{public}s cellularRadio_ is nullptr", __func__);
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
MessageParcel data = {};
MessageParcel reply = {};
data.WriteInt32(telRilRequest->serialId_);
data.WriteCString(fac.c_str());
OHOS::MessageOption option = {OHOS::MessageOption::TF_ASYNC};
int32_t ret = cellularRadio_->SendRequest(HREQ_CALL_GET_CALL_RESTRICTION, data, reply, option);
if (ret != TELEPHONY_ERR_SUCCESS) {
TELEPHONY_LOGE("function is failed, error: %{public}d", ret);
}
return ret;
}
int32_t RilManagerTest::SetCallTransferInfo(
int32_t reason, int32_t mode, std::string number, int32_t classx, const AppExecFwk::InnerEvent::Pointer &result)
{
std::shared_ptr<HRilRequestTest> telRilRequest = CreateRequest(HREQ_CALL_SET_CALL_TRANSFER_INFO, result);
if (telRilRequest == nullptr) {
TELEPHONY_LOGE("telRilRequest is nullptr");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
if (cellularRadio_ == nullptr) {
TELEPHONY_LOGE("cellularRadio_ is nullptr");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
CallForwardSetInfo callForwardSetInfo;
callForwardSetInfo.reason = reason;
callForwardSetInfo.mode = mode;
callForwardSetInfo.classx = classx;
callForwardSetInfo.number = number;
callForwardSetInfo.serial = telRilRequest->serialId_;
MessageParcel data = {};
callForwardSetInfo.Marshalling(data);
int32_t ret = SendBufferEvent(HREQ_CALL_SET_CALL_TRANSFER_INFO, data);
TELEPHONY_LOGI("Send (ID:%{public}d) return: %{public}d", HREQ_CALL_SET_CALL_TRANSFER_INFO, ret);
return ret;
}
int32_t RilManagerTest::GetCallTransferInfo(int32_t reason, const AppExecFwk::InnerEvent::Pointer &result)
{
std::shared_ptr<HRilRequestTest> telRilRequest = CreateRequest(HREQ_CALL_GET_CALL_TRANSFER_INFO, result);
if (telRilRequest == nullptr) {
TELEPHONY_LOGE("telRilRequest is nullptr");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
if (cellularRadio_ == nullptr) {
TELEPHONY_LOGE("%{public}s cellularRadio_ is nullptr", __func__);
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
int32_t ret =
SendInt32sEvent(HREQ_CALL_GET_CALL_TRANSFER_INFO, HRIL_EVENT_COUNT_2, telRilRequest->serialId_, reason);
if (ret != TELEPHONY_ERR_SUCCESS) {
TELEPHONY_LOGE("function is failed, error: %{public}d", ret);
}
return ret;
}
int32_t RilManagerTest::SetClir(int32_t action, const AppExecFwk::InnerEvent::Pointer &result)
{
std::shared_ptr<HRilRequestTest> telRilRequest = CreateRequest(HREQ_CALL_SET_CLIR, result);
if (telRilRequest == nullptr) {
TELEPHONY_LOGE("telRilRequest is nullptr");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
if (cellularRadio_ == nullptr) {
TELEPHONY_LOGE("%{public}s cellularRadio_ is nullptr", __func__);
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
int32_t ret = SendInt32sEvent(HREQ_CALL_SET_CLIR, HRIL_EVENT_COUNT_2, telRilRequest->serialId_, action);
if (ret != TELEPHONY_ERR_SUCCESS) {
TELEPHONY_LOGE("function is failed, error: %{public}d", ret);
}
return ret;
}
int32_t RilManagerTest::GetClir(const AppExecFwk::InnerEvent::Pointer &result)
{
std::shared_ptr<HRilRequestTest> telRilRequest = CreateRequest(HREQ_CALL_GET_CLIR, result);
if (telRilRequest == nullptr) {
TELEPHONY_LOGE("telRilRequest is nullptr");
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
if (cellularRadio_ == nullptr) {
TELEPHONY_LOGE("%{public}s cellularRadio_ is nullptr", __func__);
return TELEPHONY_ERR_LOCAL_PTR_NULL;
}
return SendInt32Event(HREQ_CALL_GET_CLIR, telRilRequest->serialId_);
}
int32_t RilManagerTest::GetLinkBandwidthInfo(const int32_t cid, const AppExecFwk::InnerEvent::Pointer &result)
{
TELEPHONY_LOGI("RilManagerTest::GetLinkBandwidthInfo -->");

View File

@ -541,5 +541,115 @@ void RilRadioResponseTest::OnRequestGetLinkBandwidthInfoTest(MessageParcel &data
return;
}
}
void RilRadioResponseTest::OnRequestSetClipTest(MessageParcel &data)
{
TELEPHONY_LOGI("RilRadioResponseTest::OnRequestSetClipTest --> ");
const size_t readSpSize = sizeof(struct HRilRadioResponseInfo);
const uint8_t *spBuffer = data.ReadBuffer(readSpSize);
if (spBuffer == nullptr) {
TELEPHONY_LOGE("ERROR : OnRequestSetClipTest --> data.ReadBuffer(readSpSize) failed !!!");
return;
}
}
void RilRadioResponseTest::OnRequestGetClipTest(MessageParcel &data)
{
TELEPHONY_LOGI("RilRadioResponseTest::OnRequestGetClipTest --> ");
const size_t readSpSize = sizeof(struct HRilRadioResponseInfo);
const uint8_t *spBuffer = data.ReadBuffer(readSpSize);
if (spBuffer == nullptr) {
TELEPHONY_LOGE("ERROR : OnRequestGetClipTest --> data.ReadBuffer(readSpSize) failed !!!");
return;
}
}
void RilRadioResponseTest::OnRequestSetCallWaitingTest(MessageParcel &data)
{
TELEPHONY_LOGI("RilRadioResponseTest::OnRequestSetCallWaitingTest --> ");
const size_t readSpSize = sizeof(struct HRilRadioResponseInfo);
const uint8_t *spBuffer = data.ReadBuffer(readSpSize);
if (spBuffer == nullptr) {
TELEPHONY_LOGE("ERROR : OnRequestSetCallWaitingTest --> data.ReadBuffer(readSpSize) failed !!!");
return;
}
}
void RilRadioResponseTest::OnRequestGetCallWaitingTest(MessageParcel &data)
{
TELEPHONY_LOGI("RilRadioResponseTest::OnRequestGetCallWaitingTest --> ");
const size_t readSpSize = sizeof(struct HRilRadioResponseInfo);
const uint8_t *spBuffer = data.ReadBuffer(readSpSize);
if (spBuffer == nullptr) {
TELEPHONY_LOGE("ERROR : OnRequestGetCallWaitingTest --> data.ReadBuffer(readSpSize) failed !!!");
return;
}
}
void RilRadioResponseTest::OnRequestSetCallRestrictionTest(MessageParcel &data)
{
TELEPHONY_LOGI("RilRadioResponseTest::OnRequestSetCallRestrictionTest --> ");
const size_t readSpSize = sizeof(struct HRilRadioResponseInfo);
const uint8_t *spBuffer = data.ReadBuffer(readSpSize);
if (spBuffer == nullptr) {
TELEPHONY_LOGE("ERROR : OnRequestSetCallRestrictionTest --> data.ReadBuffer(readSpSize) failed !!!");
return;
}
}
void RilRadioResponseTest::OnRequestGetCallRestrictionTest(MessageParcel &data)
{
TELEPHONY_LOGI("RilRadioResponseTest::OnRequestGetCallRestrictionTest --> ");
const size_t readSpSize = sizeof(struct HRilRadioResponseInfo);
const uint8_t *spBuffer = data.ReadBuffer(readSpSize);
if (spBuffer == nullptr) {
TELEPHONY_LOGE("ERROR : OnRequestGetCallRestrictionTest --> data.ReadBuffer(readSpSize) failed !!!");
return;
}
}
void RilRadioResponseTest::OnRequestSetCallTransferInfoTest(MessageParcel &data)
{
TELEPHONY_LOGI("RilRadioResponseTest::OnRequestSetCallTransferInfoTest --> ");
const size_t readSpSize = sizeof(struct HRilRadioResponseInfo);
const uint8_t *spBuffer = data.ReadBuffer(readSpSize);
if (spBuffer == nullptr) {
TELEPHONY_LOGE("ERROR : OnRequestSetCallTransferInfoTest --> data.ReadBuffer(readSpSize) failed !!!");
return;
}
}
void RilRadioResponseTest::OnRequestGetCallTransferInfoTest(MessageParcel &data)
{
TELEPHONY_LOGI("RilRadioResponseTest::OnRequestGetCallTransferInfoTest --> ");
const size_t readSpSize = sizeof(struct HRilRadioResponseInfo);
const uint8_t *spBuffer = data.ReadBuffer(readSpSize);
if (spBuffer == nullptr) {
TELEPHONY_LOGE("ERROR : OnRequestGetCallTransferInfoTest --> data.ReadBuffer(readSpSize) failed !!!");
return;
}
}
void RilRadioResponseTest::OnRequestSetClirTest(MessageParcel &data)
{
TELEPHONY_LOGI("RilRadioResponseTest::OnRequestSetClirTest --> ");
const size_t readSpSize = sizeof(struct HRilRadioResponseInfo);
const uint8_t *spBuffer = data.ReadBuffer(readSpSize);
if (spBuffer == nullptr) {
TELEPHONY_LOGE("ERROR : OnRequestSetClirTest --> data.ReadBuffer(readSpSize) failed !!!");
return;
}
}
void RilRadioResponseTest::OnRequestGetClirTest(MessageParcel &data)
{
TELEPHONY_LOGI("RilRadioResponseTest::OnRequestGetClirTest --> ");
const size_t readSpSize = sizeof(struct HRilRadioResponseInfo);
const uint8_t *spBuffer = data.ReadBuffer(readSpSize);
if (spBuffer == nullptr) {
TELEPHONY_LOGE("ERROR : OnRequestGetClirTest --> data.ReadBuffer(readSpSize) failed !!!");
return;
}
}
} // namespace Telephony
} // namespace OHOS

View File

@ -86,6 +86,7 @@ void RilUnitTest::AddRequestToMap()
memberFuncMap_[HREQ_CALL_UNHOLD_CALL] = &RilUnitTest::UnHoldCallTest;
memberFuncMap_[HREQ_CALL_SWITCH_CALL] = &RilUnitTest::SwitchCallTest;
memberFuncMap_[HREQ_CALL_SET_EMERGENCY_LIST] = &RilUnitTest::SetEmergencyCallListTest;
memberFuncMap_[HREQ_CALL_SET_BARRING_PASSWORD] = &RilUnitTest::SetBarringPasswordTest;
memberFuncMap_[HREQ_CALL_COMBINE_CONFERENCE] = &RilUnitTest::RilCmJoinCallTest;
memberFuncMap_[HREQ_CALL_SEPARATE_CONFERENCE] = &RilUnitTest::RilCmSplitCallTest;
memberFuncMap_[HREQ_NETWORK_GET_OPERATOR_INFO] = &RilUnitTest::GetRilCmOperatorTest;
@ -104,6 +105,16 @@ void RilUnitTest::AddRequestToMap()
memberFuncMap_[HREQ_DATA_DEACTIVATE_PDP_CONTEXT] = &RilUnitTest::DeactivatePdpContextTest;
memberFuncMap_[HREQ_CALL_SET_USSD] = &RilUnitTest::SetUssdTest;
memberFuncMap_[HREQ_CALL_GET_USSD] = &RilUnitTest::GetUssdTest;
memberFuncMap_[HREQ_CALL_SET_CLIP] = &RilUnitTest::SetClipTest;
memberFuncMap_[HREQ_CALL_GET_CLIP] = &RilUnitTest::GetClipTest;
memberFuncMap_[HREQ_CALL_SET_CALL_WAITING] = &RilUnitTest::SetCallWaitingTest;
memberFuncMap_[HREQ_CALL_GET_CALL_WAITING] = &RilUnitTest::GetCallWaitingTest;
memberFuncMap_[HREQ_CALL_SET_CALL_RESTRICTION] = &RilUnitTest::SetCallRestrictionTest;
memberFuncMap_[HREQ_CALL_GET_CALL_RESTRICTION] = &RilUnitTest::GetCallRestrictionTest;
memberFuncMap_[HREQ_CALL_SET_CALL_TRANSFER_INFO] = &RilUnitTest::SetCallTransferInfoTest;
memberFuncMap_[HREQ_CALL_GET_CALL_TRANSFER_INFO] = &RilUnitTest::GetCallTransferInfoTest;
memberFuncMap_[HREQ_CALL_SET_CLIR] = &RilUnitTest::SetClirTest;
memberFuncMap_[HREQ_CALL_GET_CLIR] = &RilUnitTest::GetClirTest;
memberFuncMap_[HREQ_DATA_GET_LINK_BANDWIDTH_INFO] = &RilUnitTest::GetLinkBandwidthInfoTest;
memberFuncMap_[HREQ_SIM_OPEN_LOGICAL_CHANNEL] = &RilUnitTest::SimOpenLogicalChannelTest;
memberFuncMap_[HREQ_SIM_TRANSMIT_APDU_LOGICAL_CHANNEL] = &RilUnitTest::SimTransmitApduLogicalChannelTest;
@ -507,6 +518,101 @@ void RilUnitTest::GetUssdTest(const OHOS::AppExecFwk::InnerEvent::Pointer &resul
ASSERT_EQ(0, ret);
}
void RilUnitTest::SetClipTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result)
{
TELEPHONY_LOGI("RilUnitTest::SetClipTest -->");
int32_t ret = mRilManager_->SetClip(1, result);
TELEPHONY_LOGI("RilUnitTest::SetClipTest return: %{public}d", ret);
ASSERT_EQ(0, ret);
}
void RilUnitTest::GetClipTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result)
{
TELEPHONY_LOGI("RilUnitTest::GetClipTest -->");
int32_t ret = mRilManager_->GetClip(result);
TELEPHONY_LOGI("RilUnitTest::GetClipTest return: %{public}d", ret);
ASSERT_EQ(0, ret);
}
void RilUnitTest::SetCallWaitingTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result)
{
TELEPHONY_LOGI("RilUnitTest::SetCallWaitingTest -->");
int32_t ret = mRilManager_->SetCallWaiting(1, result);
TELEPHONY_LOGI("RilUnitTest::SetCallWaitingTest return: %{public}d", ret);
ASSERT_EQ(0, ret);
}
void RilUnitTest::SetBarringPasswordTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result)
{
TELEPHONY_LOGI("RilUnitTest::SetBarringPasswordTest -->");
std::string fac = "AB";
std::string oldPwd = "1234";
std::string newPwd = "3456";
int32_t ret = mRilManager_->SetBarringPassword(fac, oldPwd, newPwd, result);
TELEPHONY_LOGI("RilUnitTest::SetBarringPasswordTest --> SetBarringPasswordTest finished return: %{public}d", ret);
ASSERT_EQ(0, ret);
}
void RilUnitTest::GetCallWaitingTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result)
{
TELEPHONY_LOGI("RilUnitTest::GetCallWaitingTest -->");
int32_t ret = mRilManager_->GetCallWaiting(result);
TELEPHONY_LOGI("RilUnitTest::GetCallWaitingTest return: %{public}d", ret);
ASSERT_EQ(0, ret);
}
void RilUnitTest::SetCallRestrictionTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result)
{
TELEPHONY_LOGI("RilUnitTest::SetCallRestrictionTest -->");
std::string fac = "AO";
std::string password = "123456";
int32_t ret = mRilManager_->SetCallRestriction(fac, 1, password, result);
TELEPHONY_LOGI("RilUnitTest::SetCallRestrictionTest return: %{public}d", ret);
ASSERT_EQ(0, ret);
}
void RilUnitTest::GetCallRestrictionTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result)
{
TELEPHONY_LOGI("RilUnitTest::GetCallRestrictionTest -->");
std::string fac = "AO";
int32_t ret = mRilManager_->GetCallRestriction(fac, result);
TELEPHONY_LOGI("RilUnitTest::GetCallRestrictionTest return: %{public}d", ret);
ASSERT_EQ(0, ret);
}
void RilUnitTest::SetCallTransferInfoTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result)
{
TELEPHONY_LOGI("RilUnitTest::SetCallTransferInfoTest -->");
std::string number = "123456789";
int32_t ret = mRilManager_->SetCallTransferInfo(1, 1, number, 1, result);
TELEPHONY_LOGI("RilUnitTest::SetCallTransferInfoTest return: %{public}d", ret);
ASSERT_EQ(0, ret);
}
void RilUnitTest::GetCallTransferInfoTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result)
{
TELEPHONY_LOGI("RilUnitTest::GetCallTransferInfoTest -->");
int32_t ret = mRilManager_->GetCallTransferInfo(1, result);
TELEPHONY_LOGI("RilUnitTest::GetCallTransferInfoTest return: %{public}d", ret);
ASSERT_EQ(0, ret);
}
void RilUnitTest::SetClirTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result)
{
TELEPHONY_LOGI("RilUnitTest::SetClirTest -->");
int32_t ret = mRilManager_->SetClir(1, result);
TELEPHONY_LOGI("RilUnitTest::SetClirTest return: %{public}d", ret);
ASSERT_EQ(0, ret);
}
void RilUnitTest::GetClirTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result)
{
TELEPHONY_LOGI("RilUnitTest::GetClirTest -->");
int32_t ret = mRilManager_->GetClir(result);
TELEPHONY_LOGI("RilUnitTest::GetClirTest return: %{public}d", ret);
ASSERT_EQ(0, ret);
}
void RilUnitTest::GetLinkBandwidthInfoTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result)
{
TELEPHONY_LOGI("RilUnitTest::GetLinkBandwidthInfoTest -->");
@ -534,6 +640,14 @@ HWTEST_F(RilUnitTest, Telephony_RilAdapter_SetEmergencyCallListTest_0100, Functi
OnProcessTest(HREQ_CALL_SET_EMERGENCY_LIST, event);
}
HWTEST_F(RilUnitTest, Telephony_RilAdapter_SetBarringPasswordTest_0100, Function | MediumTest | Level3)
{
OnInit();
auto event = OHOS::AppExecFwk::InnerEvent::Get(HREQ_CALL_SET_BARRING_PASSWORD);
event->SetOwner(GetHandler());
OnProcessTest(HREQ_CALL_SET_BARRING_PASSWORD, event);
}
HWTEST_F(RilUnitTest, Telephony_RilAdapter_RilCmDialTest_0100, Function | MediumTest | Level3)
{
OnInit();
@ -782,6 +896,87 @@ HWTEST_F(RilUnitTest, Telephony_RilAdapter_GetUssdTest_0100, Function | MediumTe
OnProcessTest(HREQ_CALL_GET_USSD, event);
}
HWTEST_F(RilUnitTest, Telephony_RilAdapter_SetClipTest_0100, Function | MediumTest | Level3)
{
OnInit();
auto event = OHOS::AppExecFwk::InnerEvent::Get(HREQ_CALL_SET_CLIP);
event->SetOwner(GetHandler());
OnProcessTest(HREQ_CALL_SET_CLIP, event);
}
HWTEST_F(RilUnitTest, Telephony_RilAdapter_GetClipTest_0100, Function | MediumTest | Level3)
{
OnInit();
auto event = OHOS::AppExecFwk::InnerEvent::Get(HREQ_CALL_GET_CLIP);
event->SetOwner(GetHandler());
OnProcessTest(HREQ_CALL_GET_CLIP, event);
}
HWTEST_F(RilUnitTest, Telephony_RilAdapter_SetCallWaitingTest_0100, Function | MediumTest | Level3)
{
OnInit();
auto event = OHOS::AppExecFwk::InnerEvent::Get(HREQ_CALL_SET_CALL_WAITING);
event->SetOwner(GetHandler());
OnProcessTest(HREQ_CALL_SET_CALL_WAITING, event);
}
HWTEST_F(RilUnitTest, Telephony_RilAdapter_GetCallWaitingTest_0100, Function | MediumTest | Level3)
{
OnInit();
auto event = OHOS::AppExecFwk::InnerEvent::Get(HREQ_CALL_GET_CALL_WAITING);
event->SetOwner(GetHandler());
OnProcessTest(HREQ_CALL_GET_CALL_WAITING, event);
}
HWTEST_F(RilUnitTest, Telephony_RilAdapter_SetCallRestrictionTest_0100, Function | MediumTest | Level3)
{
OnInit();
auto event = OHOS::AppExecFwk::InnerEvent::Get(HREQ_CALL_SET_CALL_RESTRICTION);
event->SetOwner(GetHandler());
OnProcessTest(HREQ_CALL_SET_CALL_RESTRICTION, event);
}
HWTEST_F(RilUnitTest, Telephony_RilAdapter_GetCallRestrictionTest_0100, Function | MediumTest | Level3)
{
OnInit();
auto event = OHOS::AppExecFwk::InnerEvent::Get(HREQ_CALL_GET_CALL_RESTRICTION);
event->SetOwner(GetHandler());
OnProcessTest(HREQ_CALL_GET_CALL_RESTRICTION, event);
}
HWTEST_F(RilUnitTest, Telephony_RilAdapter_SetCallTransferInfoTest_0100, Function | MediumTest | Level3)
{
OnInit();
auto event = OHOS::AppExecFwk::InnerEvent::Get(HREQ_CALL_SET_CALL_TRANSFER_INFO);
event->SetOwner(GetHandler());
OnProcessTest(HREQ_CALL_SET_CALL_TRANSFER_INFO, event);
}
HWTEST_F(RilUnitTest, Telephony_RilAdapter_GetCallTransferInfoTest_0100, Function | MediumTest | Level3)
{
OnInit();
auto event = OHOS::AppExecFwk::InnerEvent::Get(HREQ_CALL_GET_CALL_TRANSFER_INFO);
event->SetOwner(GetHandler());
OnProcessTest(HREQ_CALL_GET_CALL_TRANSFER_INFO, event);
}
HWTEST_F(RilUnitTest, Telephony_RilAdapter_SetClirTest_0100, Function | MediumTest | Level3)
{
OnInit();
auto event = OHOS::AppExecFwk::InnerEvent::Get(HREQ_CALL_SET_CLIR);
event->SetOwner(GetHandler());
OnProcessTest(HREQ_CALL_SET_CLIR, event);
}
HWTEST_F(RilUnitTest, Telephony_RilAdapter_GetClirTest_0100, Function | MediumTest | Level3)
{
OnInit();
auto event = OHOS::AppExecFwk::InnerEvent::Get(HREQ_CALL_GET_CLIR);
event->SetOwner(GetHandler());
OnProcessTest(HREQ_CALL_GET_CLIR, event);
}
HWTEST_F(RilUnitTest, Telephony_RilAdapter_GetLinkBandwidthInfoTest_0100, Function | MediumTest | Level3)
{
OnInit();

View File

@ -568,6 +568,29 @@ int32_t RilManagerTest::SetEmergencyCallList(const AppExecFwk::InnerEvent::Point
}
}
void RilManagerTest::SetBarringPassword(const std::string &fac, const std::string &oldPwd, const std::string &newPwd,
const AppExecFwk::InnerEvent::Pointer &result)
{
TELEPHONY_LOGI("RilManagerTest::SetBarringPassword -->");
if (cellularRadio_ == nullptr) {
TELEPHONY_LOGE("SetBarringPassword cellularRadio_ is nullptr");
return;
}
std::shared_ptr<HRilRequestTest> request = CreateRequest(HREQ_CALL_SET_BARRING_PASSWORD, result);
if (request == nullptr) {
TELEPHONY_LOGE("SetBarringPassword request is nullptr");
return;
}
MessageParcel data;
MessageParcel reply;
data.WriteInt32(request->serialId_);
data.WriteCString(fac.c_str());
data.WriteCString(oldPwd.c_str());
data.WriteCString(newPwd.c_str());
MessageOption option;
cellularRadio_->SendRequest(HREQ_CALL_SET_BARRING_PASSWORD, data, reply, option);
}
void RilManagerTest::GetFailReason(const AppExecFwk::InnerEvent::Pointer &result)
{
TELEPHONY_LOGI("RilManagerTest::GetFailReason -->");

View File

@ -257,6 +257,24 @@ void RilUnitTest::SetEmergencyCallListTest(const OHOS::AppExecFwk::InnerEvent::P
TELEPHONY_LOGI("RilUnitTest::SetEmergencyCallListTest return: %{public}d", ret);
}
void RilUnitTest::SetBarringPasswordTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result)
{
TELEPHONY_LOGI("RilUnitTest::SetBarringPasswordTest -->");
string fac = "AB";
cout << "Please input old password:";
string oldPassword;
cin >> oldPassword;
cout << "Your input old password is : " << oldPassword << endl;
cout << "Please input new password:";
string newPassword;
cin >> newPassword;
cout << "Your input new password is : " << newPassword << endl;
mRilManager_->SetBarringPassword(fac, oldPassword, newPassword, result);
TELEPHONY_LOGI("RilUnitTest::SetBarringPasswordTest --> finished");
}
void RilUnitTest::GetFailReasonTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result)
{
TELEPHONY_LOGI("RilUnitTest::GetFailReasonTest -->");
@ -622,8 +640,7 @@ void RilUnitTest::AcknowledgeRilCmLastIncomingGsmSmsTest(const OHOS::AppExecFwk:
TELEPHONY_LOGI("RilUnitTest::AcknowledgeRilCmLastIncomingGsmSmsTest -->");
int32_t cause = 2;
mRilManager_->SendSmsAck(true, cause, result);
TELEPHONY_LOGI("RilUnitTest::AcknowledgeRilCmLastIncomingGsmSmsTest --> AcknowledgeRilCmLastIncomingGsmSmsTest "
"finished");
TELEPHONY_LOGI("RilUnitTest::AcknowledgeRilCmLastIncomingGsmSmsTest --> finished");
}
void RilUnitTest::SetupRilCmDataCallTest(const OHOS::AppExecFwk::InnerEvent::Pointer &result)
@ -990,6 +1007,7 @@ void RilUnitTest::OnInitProcessInterface()
memberFuncMap_[HREQ_CALL_GET_EMERGENCY_LIST] = &RilUnitTest::GetEmergencyListTest;
memberFuncMap_[HREQ_CALL_SET_EMERGENCY_LIST] = &RilUnitTest::SetEmergencyCallListTest;
memberFuncMap_[HREQ_CALL_GET_FAIL_REASON] = &RilUnitTest::GetFailReasonTest;
memberFuncMap_[HREQ_CALL_SET_BARRING_PASSWORD] = &RilUnitTest::SetBarringPasswordTest;
// sms
memberFuncMap_[HREQ_SMS_SEND_GSM_SMS] = &RilUnitTest::SendRilCmSmsTest;
@ -1110,6 +1128,7 @@ static int32_t PrintCallMenu()
cout << "----> [" << HREQ_CALL_GET_EMERGENCY_LIST << "] ---->[ HREQ_CALL_GET_EMERGENCY_LIST ]" << endl;
cout << "----> [" << HREQ_CALL_SET_EMERGENCY_LIST << "] ---->[ HREQ_CALL_SET_EMERGENCY_LIST ]" << endl;
cout << "----> [" << HREQ_CALL_GET_FAIL_REASON << "] ---->[ HREQ_CALL_GET_FAIL_REASON ]" << endl;
cout << "----> [" << HREQ_CALL_SET_BARRING_PASSWORD << "] ---->[ HREQ_CALL_SET_BARRING_PASSWORD ]" << endl;
int32_t choice = InputInt32(HREQ_CALL_BASE, HREQ_SMS_BASE - 1, "Command");
cout << "---->You choose: " << choice << endl;