Remove g_type_init() calls
[platform/upstream/glib.git] / gio / tests / gdbus-peer.c
index ca1cf13..0435597 100644 (file)
@@ -178,7 +178,7 @@ test_interface_method_call (GDBusConnection       *connection,
 
       error = NULL;
 
-      fd = open (path, O_RDONLY);
+      fd = g_open (path, O_RDONLY, 0);
       g_unix_fd_list_append (fd_list, fd, &error);
       g_assert_no_error (error);
       close (fd);
@@ -325,8 +325,11 @@ service_thread_func (gpointer user_data)
 {
   PeerData *data = user_data;
   GMainContext *service_context;
-  GDBusAuthObserver *observer;
+  GDBusAuthObserver *observer, *o;
   GError *error;
+  GDBusServerFlags f;
+  gchar *a, *g;
+  gboolean b;
 
   service_context = g_main_context_new ();
   g_main_context_push_thread_default (service_context);
@@ -349,6 +352,25 @@ service_thread_func (gpointer user_data)
                     "authorize-authenticated-peer",
                     G_CALLBACK (on_authorize_authenticated_peer),
                     data);
+
+  g_assert_cmpint (g_dbus_server_get_flags (server), ==, G_DBUS_SERVER_FLAGS_NONE);
+  g_assert_cmpstr (g_dbus_server_get_guid (server), ==, test_guid);
+  g_object_get (server,
+                "flags", &f,
+                "address", &a,
+                "guid", &g,
+                "active", &b,
+                "authentication-observer", &o,
+                NULL);
+  g_assert_cmpint (f, ==, G_DBUS_SERVER_FLAGS_NONE);
+  g_assert_cmpstr (a, ==, tmp_address);
+  g_assert_cmpstr (g, ==, test_guid);
+  g_assert (!b);
+  g_assert (o == observer);
+  g_free (a);
+  g_free (g);
+  g_object_unref (o);
+
   g_object_unref (observer);
 
   g_dbus_server_start (server);
@@ -1779,11 +1801,8 @@ main (int   argc,
   GDBusNodeInfo *introspection_data = NULL;
   gchar *tmpdir = NULL;
 
-  g_type_init ();
   g_test_init (&argc, &argv, NULL);
 
-  g_unsetenv ("DBUS_SESSION_BUS_ADDRESS");
-
   introspection_data = g_dbus_node_info_new_for_xml (test_interface_introspection_xml, NULL);
   g_assert (introspection_data != NULL);
   test_interface_introspection_data = introspection_data->interfaces[0];