Improve gdbus test coverage
[platform/upstream/glib.git] / gio / tests / gdbus-introspection.c
index cbba696..f2b268d 100644 (file)
@@ -107,7 +107,6 @@ test_introspection_parser (void)
   GDBusProxy *proxy;
   GDBusConnection *connection;
   GError *error;
-  gchar *path;
 
   error = NULL;
   connection = g_bus_get_sync (G_BUS_TYPE_SESSION,
@@ -126,9 +125,7 @@ test_introspection_parser (void)
   g_assert_no_error (error);
 
   /* this is safe; testserver will exit once the bus goes away */
-  path = g_test_build_filename (G_TEST_BUILT, "gdbus-testserver", NULL);
-  g_assert (g_spawn_command_line_async (path, NULL));
-  g_free (path);
+  g_assert (g_spawn_command_line_async (g_test_get_filename (G_TEST_BUILT, "gdbus-testserver", NULL), NULL));
 
   _g_assert_property_notify (proxy, "g-name-owner");
 
@@ -262,10 +259,6 @@ test_default_direction (void)
   g_dbus_node_info_unref (info);
 }
 
-#if 0
-/* XXX: need to figure out how generous we want to be here */
-/* test that extraneous attributes are ignored
- */
 static void
 test_extra_data (void)
 {
@@ -273,11 +266,18 @@ test_extra_data (void)
   const gchar *data =
   "  <node>"
   "    <interface name='com.example.Frob' version='1.0'>"
-  "      <annotation name='foo' value='bar' extra='bla'/>"
-  "      <method name='PairReturn' anotherattribute='bla'>"
-  "        <annotation name='org.freedesktop.DBus.GLib.Async' value=''/>"
-  "        <arg type='u' name='somenumber' direction='in' spin='left'/>"
-  "        <arg type='s' name='somestring' direction='out'/>"
+  "      <doc:doc><doc:description><doc:para>Blah blah</doc:para></doc:description></doc:doc>"
+  "      <method name='DownloadPackages'>"
+  "        <arg type='u' name='somenumber' direction='in'>"
+  "          <doc:doc><doc:summary><doc:para>"
+  "            See <doc:ulink url='http:///example.com'>example</doc:ulink>"
+  "          </doc:para></doc:summary></doc:doc>"
+  "        </arg>"
+  "        <arg type='s' name='somestring' direction='out'>"
+  "          <doc:doc><doc:summary><doc:para>"
+  "            More docs"
+  "          </doc:para></doc:summary></doc:doc>"
+  "        </arg>"
   "      </method>"
   "      <signal name='HelloWorld'>"
   "        <arg type='s' name='somestring'/>"
@@ -296,7 +296,6 @@ test_extra_data (void)
 
   g_dbus_node_info_unref (info);
 }
-#endif
 
 /* ---------------------------------------------------------------------------------------------------- */
 
@@ -311,19 +310,15 @@ main (int   argc,
   /* all the tests rely on a shared main loop */
   loop = g_main_loop_new (NULL, FALSE);
 
-  session_bus_up ();
-
   g_test_add_func ("/gdbus/introspection-parser", test_introspection_parser);
   g_test_add_func ("/gdbus/introspection-generate", test_generate);
   g_test_add_func ("/gdbus/introspection-default-direction", test_default_direction);
-#if 0
-  /* XXX: need to figure out how generous we want to be here */
   g_test_add_func ("/gdbus/introspection-extra-data", test_extra_data);
-#endif
 
-  ret = g_test_run ();
+  ret = session_bus_run ();
 
-  session_bus_down ();
+  while (g_main_context_iteration (NULL, FALSE));
+  g_main_loop_unref (loop);
 
   return ret;
 }