diff --git a/android/android-tester.c b/android/android-tester.c
index f4f8e9b..c7ffef0 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
btsock_type_t sock_type;
const char *service_name;
const uint8_t *service_uuid;
+ const bt_bdaddr_t *bdaddr;
int channel;
int flags;
bt_status_t expected_status;
/* Test Socket HAL */
+const bt_bdaddr_t bdaddr_dummy = {
+ .address = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55}
+};
+
static const struct socket_data btsock_inv_param_socktype = {
+ .bdaddr = &bdaddr_dummy,
.sock_type = 0,
.channel = 1,
.service_uuid = NULL,
close(sock_fd);
}
+static void test_generic_connect(const void *test_data)
+{
+ struct test_data *data = tester_get_data();
+ const struct socket_data *test = data->test_data;
+ bt_status_t status;
+ int sock_fd = -1;
+
+ status = data->if_sock->connect(test->bdaddr, test->sock_type,
+ test->service_uuid, test->channel,
+ &sock_fd, test->flags);
+ if (status != test->expected_status) {
+ tester_test_failed();
+ goto clean;
+ }
+
+ /* Check that file descriptor is valid */
+ if (status == BT_STATUS_SUCCESS && fcntl(sock_fd, F_GETFD) == -1) {
+ tester_test_failed();
+ return;
+ }
+
+ tester_test_passed();
+
+clean:
+ if (sock_fd >= 0)
+ close(sock_fd);
+}
+
#define test_bredrle(name, data, test_setup, test, test_teardown) \
do { \
struct test_data *user; \
&btsock_sucess,
setup_socket_interface, test_generic_listen, teardown);
+ test_bredrle("Test Socket Connect - Invalid: sock_type 0",
+ &btsock_inv_param_socktype, setup_socket_interface,
+ test_generic_connect, teardown);
+
return tester_run();
}