diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2011-06-07 15:42:22 +0200 |
---|---|---|
committer | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2011-06-07 15:42:57 +0200 |
commit | 8d4d7d8f395714721f4137e89dd9dc320da0e2de (patch) | |
tree | 5e3ae15cbba10701ad8f01d071d066a38acb9eee | |
parent | 237f8824bd0fe26951eebdf7b77eb9dd175d22bc (diff) | |
download | connman-8d4d7d8f395714721f4137e89dd9dc320da0e2de.tar.gz connman-8d4d7d8f395714721f4137e89dd9dc320da0e2de.tar.bz2 connman-8d4d7d8f395714721f4137e89dd9dc320da0e2de.zip |
unit: Add create session test
Create a complete session, that is with proper notification object.
-rw-r--r-- | unit/test-session.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/unit/test-session.c b/unit/test-session.c index b129326f..91662dac 100644 --- a/unit/test-session.c +++ b/unit/test-session.c @@ -84,6 +84,41 @@ static gboolean test_session_destroy_no_notify(gpointer data) return FALSE; } +static void test_session_create_notify(struct test_session *session) +{ + LOG("session %p", session); + + g_assert(is_connman_running(session->connection) == TRUE); + util_idle_call(session->fix, util_quit_loop, util_session_destroy); +} + +static gboolean test_session_create(gpointer data) +{ + struct test_fix *fix = data; + struct test_session *session; + DBusMessage *msg; + int err; + + util_session_create(fix, 1); + session = fix->session; + + session->notify_path = "/foo"; + session->notify = test_session_create_notify; + + err = session_notify_register(session, session->notify_path); + g_assert(err == 0); + + msg = manager_create_session(session->connection, + session->info, + session->notify_path); + g_assert(msg != NULL); + g_assert(dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_ERROR); + + dbus_message_unref(msg); + + return FALSE; +} + static void set_session_mode(struct test_fix *fix, connman_bool_t enable) { @@ -140,6 +175,8 @@ int main(int argc, char *argv[]) test_session_create_no_notify, setup_cb, teardown_cb); util_test_add("/manager/session destroy no notify", test_session_destroy_no_notify, setup_cb, teardown_cb); + util_test_add("/manager/session create", + test_session_create, setup_cb, teardown_cb); return g_test_run(); } |