diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2014-08-11 11:52:48 +0300 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2014-08-11 18:01:31 +0300 |
commit | 39805a5a4d886a0bf9aed6a3aedaf1727ffcae8d (patch) | |
tree | c539c4b5dd60f0bff7221d53bc89d7dc454961b4 /android/tester-a2dp.c | |
parent | 066eaa2ab6dc480ebd15a8f65d4cac2118d0d252 (diff) | |
download | bluez-39805a5a4d886a0bf9aed6a3aedaf1727ffcae8d.tar.gz |
android/tester: Add A2DP Resume - Success test case
Diffstat (limited to 'android/tester-a2dp.c')
-rw-r--r-- | android/tester-a2dp.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/android/tester-a2dp.c b/android/tester-a2dp.c index ecb074035..6757d7537 100644 --- a/android/tester-a2dp.c +++ b/android/tester-a2dp.c @@ -45,6 +45,8 @@ static const uint8_t req_open[] = { 0x30, 0x06, 0x04 }; static const uint8_t rsp_open[] = { 0x32, 0x06 }; static const uint8_t req_close[] = { 0x40, 0x08, 0x04 }; static const uint8_t rsp_close[] = { 0x42, 0x08 }; +static const uint8_t req_start[] = { 0x40, 0x07, 0x04 }; +static const uint8_t rsp_start[] = { 0x42, 0x07 }; const struct pdu { const uint8_t *req; @@ -57,6 +59,7 @@ const struct pdu { { req_cfg, sizeof(req_cfg), rsp_cfg, sizeof(rsp_cfg) }, { req_open, sizeof(req_open), rsp_open, sizeof(rsp_open) }, { req_close, sizeof(req_close), rsp_close, sizeof(rsp_close) }, + { req_start, sizeof(req_start), rsp_start, sizeof(rsp_start) }, { }, }; @@ -141,6 +144,30 @@ static void a2dp_disconnect_action(void) schedule_action_verification(step); } +static void audio_resume_action(void) +{ + struct test_data *data = tester_get_data(); + struct step *step = g_new0(struct step, 1); + int err; + + err = data->audio->open_output_stream(data->audio, + 0, + AUDIO_DEVICE_OUT_ALL_A2DP, + AUDIO_OUTPUT_FLAG_NONE, + NULL, + &data->if_stream); + if (err < 0) { + step->action_status = BT_STATUS_FAIL; + goto done; + } + + /* Write something to force resume */ + data->if_stream->write(data->if_stream, &err, sizeof(err)); + +done: + schedule_action_verification(step); +} + static struct test_case test_cases[] = { TEST_CASE_BREDRLE("A2DP Init", ACTION_SUCCESS(dummy_action, NULL), @@ -180,6 +207,25 @@ static struct test_case test_cases[] = { ACTION_SUCCESS(bluetooth_disable_action, NULL), CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF), ), + TEST_CASE_BREDRLE("A2DP Resume - Success", + ACTION_SUCCESS(bluetooth_enable_action, NULL), + CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_ON), + ACTION_SUCCESS(emu_setup_powered_remote_action, NULL), + ACTION_SUCCESS(emu_set_ssp_mode_action, NULL), + ACTION_SUCCESS(emu_add_l2cap_server_action, &l2cap_setup_data), + ACTION_SUCCESS(a2dp_connect_action, NULL), + CALLBACK_AV_CONN_STATE(CB_A2DP_CONN_STATE, + BTAV_CONNECTION_STATE_CONNECTING), + CALLBACK_AV_CONN_STATE(CB_A2DP_CONN_STATE, + BTAV_CONNECTION_STATE_CONNECTED), + ACTION_SUCCESS(audio_resume_action, NULL), + CALLBACK_AV_AUDIO_STATE(CB_A2DP_AUDIO_STATE, + BTAV_AUDIO_STATE_STARTED), + ACTION_SUCCESS(bluetooth_disable_action, NULL), + CALLBACK_AV_CONN_STATE(CB_A2DP_CONN_STATE, + BTAV_CONNECTION_STATE_DISCONNECTED), + CALLBACK_STATE(CB_BT_ADAPTER_STATE_CHANGED, BT_STATE_OFF), + ), }; struct queue *get_a2dp_tests(void) |