Skip to content

Commit

Permalink
frameworks/telephony: test case function add disconnect_reason parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanliping0609 committed Dec 24, 2024
1 parent 880b906 commit 37ecb5c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 52 deletions.
12 changes: 11 additions & 1 deletion test/remote_operation.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,14 @@ void remote_call_operation(int slot_id, const char* phone_number, enum REMOTE_CA
sprintf(remote_command_buf, "AT+REMOTECALL=%d,0,0,%s,129", (int)op, phone_number);
tapi_invoke_oem_ril_request_strings(get_tapi_ctx(), slot_id,
EVENT_OEM_RIL_REQUEST_STRINGS_DONE, oem_req, 1, NULL);
}
}

void remote_call_hangup_with_disconnect_reason(int slot_id, const char* phone_number, int disconnect_reason)
{
char* oem_req[1];
oem_req[0] = remote_command_buf;
memset(remote_command_buf, 0, sizeof(remote_command_buf));
sprintf(remote_command_buf, "AT+REMOTECALL=6,0,0,%s,129,%d", phone_number, disconnect_reason);
tapi_invoke_oem_ril_request_strings(get_tapi_ctx(), slot_id,
EVENT_OEM_RIL_REQUEST_STRINGS_DONE, oem_req, 1, NULL);
}
6 changes: 5 additions & 1 deletion test/remote_operation.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ enum REMOTE_CALL_COMMAND_TYPE {
REJECT_CALL = 6,
};

void remote_call_operation(int slot_id, const char* phone_number, enum REMOTE_CALL_COMMAND_TYPE op);
#define DISCONNECT_REASON_REMOTE_HANGUP 16
#define DISCONNECT_REASON_NETWORK_HANGUP 34

void remote_call_operation(int slot_id, const char* phone_number, enum REMOTE_CALL_COMMAND_TYPE op);
void remote_call_hangup_with_disconnect_reason(int slot_id, const char* phone_number, int disconnect_reason);
60 changes: 10 additions & 50 deletions test/telephony_call_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1180,7 +1180,7 @@ int remote_operation_call_reject_test(int slot_id)
judge_data_init();
judge_data.expect = CALL_REMOTE_HANGUP;

remote_call_operation(slot_id, phone_num, REJECT_CALL);
remote_call_hangup_with_disconnect_reason(slot_id, phone_num, DISCONNECT_REASON_REMOTE_HANGUP);

if (judge()) {
syslog(LOG_ERR, "No hangup call message received in %s", __func__);
Expand Down Expand Up @@ -1384,17 +1384,8 @@ int outgoing_call_remote_answer_and_hangup(int slot_id)
}

sleep(5);
judge_data_init();
judge_data.expect = CALL_STATE_CHANGE_TO_ACTIVE;
remote_call_operation(slot_id, phone_num, ACTIVE_CALL);
if (judge()) {
syslog(LOG_ERR, "No active call message received in %s", __func__);
res = -1;
goto on_exit;
}

if (judge_data.result) {
syslog(LOG_ERR, "Unsolicited message error in %s", __func__);
if (remote_operation_call_active_test(slot_id) < 0) {
syslog(LOG_ERR, "Remote call active fail in %s", __func__);
res = -1;
goto on_exit;
}
Expand Down Expand Up @@ -1794,19 +1785,8 @@ int call_incoming_and_hangup_by_dialer_before_answer_numerous(int slot_id)
int incoming_call_answer_and_hangup(int slot_id)
{
int res = 0;
judge_data_init();
test_case_data_init();
judge_data.expect = NEW_CALL_INCOMING;

remote_call_operation(slot_id, phone_num, INCOMING_CALL);
if (judge()) {
syslog(LOG_ERR, "No incoming call message received in %s", __func__);
res = -1;
goto on_exit;
}

if (judge_data.result) {
syslog(LOG_ERR, "Unsolicited message error in %s", __func__);
if (remote_operation_call_incoming_test(slot_id) < 0) {
syslog(LOG_ERR, "Incoming call fail in %s", __func__);
res = -1;
goto on_exit;
}
Expand All @@ -1832,19 +1812,8 @@ int incoming_call_answer_and_hangup(int slot_id)
int incoming_call_answer_and_remote_hangup(int slot_id)
{
int res = 0;
judge_data_init();
test_case_data_init();
judge_data.expect = NEW_CALL_INCOMING;

remote_call_operation(slot_id, phone_num, INCOMING_CALL);
if (judge()) {
syslog(LOG_ERR, "No incoming call message received in %s", __func__);
res = -1;
goto on_exit;
}

if (judge_data.result) {
syslog(LOG_ERR, "Unsolicited message error in %s", __func__);
if (remote_operation_call_incoming_test(slot_id) < 0) {
syslog(LOG_ERR, "Incoming call fail in %s", __func__);
res = -1;
goto on_exit;
}
Expand Down Expand Up @@ -3728,17 +3697,8 @@ int call_connect_and_local_hangup(int slot_id)
}

sleep(5);
judge_data_init();
judge_data.expect = CALL_STATE_CHANGE_TO_ACTIVE;
remote_call_operation(slot_id, phone_num, ACTIVE_CALL);
if (judge()) {
syslog(LOG_ERR, "No active call message received in %s", __func__);
res = -1;
goto on_exit;
}

if (judge_data.result) {
syslog(LOG_ERR, "Unsolicited message error in %s", __func__);
if (remote_operation_call_active_test(slot_id) < 0) {
syslog(LOG_ERR, "remote call active fail in %s", __func__);
res = -1;
goto on_exit;
}
Expand Down Expand Up @@ -3832,4 +3792,4 @@ void incoming_another_call(void)
{
test_case_data_init();
set_callback_data(NEW_CALL_WAITING);
}
}

0 comments on commit 37ecb5c

Please sign in to comment.