diff --git a/android/android-tester.c b/android/android-tester.c
index a259b56..25b0444 100644
--- a/android/android-tester.c
+++ b/android/android-tester.c
.expected_status = BT_STATUS_PARM_INVALID,
};
+static const struct socket_data btsock_inv_listen_listen = {
+ .sock_type = BTSOCK_RFCOMM,
+ .channel = 1,
+ .service_uuid = NULL,
+ .service_name = "Test service",
+ .flags = 0,
+ .expected_status = BT_STATUS_FAIL,
+ .test_channel = true,
+};
+
static void setup_socket_interface(const void *test_data)
{
struct test_data *data = tester_get_data();
}
+static void test_listen_listen(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_fd1 = -1, sock_fd2 = -1;
+
+ status = data->if_sock->listen(test->sock_type,
+ test->service_name, test->service_uuid,
+ test->channel, &sock_fd1, test->flags);
+ if (status != BT_STATUS_SUCCESS) {
+ tester_warn("sock->listen() failed");
+ tester_test_failed();
+ goto clean;
+ }
+
+ status = data->if_sock->listen(test->sock_type,
+ test->service_name, test->service_uuid,
+ test->channel, &sock_fd2, test->flags);
+ if (status != test->expected_status) {
+ tester_warn("sock->listen() failed, status %d", status);
+ tester_test_failed();
+ goto clean;
+ }
+
+ tester_print("status after second listen(): %d", status);
+
+ tester_test_passed();
+
+clean:
+ if (sock_fd1 >= 0)
+ close(sock_fd1);
+
+ if (sock_fd2 >= 0)
+ close(sock_fd2);
+}
+
static void test_generic_connect(const void *test_data)
{
struct test_data *data = tester_get_data();
&btsock_success_check_chan,
setup_socket_interface, test_listen_close, teardown);
+ test_bredrle("Socket Listen - Invalid: double Listen",
+ &btsock_inv_listen_listen,
+ setup_socket_interface, test_listen_listen, teardown);
+
test_bredrle("Socket Connect - Invalid: sock_type 0",
&btsock_inv_param_socktype, setup_socket_interface,
test_generic_connect, teardown);