diff options
Diffstat (limited to 'gio/tests')
-rw-r--r-- | gio/tests/gdbus-connection.c | 160 | ||||
-rw-r--r-- | gio/tests/gdbus-example-peer.c | 20 | ||||
-rw-r--r-- | gio/tests/gdbus-export.c | 252 | ||||
-rw-r--r-- | gio/tests/gdbus-introspection.c | 14 | ||||
-rw-r--r-- | gio/tests/gdbus-names.c | 40 | ||||
-rw-r--r-- | gio/tests/gdbus-peer.c | 44 | ||||
-rw-r--r-- | gio/tests/gdbus-proxy.c | 146 | ||||
-rw-r--r-- | gio/tests/gdbus-threading.c | 114 |
8 files changed, 395 insertions, 395 deletions
diff --git a/gio/tests/gdbus-connection.c b/gio/tests/gdbus-connection.c index 025de1d4c..266512f3e 100644 --- a/gio/tests/gdbus-connection.c +++ b/gio/tests/gdbus-connection.c @@ -118,9 +118,9 @@ msg_cb_expect_error_disconnected (GDBusConnection *connection, GVariant *result; error = NULL; - result = g_dbus_connection_invoke_method_finish (connection, - res, - &error); + result = g_dbus_connection_call_finish (connection, + res, + &error); g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CLOSED); g_assert (!g_dbus_error_is_remote_error (error)); g_error_free (error); @@ -138,9 +138,9 @@ msg_cb_expect_error_unknown_method (GDBusConnection *connection, GVariant *result; error = NULL; - result = g_dbus_connection_invoke_method_finish (connection, - res, - &error); + result = g_dbus_connection_call_finish (connection, + res, + &error); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD); g_assert (g_dbus_error_is_remote_error (error)); g_assert (result == NULL); @@ -157,9 +157,9 @@ msg_cb_expect_success (GDBusConnection *connection, GVariant *result; error = NULL; - result = g_dbus_connection_invoke_method_finish (connection, - res, - &error); + result = g_dbus_connection_call_finish (connection, + res, + &error); g_assert_no_error (error); g_assert (result != NULL); g_variant_unref (result); @@ -176,9 +176,9 @@ msg_cb_expect_error_cancelled (GDBusConnection *connection, GVariant *result; error = NULL; - result = g_dbus_connection_invoke_method_finish (connection, - res, - &error); + result = g_dbus_connection_call_finish (connection, + res, + &error); g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED); g_assert (!g_dbus_error_is_remote_error (error)); g_error_free (error); @@ -196,9 +196,9 @@ msg_cb_expect_error_cancelled_2 (GDBusConnection *connection, GVariant *result; error = NULL; - result = g_dbus_connection_invoke_method_finish (connection, - res, - &error); + result = g_dbus_connection_call_finish (connection, + res, + &error); g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED); g_assert (!g_dbus_error_is_remote_error (error)); g_error_free (error); @@ -229,67 +229,67 @@ test_connection_send (void) */ ca = g_cancellable_new (); g_cancellable_cancel (ca); - g_dbus_connection_invoke_method (c, - "org.freedesktop.DBus", /* bus_name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ - "GetId", /* method name */ - NULL, - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - ca, - (GAsyncReadyCallback) msg_cb_expect_error_cancelled, - NULL); + g_dbus_connection_call (c, + "org.freedesktop.DBus", /* bus_name */ + "/org/freedesktop/DBus", /* object path */ + "org.freedesktop.DBus", /* interface name */ + "GetId", /* method name */ + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + ca, + (GAsyncReadyCallback) msg_cb_expect_error_cancelled, + NULL); g_main_loop_run (loop); g_object_unref (ca); /* * Check that we get a reply to the GetId() method call. */ - g_dbus_connection_invoke_method (c, - "org.freedesktop.DBus", /* bus_name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ - "GetId", /* method name */ - NULL, - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - (GAsyncReadyCallback) msg_cb_expect_success, - NULL); + g_dbus_connection_call (c, + "org.freedesktop.DBus", /* bus_name */ + "/org/freedesktop/DBus", /* object path */ + "org.freedesktop.DBus", /* interface name */ + "GetId", /* method name */ + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + (GAsyncReadyCallback) msg_cb_expect_success, + NULL); g_main_loop_run (loop); /* * Check that we get an error reply to the NonExistantMethod() method call. */ - g_dbus_connection_invoke_method (c, - "org.freedesktop.DBus", /* bus_name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ - "NonExistantMethod", /* method name */ - NULL, - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - (GAsyncReadyCallback) msg_cb_expect_error_unknown_method, - NULL); + g_dbus_connection_call (c, + "org.freedesktop.DBus", /* bus_name */ + "/org/freedesktop/DBus", /* object path */ + "org.freedesktop.DBus", /* interface name */ + "NonExistantMethod", /* method name */ + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + (GAsyncReadyCallback) msg_cb_expect_error_unknown_method, + NULL); g_main_loop_run (loop); /* * Check that cancellation works when the message is already in flight. */ ca = g_cancellable_new (); - g_dbus_connection_invoke_method (c, - "org.freedesktop.DBus", /* bus_name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ - "GetId", /* method name */ - NULL, - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - ca, - (GAsyncReadyCallback) msg_cb_expect_error_cancelled_2, - NULL); + g_dbus_connection_call (c, + "org.freedesktop.DBus", /* bus_name */ + "/org/freedesktop/DBus", /* object path */ + "org.freedesktop.DBus", /* interface name */ + "GetId", /* method name */ + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + ca, + (GAsyncReadyCallback) msg_cb_expect_error_cancelled_2, + NULL); g_cancellable_cancel (ca); g_main_loop_run (loop); g_object_unref (ca); @@ -302,17 +302,17 @@ test_connection_send (void) _g_assert_signal_received (c, "closed"); g_assert (g_dbus_connection_is_closed (c)); - g_dbus_connection_invoke_method (c, - "org.freedesktop.DBus", /* bus_name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ - "GetId", /* method name */ - NULL, - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - (GAsyncReadyCallback) msg_cb_expect_error_disconnected, - NULL); + g_dbus_connection_call (c, + "org.freedesktop.DBus", /* bus_name */ + "/org/freedesktop/DBus", /* object path */ + "org.freedesktop.DBus", /* interface name */ + "GetId", /* method name */ + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + (GAsyncReadyCallback) msg_cb_expect_error_disconnected, + NULL); g_main_loop_run (loop); _g_object_wait_for_single_ref (c); @@ -456,16 +456,16 @@ test_connection_signals (void) * * To ensure this is not the case, do a synchronous call on c1. */ - result = g_dbus_connection_invoke_method_sync (c1, - "org.freedesktop.DBus", /* bus name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ - "GetId", /* method name */ - NULL, /* parameters */ - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - &error); + result = g_dbus_connection_call_sync (c1, + "org.freedesktop.DBus", /* bus name */ + "/org/freedesktop/DBus", /* object path */ + "org.freedesktop.DBus", /* interface name */ + "GetId", /* method name */ + NULL, /* parameters */ + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); g_assert_no_error (error); g_assert (result != NULL); g_variant_unref (result); diff --git a/gio/tests/gdbus-example-peer.c b/gio/tests/gdbus-example-peer.c index a1041d9c7..3a1385878 100644 --- a/gio/tests/gdbus-example-peer.c +++ b/gio/tests/gdbus-example-peer.c @@ -287,16 +287,16 @@ main (int argc, char *argv[]) g_dbus_connection_get_capabilities (connection) & G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING); greeting = g_strdup_printf ("Hey, it's %" G_GUINT64_FORMAT " already!", (guint64) time (NULL)); - value = g_dbus_connection_invoke_method_sync (connection, - NULL, /* bus_name */ - "/org/gtk/GDBus/TestObject", - "org.gtk.GDBus.TestPeerInterface", - "HelloWorld", - g_variant_new ("(s)", greeting), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - &error); + value = g_dbus_connection_call_sync (connection, + NULL, /* bus_name */ + "/org/gtk/GDBus/TestObject", + "org.gtk.GDBus.TestPeerInterface", + "HelloWorld", + g_variant_new ("(s)", greeting), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); if (value == NULL) { g_printerr ("Error invoking HelloWorld(): %s\n", error->message); diff --git a/gio/tests/gdbus-export.c b/gio/tests/gdbus-export.c index 886e7147c..77d7303c4 100644 --- a/gio/tests/gdbus-export.c +++ b/gio/tests/gdbus-export.c @@ -320,7 +320,7 @@ introspect_callback (GDBusProxy *proxy, GError *error; error = NULL; - result = g_dbus_proxy_invoke_method_finish (proxy, + result = g_dbus_proxy_call_finish (proxy, res, &error); g_assert_no_error (error); @@ -359,14 +359,14 @@ get_nodes_at (GDBusConnection *c, /* do this async to avoid libdbus-1 deadlocks */ xml_data = NULL; - g_dbus_proxy_invoke_method (proxy, - "Introspect", - NULL, - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - (GAsyncReadyCallback) introspect_callback, - &xml_data); + g_dbus_proxy_call (proxy, + "Introspect", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + (GAsyncReadyCallback) introspect_callback, + &xml_data); g_main_loop_run (loop); g_assert (xml_data != NULL); @@ -416,14 +416,14 @@ has_interface (GDBusConnection *c, /* do this async to avoid libdbus-1 deadlocks */ xml_data = NULL; - g_dbus_proxy_invoke_method (proxy, - "Introspect", - NULL, - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - (GAsyncReadyCallback) introspect_callback, - &xml_data); + g_dbus_proxy_call (proxy, + "Introspect", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + (GAsyncReadyCallback) introspect_callback, + &xml_data); g_main_loop_run (loop); g_assert (xml_data != NULL); @@ -466,14 +466,14 @@ count_interfaces (GDBusConnection *c, /* do this async to avoid libdbus-1 deadlocks */ xml_data = NULL; - g_dbus_proxy_invoke_method (proxy, - "Introspect", - NULL, - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - (GAsyncReadyCallback) introspect_callback, - &xml_data); + g_dbus_proxy_call (proxy, + "Introspect", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + (GAsyncReadyCallback) introspect_callback, + &xml_data); g_main_loop_run (loop); g_assert (xml_data != NULL); @@ -501,9 +501,9 @@ dyna_create_callback (GDBusProxy *proxy, GError *error; error = NULL; - result = g_dbus_proxy_invoke_method_finish (proxy, - res, - &error); + result = g_dbus_proxy_call_finish (proxy, + res, + &error); g_assert_no_error (error); g_assert (result != NULL); g_variant_unref (result); @@ -537,14 +537,14 @@ dyna_create (GDBusConnection *c, g_assert (proxy != NULL); /* do this async to avoid libdbus-1 deadlocks */ - g_dbus_proxy_invoke_method (proxy, - "DynaCyber", - g_variant_new ("()"), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - (GAsyncReadyCallback) dyna_create_callback, - NULL); + g_dbus_proxy_call (proxy, + "DynaCyber", + g_variant_new ("()"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + (GAsyncReadyCallback) dyna_create_callback, + NULL); g_main_loop_run (loop); g_assert_no_error (error); @@ -760,26 +760,26 @@ test_dispatch_thread_func (gpointer user_data) /* generic interfaces */ error = NULL; - value = g_dbus_proxy_invoke_method_sync (foo_proxy, - "org.freedesktop.DBus.Peer.Ping", - NULL, - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - &error); + value = g_dbus_proxy_call_sync (foo_proxy, + "org.freedesktop.DBus.Peer.Ping", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); g_assert_no_error (error); g_assert (value != NULL); g_variant_unref (value); /* user methods */ error = NULL; - value = g_dbus_proxy_invoke_method_sync (foo_proxy, - "Method1", - g_variant_new ("(s)", "winwinwin"), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - &error); + value = g_dbus_proxy_call_sync (foo_proxy, + "Method1", + g_variant_new ("(s)", "winwinwin"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); g_assert_no_error (error); g_assert (value != NULL); g_assert (g_variant_is_of_type (value, G_VARIANT_TYPE ("(s)"))); @@ -788,39 +788,39 @@ test_dispatch_thread_func (gpointer user_data) g_variant_unref (value); error = NULL; - value = g_dbus_proxy_invoke_method_sync (foo_proxy, - "Method2", - NULL, - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - &error); + value = g_dbus_proxy_call_sync (foo_proxy, + "Method2", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); g_assert_error (error, G_IO_ERROR, G_IO_ERROR_DBUS_ERROR); g_assert_cmpstr (error->message, ==, "GDBus.Error:org.example.SomeError: How do you like them apples, buddy!"); g_error_free (error); g_assert (value == NULL); error = NULL; - value = g_dbus_proxy_invoke_method_sync (foo_proxy, - "Method2", - g_variant_new ("(s)", "failfailfail"), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - &error); + value = g_dbus_proxy_call_sync (foo_proxy, + "Method2", + g_variant_new ("(s)", "failfailfail"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS); g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Signature of message, `s', does not match expected signature `'"); g_error_free (error); g_assert (value == NULL); error = NULL; - value = g_dbus_proxy_invoke_method_sync (foo_proxy, - "NonExistantMethod", - NULL, - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - &error); + value = g_dbus_proxy_call_sync (foo_proxy, + "NonExistantMethod", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD); g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such method `NonExistantMethod'"); g_error_free (error); @@ -828,15 +828,15 @@ test_dispatch_thread_func (gpointer user_data) /* user properties */ error = NULL; - value = g_dbus_proxy_invoke_method_sync (foo_proxy, - "org.freedesktop.DBus.Properties.Get", - g_variant_new ("(ss)", - "org.example.Foo", - "PropertyUno"), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - &error); + value = g_dbus_proxy_call_sync (foo_proxy, + "org.freedesktop.DBus.Properties.Get", + g_variant_new ("(ss)", + "org.example.Foo", + "PropertyUno"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); g_assert_no_error (error); g_assert (value != NULL); g_assert (g_variant_is_of_type (value, G_VARIANT_TYPE ("(v)"))); @@ -846,76 +846,76 @@ test_dispatch_thread_func (gpointer user_data) g_variant_unref (value); error = NULL; - value = g_dbus_proxy_invoke_method_sync (foo_proxy, - "org.freedesktop.DBus.Properties.Get", - g_variant_new ("(ss)", - "org.example.Foo", - "ThisDoesntExist"), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - &error); + value = g_dbus_proxy_call_sync (foo_proxy, + "org.freedesktop.DBus.Properties.Get", + g_variant_new ("(ss)", + "org.example.Foo", + "ThisDoesntExist"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); g_assert (value == NULL); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS); g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: No such property `ThisDoesntExist'"); g_error_free (error); error = NULL; - value = g_dbus_proxy_invoke_method_sync (foo_proxy, - "org.freedesktop.DBus.Properties.Get", - g_variant_new ("(ss)", - "org.example.Foo", - "NotReadable"), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - &error); + value = g_dbus_proxy_call_sync (foo_proxy, + "org.freedesktop.DBus.Properties.Get", + g_variant_new ("(ss)", + "org.example.Foo", + "NotReadable"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); g_assert (value == NULL); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS); g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Property `NotReadable' is not readable"); g_error_free (error); error = NULL; - value = g_dbus_proxy_invoke_method_sync (foo_proxy, - "org.freedesktop.DBus.Properties.Set", - g_variant_new ("(ssv)", - "org.example.Foo", - "NotReadable", - g_variant_new_string ("But Writable you are!")), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - &error); + value = g_dbus_proxy_call_sync (foo_proxy, + "org.freedesktop.DBus.Properties.Set", + g_variant_new ("(ssv)", + "org.example.Foo", + "NotReadable", + g_variant_new_string ("But Writable you are!")), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); g_assert (value == NULL); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_SPAWN_FILE_INVALID); g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.Spawn.FileInvalid: Returning some error instead of writing the value `NotReadable' to the property `'But Writable you are!''"); g_error_free (error); error = NULL; - value = g_dbus_proxy_invoke_method_sync (foo_proxy, - "org.freedesktop.DBus.Properties.Set", - g_variant_new ("(ssv)", - "org.example.Foo", - "NotWritable", - g_variant_new_uint32 (42)), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - &error); + value = g_dbus_proxy_call_sync (foo_proxy, + "org.freedesktop.DBus.Properties.Set", + g_variant_new ("(ssv)", + "org.example.Foo", + "NotWritable", + g_variant_new_uint32 (42)), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); g_assert (value == NULL); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS); g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Property `NotWritable' is not writable"); g_error_free (error); error = NULL; - value = g_dbus_proxy_invoke_method_sync (foo_proxy, - "org.freedesktop.DBus.Properties.GetAll", - g_variant_new ("(s)", - "org.example.Foo"), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - &error); + value = g_dbus_proxy_call_sync (foo_proxy, + "org.freedesktop.DBus.Properties.GetAll", + g_variant_new ("(s)", + "org.example.Foo"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); g_assert_no_error (error); g_assert (value != NULL); g_assert (g_variant_is_of_type (value, G_VARIANT_TYPE ("(a{sv})"))); diff --git a/gio/tests/gdbus-introspection.c b/gio/tests/gdbus-introspection.c index 88e368d72..a93c776de 100644 --- a/gio/tests/gdbus-introspection.c +++ b/gio/tests/gdbus-introspection.c @@ -53,13 +53,13 @@ introspection_on_proxy_appeared (GDBusConnection *connection, /* * Invoke Introspect(), then parse the output. */ - result = g_dbus_proxy_invoke_method_sync (proxy, - "org.freedesktop.DBus.Introspectable.Introspect", - NULL, - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - &error); + result = g_dbus_proxy_call_sync (proxy, + "org.freedesktop.DBus.Introspectable.Introspect", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); g_assert_no_error (error); g_assert (result != NULL); g_variant_get (result, "(s)", &xml_data); diff --git a/gio/tests/gdbus-names.c b/gio/tests/gdbus-names.c index 7edd6498e..b48d695ad 100644 --- a/gio/tests/gdbus-names.c +++ b/gio/tests/gdbus-names.c @@ -170,16 +170,16 @@ test_bus_own_name (void) c = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL); g_assert (c != NULL); g_assert (!g_dbus_connection_is_closed (c)); - result = g_dbus_connection_invoke_method_sync (c, - "org.freedesktop.DBus", /* bus name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ - "NameHasOwner", /* method name */ - g_variant_new ("(s)", name), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - &error); + result = g_dbus_connection_call_sync (c, + "org.freedesktop.DBus", /* bus name */ + "/org/freedesktop/DBus", /* object path */ + "org.freedesktop.DBus", /* interface name */ + "NameHasOwner", /* method name */ + g_variant_new ("(s)", name), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); g_assert_no_error (error); g_assert (result != NULL); g_variant_get (result, "(b)", &name_has_owner_reply); @@ -195,16 +195,16 @@ test_bus_own_name (void) /* * Check that the name was actually released. */ - result = g_dbus_connection_invoke_method_sync (c, - "org.freedesktop.DBus", /* bus name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ - "NameHasOwner", /* method name */ - g_variant_new ("(s)", name), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - &error); + result = g_dbus_connection_call_sync (c, + "org.freedesktop.DBus", /* bus name */ + "/org/freedesktop/DBus", /* object path */ + "org.freedesktop.DBus", /* interface name */ + "NameHasOwner", /* method name */ + g_variant_new ("(s)", name), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); g_assert_no_error (error); g_assert (result != NULL); g_variant_get (result, "(b)", &name_has_owner_reply); diff --git a/gio/tests/gdbus-peer.c b/gio/tests/gdbus-peer.c index 229f70e8f..e96666a8c 100644 --- a/gio/tests/gdbus-peer.c +++ b/gio/tests/gdbus-peer.c @@ -537,13 +537,13 @@ test_peer (void) /* try invoking a method */ error = NULL; - result = g_dbus_proxy_invoke_method_sync (proxy, - "HelloPeer", - g_variant_new ("(s)", "Hey Peer!"), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, /* GCancellable */ - &error); + result = g_dbus_proxy_call_sync (proxy, + "HelloPeer", + g_variant_new ("(s)", "Hey Peer!"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, /* GCancellable */ + &error); g_assert_no_error (error); g_variant_get (result, "(s)", &s); g_assert_cmpstr (s, ==, "You greeted me with 'Hey Peer!'."); @@ -556,14 +556,14 @@ test_peer (void) G_CALLBACK (on_proxy_signal_received), &data); g_assert (!data.signal_received); - g_dbus_proxy_invoke_method (proxy, - "EmitSignal", - NULL, /* no arguments */ - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, /* GCancellable */ - NULL, /* GAsyncReadyCallback - we don't care about the result */ - NULL); /* user_data */ + g_dbus_proxy_call (proxy, + "EmitSignal", + NULL, /* no arguments */ + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, /* GCancellable */ + NULL, /* GAsyncReadyCallback - we don't care about the result */ + NULL); /* user_data */ g_main_loop_run (loop); g_assert (data.signal_received); g_assert_cmpint (data.num_method_calls, ==, 2); @@ -679,13 +679,13 @@ test_peer (void) server = NULL; error = NULL; - result = g_dbus_proxy_invoke_method_sync (proxy, - "HelloPeer", - g_variant_new ("(s)", "Hey Again Peer!"), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, /* GCancellable */ - &error); + result = g_dbus_proxy_call_sync (proxy, + "HelloPeer", + g_variant_new ("(s)", "Hey Again Peer!"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, /* GCancellable */ + &error); g_assert_no_error (error); g_variant_get (result, "(s)", &s); g_assert_cmpstr (s, ==, "You greeted me with 'Hey Again Peer!'."); diff --git a/gio/tests/gdbus-proxy.c b/gio/tests/gdbus-proxy.c index f9e17432a..5df6ad532 100644 --- a/gio/tests/gdbus-proxy.c +++ b/gio/tests/gdbus-proxy.c @@ -46,13 +46,13 @@ test_methods (GDBusConnection *connection, /* check that we can invoke a method */ error = NULL; - result = g_dbus_proxy_invoke_method_sync (proxy, - "HelloWorld", - g_variant_new ("(s)", "Hey"), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - &error); + result = g_dbus_proxy_call_sync (proxy, + "HelloWorld", + g_variant_new ("(s)", "Hey"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); g_assert_no_error (error); g_assert (result != NULL); g_assert_cmpstr (g_variant_get_type_string (result), ==, "(s)"); @@ -61,13 +61,13 @@ test_methods (GDBusConnection *connection, g_variant_unref (result); /* Check that we can completely recover the returned error */ - result = g_dbus_proxy_invoke_method_sync (proxy, - "HelloWorld", - g_variant_new ("(s)", "Yo"), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - &error); + result = g_dbus_proxy_call_sync (proxy, + "HelloWorld", + g_variant_new ("(s)", "Yo"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); g_assert_error (error, G_IO_ERROR, G_IO_ERROR_DBUS_ERROR); g_assert (g_dbus_error_is_remote_error (error)); g_assert (g_dbus_error_is_remote_error (error)); @@ -81,13 +81,13 @@ test_methods (GDBusConnection *connection, /* Check that we get a timeout if the method handling is taking longer than timeout */ error = NULL; - result = g_dbus_proxy_invoke_method_sync (proxy, - "Sleep", - g_variant_new ("(i)", 500 /* msec */), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - 100 /* msec */, - NULL, - &error); + result = g_dbus_proxy_call_sync (proxy, + "Sleep", + g_variant_new ("(i)", 500 /* msec */), + G_DBUS_CALL_FLAGS_NONE, + 100 /* msec */, + NULL, + &error); g_assert_error (error, G_IO_ERROR, G_IO_ERROR_TIMED_OUT); g_assert (!g_dbus_error_is_remote_error (error)); g_assert (result == NULL); @@ -97,13 +97,13 @@ test_methods (GDBusConnection *connection, g_assert_cmpint (g_dbus_proxy_get_default_timeout (proxy), ==, -1); /* the default timeout is 25000 msec so this should work */ - result = g_dbus_proxy_invoke_method_sync (proxy, - "Sleep", - g_variant_new ("(i)", 500 /* msec */), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, /* use proxy default (e.g. -1 -> e.g. 25000 msec) */ - NULL, - &error); + result = g_dbus_proxy_call_sync (proxy, + "Sleep", + g_variant_new ("(i)", 500 /* msec */), + G_DBUS_CALL_FLAGS_NONE, + -1, /* use proxy default (e.g. -1 -> e.g. 25000 msec) */ + NULL, + &error); g_assert_no_error (error); g_assert (result != NULL); g_assert_cmpstr (g_variant_get_type_string (result), ==, "()"); @@ -112,13 +112,13 @@ test_methods (GDBusConnection *connection, /* now set the proxy-default timeout to 250 msec and try the 500 msec call - this should FAIL */ g_dbus_proxy_set_default_timeout (proxy, 250); g_assert_cmpint (g_dbus_proxy_get_default_timeout (proxy), ==, 250); - result = g_dbus_proxy_invoke_method_sync (proxy, - "Sleep", - g_variant_new ("(i)", 500 /* msec */), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, /* use proxy default (e.g. 250 msec) */ - NULL, - &error); + result = g_dbus_proxy_call_sync (proxy, + "Sleep", + g_variant_new ("(i)", 500 /* msec */), + G_DBUS_CALL_FLAGS_NONE, + -1, /* use proxy default (e.g. 250 msec) */ + NULL, + &error); g_assert_error (error, G_IO_ERROR, G_IO_ERROR_TIMED_OUT); g_assert (!g_dbus_error_is_remote_error (error)); g_assert (result == NULL); @@ -166,15 +166,15 @@ test_properties (GDBusConnection *connection, * is received. Also check that the cache is updated. */ variant2 = g_variant_new_byte (42); - result = g_dbus_proxy_invoke_method_sync (proxy, - "FrobSetProperty", - g_variant_new ("(sv)", - "y", - variant2), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - &error); + result = g_dbus_proxy_call_sync (proxy, + "FrobSetProperty", + g_variant_new ("(sv)", + "y", + variant2), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); g_assert_no_error (error); g_assert (result != NULL); g_assert_cmpstr (g_variant_get_type_string (result), ==, "()"); @@ -222,9 +222,9 @@ test_proxy_signals_on_emit_signal_cb (GDBusProxy *proxy, GVariant *result; error = NULL; - result = g_dbus_proxy_invoke_method_finish (proxy, - res, - &error); + result = g_dbus_proxy_call_finish (proxy, + res, + &error); g_assert_no_error (error); g_assert (result != NULL); g_assert_cmpstr (g_variant_get_type_string (result), ==, "()"); @@ -263,15 +263,15 @@ test_signals (GDBusConnection *connection, G_CALLBACK (test_proxy_signals_on_signal), s); - result = g_dbus_proxy_invoke_method_sync (proxy, - "EmitSignal", - g_variant_new ("(so)", - "Accept the next proposition you hear", - "/some/path"), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - &error); + result = g_dbus_proxy_call_sync (proxy, + "EmitSignal", + g_variant_new ("(so)", + "Accept the next proposition you hear", + "/some/path"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); g_assert_no_error (error); g_assert (result != NULL); g_assert_cmpstr (g_variant_get_type_string (result), ==, "()"); @@ -296,16 +296,16 @@ test_signals (GDBusConnection *connection, "g-signal", G_CALLBACK (test_proxy_signals_on_signal), s); - g_dbus_proxy_invoke_method (proxy, - "EmitSignal", - g_variant_new ("(so)", - "You will make a great programmer", - "/some/other/path"), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - (GAsyncReadyCallback) test_proxy_signals_on_emit_signal_cb, - &data); + g_dbus_proxy_call (proxy, + "EmitSignal", + g_variant_new ("(so)", + "You will make a great programmer", + "/some/other/path"), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + (GAsyncReadyCallback) test_proxy_signals_on_emit_signal_cb, + &data); g_main_loop_run (data.internal_loop); g_main_loop_unref (data.internal_loop); g_assert_cmpstr (s->str, @@ -324,13 +324,13 @@ test_bogus_method_return (GDBusConnection *connection, GError *error = NULL; GVariant *result; - result = g_dbus_proxy_invoke_method_sync (proxy, - "PairReturn", - NULL, - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - &error); + result = g_dbus_proxy_call_sync (proxy, + "PairReturn", + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); g_assert_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT); g_assert (result == NULL); } diff --git a/gio/tests/gdbus-threading.c b/gio/tests/gdbus-threading.c index cfeafe199..1de395c3b 100644 --- a/gio/tests/gdbus-threading.c +++ b/gio/tests/gdbus-threading.c @@ -52,9 +52,9 @@ msg_cb_expect_success (GDBusConnection *connection, GVariant *result; error = NULL; - result = g_dbus_connection_invoke_method_finish (connection, - res, - &error); + result = g_dbus_connection_call_finish (connection, + res, + &error); g_assert_no_error (error); g_assert (result != NULL); g_variant_unref (result); @@ -74,9 +74,9 @@ msg_cb_expect_error_cancelled (GDBusConnection *connection, GVariant *result; error = NULL; - result = g_dbus_connection_invoke_method_finish (connection, - res, - &error); + result = g_dbus_connection_call_finish (connection, + res, + &error); g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED); g_assert (!g_dbus_error_is_remote_error (error)); g_error_free (error); @@ -131,17 +131,17 @@ test_delivery_in_thread_func (gpointer _data) /* * Check that we get a reply to the GetId() method call. */ - g_dbus_connection_invoke_method (c, - "org.freedesktop.DBus", /* bus_name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ - "GetId", /* method name */ - NULL, - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - (GAsyncReadyCallback) msg_cb_expect_success, - &data); + g_dbus_connection_call (c, + "org.freedesktop.DBus", /* bus_name */ + "/org/freedesktop/DBus", /* object path */ + "org.freedesktop.DBus", /* interface name */ + "GetId", /* method name */ + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + (GAsyncReadyCallback) msg_cb_expect_success, + &data); g_main_loop_run (thread_loop); /* @@ -151,17 +151,17 @@ test_delivery_in_thread_func (gpointer _data) */ ca = g_cancellable_new (); g_cancellable_cancel (ca); - g_dbus_connection_invoke_method (c, - "org.freedesktop.DBus", /* bus_name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ - "GetId", /* method name */ - NULL, - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - ca, - (GAsyncReadyCallback) msg_cb_expect_error_cancelled, - &data); + g_dbus_connection_call (c, + "org.freedesktop.DBus", /* bus_name */ + "/org/freedesktop/DBus", /* object path */ + "org.freedesktop.DBus", /* interface name */ + "GetId", /* method name */ + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + ca, + (GAsyncReadyCallback) msg_cb_expect_error_cancelled, + &data); g_main_loop_run (thread_loop); g_object_unref (ca); @@ -169,17 +169,17 @@ test_delivery_in_thread_func (gpointer _data) * Check that cancellation works when the message is already in flight. */ ca = g_cancellable_new (); - g_dbus_connection_invoke_method (c, - "org.freedesktop.DBus", /* bus_name */ - "/org/freedesktop/DBus", /* object path */ - "org.freedesktop.DBus", /* interface name */ - "GetId", /* method name */ - NULL, - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - ca, - (GAsyncReadyCallback) msg_cb_expect_error_cancelled, - &data); + g_dbus_connection_call (c, + "org.freedesktop.DBus", /* bus_name */ + "/org/freedesktop/DBus", /* object path */ + "org.freedesktop.DBus", /* interface name */ + "GetId", /* method name */ + NULL, + G_DBUS_CALL_FLAGS_NONE, + -1, + ca, + (GAsyncReadyCallback) msg_cb_expect_error_cancelled, + &data); g_cancellable_cancel (ca); g_main_loop_run (thread_loop); g_object_unref (ca); @@ -269,9 +269,9 @@ sleep_cb (GDBusProxy *proxy, GVariant *result; error = NULL; - result = g_dbus_proxy_invoke_method_finish (proxy, - res, - &error); + result = g_dbus_proxy_call_finish (proxy, + res, + &error); g_assert_no_error (error); g_assert (result != NULL); g_assert_cmpstr (g_variant_get_type_string (result), ==, "()"); @@ -302,14 +302,14 @@ test_sleep_in_thread_func (gpointer _data) if (data->async) { //g_debug ("invoking async (%p)", g_thread_self ()); - g_dbus_proxy_invoke_method (data->proxy, - "Sleep", - g_variant_new ("(i)", data->msec), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - (GAsyncReadyCallback) sleep_cb, - data); + g_dbus_proxy_call (data->proxy, + "Sleep", + g_variant_new ("(i)", data->msec), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + (GAsyncReadyCallback) sleep_cb, + data); g_main_loop_run (data->thread_loop); g_print ("A"); //g_debug ("done invoking async (%p)", g_thread_self ()); @@ -321,13 +321,13 @@ test_sleep_in_thread_func (gpointer _data) error = NULL; //g_debug ("invoking sync (%p)", g_thread_self ()); - result = g_dbus_proxy_invoke_method_sync (data->proxy, - "Sleep", - g_variant_new ("(i)", data->msec), - G_DBUS_INVOKE_METHOD_FLAGS_NONE, - -1, - NULL, - &error); + result = g_dbus_proxy_call_sync (data->proxy, + "Sleep", + g_variant_new ("(i)", data->msec), + G_DBUS_CALL_FLAGS_NONE, + -1, + NULL, + &error); g_print ("S"); //g_debug ("done invoking sync (%p)", g_thread_self ()); g_assert_no_error (error); |