5 * Copyright (C) 2007-2012 Intel Corporation. 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
24 #include <connman/dbus.h>
26 #include "../src/connman.h"
35 typedef void (* util_test_func_t) (struct test_fix *fix);
41 DBusConnection *main_connection;
43 unsigned int manager_watch;
45 struct test_manager manager;
46 util_test_func_t manager_changed;
48 /* session test cases */
49 unsigned int max_sessions;
50 struct test_session *session;
53 void util_quit_loop(struct test_fix *fix);
54 void util_idle_call(struct test_fix *fix, util_test_func_t func,
55 util_test_func_t destroy);
56 void util_call(struct test_fix *fix, util_test_func_t func,
57 util_test_func_t destroy);
58 void util_test_add(const char *test_name, util_test_func_t test,
59 util_test_func_t setup,
60 util_test_func_t teardown);
61 void util_setup(struct test_fix *fix);
62 void util_teardown(struct test_fix *fix);
64 void util_session_create(struct test_fix *fix, unsigned int max_sessions);
65 void util_session_destroy(struct test_fix *fix);
66 void util_session_init(struct test_session *session);
67 void util_session_cleanup(struct test_session *session);
69 typedef void (* notify_func_t) (struct test_session *session);
71 enum connman_session_state {
72 CONNMAN_SESSION_STATE_DISCONNECTED = 0,
73 CONNMAN_SESSION_STATE_CONNECTED = 1,
74 CONNMAN_SESSION_STATE_ONLINE = 2,
77 struct test_session_info {
78 enum connman_session_state state;
82 enum connman_session_type type;
83 /* ipv4, ipv6 dicts */
84 GSList *allowed_bearers;
91 DBusConnection *connection;
97 struct test_session_info *info;
100 struct test_bearer_info {
105 void bearer_info_cleanup(gpointer bearer_info, gpointer user_data);
107 void session_append_settings(DBusMessageIter *dict,
108 struct test_session_info *info);
109 int session_notify_register(struct test_session *session,
110 const char *notify_path);
111 int session_notify_unregister(struct test_session *session,
112 const char *notify_path);
114 DBusMessage *session_connect(DBusConnection *connection,
115 struct test_session *session);
116 DBusMessage *session_disconnect(DBusConnection *connection,
117 struct test_session *session);
120 DBusMessage *manager_get_services(DBusConnection *connection);
121 DBusMessage *manager_get_properties(DBusConnection *connection);
122 DBusMessage *manager_create_session(DBusConnection *connection,
123 struct test_session_info *info,
124 const char *notifier_path);
125 DBusMessage *manager_destroy_session(DBusConnection *connection,
126 const char *notifier_path);
127 DBusMessage *manager_set_session_mode(DBusConnection *connection,
129 int manager_parse_properties(DBusMessage *msg,
130 struct test_manager *manager);
136 #define LOG(fmt, arg...) do { \
137 fprintf(stdout, "%s:%s() " fmt "\n", \
138 __FILE__, __FUNCTION__ , ## arg); \
141 #define LOG(fmt, arg...)