summaryrefslogtreecommitdiff
path: root/android/tester-bluetooth.c
diff options
context:
space:
mode:
authorJakub Tyszkowski <jakub.tyszkowski@tieto.com>2014-07-15 10:24:55 +0200
committerSzymon Janc <szymon.janc@tieto.com>2014-07-16 16:40:34 +0200
commita64610e3d247afc8de4ef94c3fe19cacdf781d9f (patch)
treed2b017c6c66fb3c4244deb2441d387a87e3f60f2 /android/tester-bluetooth.c
parent61fd708888c9ee8b2a83255ff83fa69445d39488 (diff)
downloadbluez-a64610e3d247afc8de4ef94c3fe19cacdf781d9f.tar.gz
android/tester-ng: Add various property set fail cases
These cases should fail as they are read only props.
Diffstat (limited to 'android/tester-bluetooth.c')
-rw-r--r--android/tester-bluetooth.c225
1 files changed, 225 insertions, 0 deletions
diff --git a/android/tester-bluetooth.c b/android/tester-bluetooth.c
index 6c05620d2..ce777b0fb 100644
--- a/android/tester-bluetooth.c
+++ b/android/tester-bluetooth.c
@@ -309,6 +309,224 @@ static struct test_case bluetooth_getprop_bdname_success_tc = {
bluetooth_getprop_bdname_success_steps),
};
+
+static unsigned char setprop_uuids[] = { 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00,
+ 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00 };
+
+static bt_property_t setprop_uuid_prop = {
+ .type = BT_PROPERTY_UUIDS,
+ .val = &setprop_uuids,
+ .len = sizeof(setprop_uuids),
+};
+
+static struct step bluetooth_setprop_uuid_fail_steps[] = {
+ {
+ .action_result.status = BT_STATUS_SUCCESS,
+ .action = bluetooth_enable_action,
+ },
+ {
+ .callback = CB_BT_ADAPTER_STATE_CHANGED,
+ .callback_result.state = BT_STATE_ON,
+ },
+ {
+ .action_result.status = BT_STATUS_FAIL,
+ .set_data = &setprop_uuid_prop,
+ .action = bt_set_property_action,
+ },
+};
+static struct test_case bluetooth_setprop_uuid_fail_tc = {
+ .step = bluetooth_setprop_uuid_fail_steps,
+ .title = "Bluetooth Set UUID - Fail",
+ .step_num = get_test_case_step_num(bluetooth_setprop_uuid_fail_steps),
+};
+
+static uint32_t setprop_cod_val = 0;
+
+static bt_property_t setprop_cod_prop = {
+ .type = BT_PROPERTY_CLASS_OF_DEVICE,
+ .val = &setprop_cod_val,
+ .len = sizeof(setprop_cod_val),
+};
+
+static struct step bluetooth_setprop_cod_fail_steps[] = {
+ {
+ .action_result.status = BT_STATUS_SUCCESS,
+ .action = bluetooth_enable_action,
+ },
+ {
+ .callback = CB_BT_ADAPTER_STATE_CHANGED,
+ .callback_result.state = BT_STATE_ON,
+ },
+ {
+ .action_result.status = BT_STATUS_FAIL,
+ .set_data = &setprop_cod_prop,
+ .action = bt_set_property_action,
+ },
+};
+static struct test_case bluetooth_setprop_cod_fail_tc = {
+ .step = bluetooth_setprop_cod_fail_steps,
+ .title = "Bluetooth Set CLASS_OF_DEVICE - Fail",
+ .step_num = get_test_case_step_num(bluetooth_setprop_cod_fail_steps),
+};
+
+static uint32_t setprop_tod_val = BT_DEVICE_DEVTYPE_DUAL;
+
+static bt_property_t setprop_tod_prop = {
+ .type = BT_PROPERTY_TYPE_OF_DEVICE,
+ .val = &setprop_tod_val,
+ .len = sizeof(setprop_tod_val),
+};
+
+static struct step bluetooth_setprop_tod_fail_steps[] = {
+ {
+ .action_result.status = BT_STATUS_SUCCESS,
+ .action = bluetooth_enable_action,
+ },
+ {
+ .callback = CB_BT_ADAPTER_STATE_CHANGED,
+ .callback_result.state = BT_STATE_ON,
+ },
+ {
+ .action_result.status = BT_STATUS_FAIL,
+ .set_data = &setprop_tod_prop,
+ .action = bt_set_property_action,
+ },
+};
+static struct test_case bluetooth_setprop_tod_fail_tc = {
+ .step = bluetooth_setprop_tod_fail_steps,
+ .title = "Bluetooth Set TYPE_OF_DEVICE - Fail",
+ .step_num = get_test_case_step_num(bluetooth_setprop_tod_fail_steps),
+};
+
+static int32_t setprop_remote_rssi_val = -9;
+
+static bt_property_t setprop_remote_rssi_prop = {
+ .type = BT_PROPERTY_REMOTE_RSSI,
+ .val = &setprop_remote_rssi_val,
+ .len = sizeof(setprop_remote_rssi_val),
+};
+
+static struct step bluetooth_setprop_remote_rssi_fail_steps[] = {
+ {
+ .action_result.status = BT_STATUS_SUCCESS,
+ .action = bluetooth_enable_action,
+ },
+ {
+ .callback = CB_BT_ADAPTER_STATE_CHANGED,
+ .callback_result.state = BT_STATE_ON,
+ },
+ {
+ .action_result.status = BT_STATUS_FAIL,
+ .set_data = &setprop_remote_rssi_prop,
+ .action = bt_set_property_action,
+ },
+};
+static struct test_case bluetooth_setprop_remote_rssi_fail_tc = {
+ .step = bluetooth_setprop_remote_rssi_fail_steps,
+ .title = "Bluetooth Set REMOTE_RSSI - Fail",
+ .step_num = get_test_case_step_num(
+ bluetooth_setprop_remote_rssi_fail_steps),
+};
+
+static bt_service_record_t setprop_srvc_record_val = {
+ .uuid = { {0x00} },
+ .channel = 12,
+ .name = "bt_name",
+};
+
+static bt_property_t setprop_srvc_record_prop = {
+ .type = BT_PROPERTY_SERVICE_RECORD,
+ .val = &setprop_srvc_record_val,
+ .len = sizeof(setprop_srvc_record_val),
+};
+
+static struct step bluetooth_setprop_srvc_record_fail_steps[] = {
+ {
+ .action_result.status = BT_STATUS_SUCCESS,
+ .action = bluetooth_enable_action,
+ },
+ {
+ .callback = CB_BT_ADAPTER_STATE_CHANGED,
+ .callback_result.state = BT_STATE_ON,
+ },
+ {
+ .action_result.status = BT_STATUS_FAIL,
+ .set_data = &setprop_srvc_record_prop,
+ .action = bt_set_property_action,
+ },
+};
+static struct test_case bluetooth_setprop_srvc_record_fail_tc = {
+ .step = bluetooth_setprop_srvc_record_fail_steps,
+ .title = "Bluetooth Set SERVICE_RECORD - Fail",
+ .step_num = get_test_case_step_num(
+ bluetooth_setprop_srvc_record_fail_steps),
+};
+
+static bt_bdaddr_t setprop_bdaddr_val = {
+ .address = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
+};
+
+static bt_property_t setprop_bdaddr_prop = {
+ .type = BT_PROPERTY_BDADDR,
+ .val = &setprop_bdaddr_val,
+ .len = sizeof(setprop_bdaddr_val),
+};
+
+static struct step bluetooth_setprop_bdaddr_fail_steps[] = {
+ {
+ .action_result.status = BT_STATUS_SUCCESS,
+ .action = bluetooth_enable_action,
+ },
+ {
+ .callback = CB_BT_ADAPTER_STATE_CHANGED,
+ .callback_result.state = BT_STATE_ON,
+ },
+ {
+ .action_result.status = BT_STATUS_FAIL,
+ .set_data = &setprop_bdaddr_prop,
+ .action = bt_set_property_action,
+ },
+};
+static struct test_case bluetooth_setprop_bdaddr_fail_tc = {
+ .step = bluetooth_setprop_bdaddr_fail_steps,
+ .title = "Bluetooth Set BDADDR - Fail",
+ .step_num = get_test_case_step_num(
+ bluetooth_setprop_bdaddr_fail_steps),
+};
+
+static bt_bdaddr_t setprop_bonded_dev_val = {
+ .address = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 },
+};
+
+static bt_property_t setprop_bonded_dev_prop = {
+ .type = BT_PROPERTY_ADAPTER_BONDED_DEVICES,
+ .val = &setprop_bonded_dev_val,
+ .len = sizeof(setprop_bonded_dev_val),
+};
+
+static struct step bluetooth_setprop_bonded_dev_fail_steps[] = {
+ {
+ .action_result.status = BT_STATUS_SUCCESS,
+ .action = bluetooth_enable_action,
+ },
+ {
+ .callback = CB_BT_ADAPTER_STATE_CHANGED,
+ .callback_result.state = BT_STATE_ON,
+ },
+ {
+ .action_result.status = BT_STATUS_FAIL,
+ .set_data = &setprop_bonded_dev_prop,
+ .action = bt_set_property_action,
+ },
+};
+static struct test_case bluetooth_setprop_bonded_dev_fail_tc = {
+ .step = bluetooth_setprop_bonded_dev_fail_steps,
+ .title = "Bluetooth Set BONDED_DEVICES - Fail",
+ .step_num = get_test_case_step_num(
+ bluetooth_setprop_bonded_dev_fail_steps),
+};
+
static struct test_case *test_cases[] = {
&bluetooth_init,
&bluetooth_enable_success_tc,
@@ -319,6 +537,13 @@ static struct test_case *test_cases[] = {
&bluetooth_setprop_disctimeout_success_tc,
&bluetooth_getprop_bdaddr_success_tc,
&bluetooth_getprop_bdname_success_tc,
+ &bluetooth_setprop_uuid_fail_tc,
+ &bluetooth_setprop_cod_fail_tc,
+ &bluetooth_setprop_tod_fail_tc,
+ &bluetooth_setprop_remote_rssi_fail_tc,
+ &bluetooth_setprop_srvc_record_fail_tc,
+ &bluetooth_setprop_bdaddr_fail_tc,
+ &bluetooth_setprop_bonded_dev_fail_tc,
};
struct queue *get_bluetooth_tests(void)