diff --git a/android/Makefile.am b/android/Makefile.am
index 23a04e3..76f81f3 100644
--- a/android/Makefile.am
+++ b/android/Makefile.am
monitor/rfcomm.h \
android/hardware/hardware.c \
android/tester-bluetooth.c \
+ android/tester-socket.c \
android/tester-main.h android/tester-main.c
android_android_tester_ng_CFLAGS = $(AM_CFLAGS) -I$(srcdir)/android \
diff --git a/android/tester-main.c b/android/tester-main.c
index 326853a..bbf7f2e 100644
--- a/android/tester-main.c
+++ b/android/tester-main.c
tester_setup_complete();
}
+static void setup_socket(const void *test_data)
+{
+ struct test_data *data = tester_get_data();
+ bt_status_t status;
+ const void *sock;
+
+ if (!setup_base(data)) {
+ tester_setup_failed();
+ return;
+ }
+
+ status = data->if_bluetooth->init(&bt_callbacks);
+ if (status != BT_STATUS_SUCCESS) {
+ data->if_bluetooth = NULL;
+ tester_setup_failed();
+ return;
+ }
+
+ sock = data->if_bluetooth->get_profile_interface(BT_PROFILE_SOCKETS_ID);
+ if (!sock) {
+ tester_setup_failed();
+ return;
+ }
+
+ data->if_sock = sock;
+
+ tester_setup_complete();
+}
+
static void teardown(const void *test_data)
{
struct test_data *data = tester_get_data();
static void tester_testcases_cleanup(void)
{
remove_bluetooth_tests();
+ remove_socket_tests();
}
static void add_bluetooth_tests(void *data, void *user_data)
test_bredrle(tc, setup, generic_test_function, teardown);
}
+static void add_socket_tests(void *data, void *user_data)
+{
+ struct test_case *tc = data;
+
+ test_bredrle(tc, setup_socket, generic_test_function, teardown);
+}
+
int main(int argc, char *argv[])
{
snprintf(exec_dir, sizeof(exec_dir), "%s", dirname(argv[0]));
tester_init(&argc, &argv);
queue_foreach(get_bluetooth_tests(), add_bluetooth_tests, NULL);
+ queue_foreach(get_socket_tests(), add_socket_tests, NULL);
if (tester_run())
return 1;
diff --git a/android/tester-main.h b/android/tester-main.h
index 6ea9603..37b3fd4 100644
--- a/android/tester-main.h
+++ b/android/tester-main.h
#include <hardware/hardware.h>
#include <hardware/bluetooth.h>
+#include <hardware/bt_sock.h>
#define get_test_case_step_num(tc) (sizeof(tc) / sizeof(struct step))
enum hciemu_type hciemu_type;
const bt_interface_t *if_bluetooth;
+ const btsock_interface_t *if_sock;
const void *test_data;
struct queue *steps;
/* Get, remove test cases API */
struct queue *get_bluetooth_tests(void);
void remove_bluetooth_tests(void);
+struct queue *get_socket_tests(void);
+void remove_socket_tests(void);
/* Actions */
void dummy_action(void);
diff --git a/android/tester-socket.c b/android/tester-socket.c
new file mode 100644
index 0000000..4b06b15
--- /dev/null
+++ b/android/tester-socket.c
+/*
+ * Copyright (C) 2014 Intel Corporation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "tester-main.h"
+
+static struct queue *list; /* List of socket test cases */
+
+struct queue *get_socket_tests(void)
+{
+ list = queue_new();
+
+ return list;
+}
+
+void remove_socket_tests(void)
+{
+ queue_destroy(list, NULL);
+}