5 * Copyright (C) 2011 BWM CarIT GmbH. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 #include "gdbus/gdbus.h"
28 #include "test-connman.h"
30 static gboolean test_empty(gpointer data)
32 struct test_fix *fix = data;
34 util_idle_call(fix, util_quit_loop, NULL);
39 static void set_session_mode(struct test_fix *fix,
40 connman_bool_t enable)
44 msg = manager_set_session_mode(fix->main_connection, enable);
45 g_assert(msg != NULL);
46 g_assert(dbus_message_get_type(msg) != DBUS_MESSAGE_TYPE_ERROR);
48 dbus_message_unref(msg);
50 util_idle_call(fix, util_quit_loop, NULL);
53 static gboolean enable_session_mode(gpointer data)
55 struct test_fix *fix = data;
57 set_session_mode(fix, TRUE);
62 static gboolean disable_session_mode(gpointer data)
64 struct test_fix *fix = data;
66 set_session_mode(fix, FALSE);
71 static void setup_cb(struct test_fix *fix, gconstpointer data)
73 util_setup(fix, data);
75 util_call(fix, enable_session_mode, NULL);
76 g_main_loop_run(fix->main_loop);
79 static void teardown_cb(struct test_fix *fix, gconstpointer data)
81 util_call(fix, disable_session_mode, NULL);
82 g_main_loop_run(fix->main_loop);
84 util_teardown(fix, data);
87 int main(int argc, char *argv[])
89 g_test_init(&argc, &argv, NULL);
91 util_test_add("/empty",
92 test_empty, setup_cb, teardown_cb);