- guint watcher_id;
-
- session_bus_up ();
-
- watcher_id = g_bus_watch_proxy (G_BUS_TYPE_SESSION,
- "com.example.TestService",
- G_BUS_NAME_WATCHER_FLAGS_NONE,
- "/com/example/TestObject",
- "com.example.Frob",
- G_TYPE_DBUS_PROXY,
- G_DBUS_PROXY_FLAGS_NONE,
- introspection_on_proxy_appeared,
- introspection_on_proxy_vanished,
- NULL,
- NULL);
-
- /* TODO: wait a bit for the bus to come up.. ideally session_bus_up() won't return
- * until one can connect to the bus but that's not how things work right now
- */
- usleep (500 * 1000);
- /* this is safe; testserver will exit once the bus goes away */
- g_assert (g_spawn_command_line_async (SRCDIR "/gdbus-testserver.py", NULL));
+ GDBusNodeInfo *info;
+ GDBusNodeInfo *info2;
+ GDBusInterfaceInfo *iinfo;
+ GDBusMethodInfo *minfo;
+ GDBusSignalInfo *sinfo;
+ GDBusArgInfo *arginfo;
+ GDBusPropertyInfo *pinfo;
+ GDBusAnnotationInfo *aninfo;
+ const gchar *data =
+ " <node>"
+ " <interface name='com.example.Frob'>"
+ " <annotation name='foo' value='bar'/>"
+ " <method name='PairReturn'>"
+ " <annotation name='org.freedesktop.DBus.GLib.Async' value=''/>"
+ " <arg type='u' name='somenumber' direction='in'/>"
+ " <arg type='s' name='somestring' direction='out'/>"
+ " </method>"
+ " <signal name='HelloWorld'>"
+ " <arg type='s' name='greeting' direction='out'/>"
+ " </signal>"
+ " <method name='Sleep'>"
+ " <arg type='i' name='timeout' direction='in'/>"
+ " </method>"
+ " <property name='y' type='y' access='readwrite'>"
+ " <annotation name='needs-escaping' value='bar<>'"'/>"
+ " </property>"
+ " </interface>"
+ " </node>";
+
+ GString *string;
+ GString *string2;
+ GError *error;
+
+ error = NULL;
+ info = g_dbus_node_info_new_for_xml (data, &error);
+ g_assert_no_error (error);
+
+ iinfo = g_dbus_node_info_lookup_interface (info, "com.example.Frob");
+ aninfo = iinfo->annotations[0];
+ g_assert_cmpstr (aninfo->key, ==, "foo");
+ g_assert_cmpstr (aninfo->value, ==, "bar");
+ g_assert (iinfo->annotations[1] == NULL);
+ minfo = g_dbus_interface_info_lookup_method (iinfo, "PairReturn");
+ g_assert_cmpstr (g_dbus_annotation_info_lookup (minfo->annotations, "org.freedesktop.DBus.GLib.Async"), ==, "");
+ arginfo = minfo->in_args[0];
+ g_assert_cmpstr (arginfo->name, ==, "somenumber");
+ g_assert_cmpstr (arginfo->signature, ==, "u");
+ g_assert (minfo->in_args[1] == NULL);
+ arginfo = minfo->out_args[0];
+ g_assert_cmpstr (arginfo->name, ==, "somestring");
+ g_assert_cmpstr (arginfo->signature, ==, "s");
+ g_assert (minfo->out_args[1] == NULL);
+ sinfo = g_dbus_interface_info_lookup_signal (iinfo, "HelloWorld");
+ arginfo = sinfo->args[0];
+ g_assert_cmpstr (arginfo->name, ==, "greeting");
+ g_assert_cmpstr (arginfo->signature, ==, "s");
+ g_assert (sinfo->args[1] == NULL);
+ pinfo = g_dbus_interface_info_lookup_property (iinfo, "y");
+ g_assert_cmpstr (pinfo->signature, ==, "y");
+ g_assert_cmpint (pinfo->flags, ==, G_DBUS_PROPERTY_INFO_FLAGS_READABLE |
+ G_DBUS_PROPERTY_INFO_FLAGS_WRITABLE);