diff options
author | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2011-06-07 15:42:21 +0200 |
---|---|---|
committer | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2011-06-07 15:42:57 +0200 |
commit | fb05be513ce9d3d146717199b3464e2199b05f94 (patch) | |
tree | b192e4ac158943d5f9f02793689bb9f589feae90 | |
parent | a943b07d27a6a97ea0f89ad3349dbb33e39db68f (diff) | |
download | connman-fb05be513ce9d3d146717199b3464e2199b05f94.tar.gz connman-fb05be513ce9d3d146717199b3464e2199b05f94.tar.bz2 connman-fb05be513ce9d3d146717199b3464e2199b05f94.zip |
unit: Toggle SessionMode for each test case
-rw-r--r-- | unit/test-session.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/unit/test-session.c b/unit/test-session.c index aaed275e..d0f232e9 100644 --- a/unit/test-session.c +++ b/unit/test-session.c @@ -36,13 +36,51 @@ static gboolean test_empty(gpointer data) return FALSE; } +static void set_session_mode(struct test_fix *fix, + connman_bool_t enable) +{ + DBusMessage *msg; + + msg = manager_set_session_mode(fix->main_connection, enable); + g_assert(msg != NULL); + g_assert(dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_ERROR); + + dbus_message_unref(msg); + + util_idle_call(fix, util_quit_loop, NULL); +} + +static gboolean enable_session_mode(gpointer data) +{ + struct test_fix *fix = data; + + set_session_mode(fix, TRUE); + + return FALSE; +} + +static gboolean disable_session_mode(gpointer data) +{ + struct test_fix *fix = data; + + set_session_mode(fix, FALSE); + + return FALSE; +} + static void setup_cb(struct test_fix *fix, gconstpointer data) { util_setup(fix, data); + + util_call(fix, enable_session_mode, NULL); + g_main_loop_run(fix->main_loop); } static void teardown_cb(struct test_fix *fix, gconstpointer data) { + util_call(fix, disable_session_mode, NULL); + g_main_loop_run(fix->main_loop); + util_teardown(fix, data); } |