summaryrefslogtreecommitdiff
path: root/unit/test-mgmt.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-12-05 14:55:12 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-12-12 12:24:11 -0200
commit329c7184d8818079ca6230e91f3228212cbde0c1 (patch)
tree4bb12d086835efff5de6706f791bb4e37fa9aa69 /unit/test-mgmt.c
parent601b3c6c07bba780e901d74242a416bc73276842 (diff)
downloadbluez-329c7184d8818079ca6230e91f3228212cbde0c1.tar.gz
unit/test-mgmt: Add /mgmt/event/2 test
This tests if multiple events can be received.
Diffstat (limited to 'unit/test-mgmt.c')
-rw-r--r--unit/test-mgmt.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/unit/test-mgmt.c b/unit/test-mgmt.c
index a610d1a0a..331ee42ef 100644
--- a/unit/test-mgmt.c
+++ b/unit/test-mgmt.c
@@ -314,6 +314,9 @@ static void event_cb(uint16_t index, uint16_t length, const void *param,
{
struct context *context = user_data;
+ if (g_test_verbose())
+ printf("Event received\n");
+
context_quit(context);
}
@@ -331,6 +334,22 @@ static void test_event(gconstpointer data)
execute_context(context);
}
+static void test_event2(gconstpointer data)
+{
+ const struct command_test_data *test = data;
+ struct context *context = create_context();
+
+ mgmt_register(context->mgmt_client, test->opcode, test->index,
+ event_cb, context, NULL);
+ mgmt_register(context->mgmt_client, test->opcode, test->index,
+ event_cb, context, NULL);
+
+ g_assert_cmpint(write(context->fd, test->cmd_data, test->cmd_size), ==,
+ test->cmd_size);
+
+ execute_context(context);
+}
+
int main(int argc, char *argv[])
{
g_test_init(&argc, &argv, NULL);
@@ -344,6 +363,7 @@ int main(int argc, char *argv[])
test_response);
g_test_add_data_func("/mgmt/event/1", &event_test_1, test_event);
+ g_test_add_data_func("/mgmt/event/2", &event_test_1, test_event2);
return g_test_run();
}