From ce315550c79f760cfbab447d78ab6099372ba8e6 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 28 Sep 2011 17:41:35 +0100 Subject: [PATCH 08/10] Remove tests in test-dbus-glib which basically just test error mapping Also remove the methods on MyObject that only existed to support these tests; ThrowError is now versatile enough to implement them all. Leave ThrowUnregisteredError as it is, since it violates GError expectations (see GNOME#660371), but stop using it in test-dbus-glib - it's enough to use it in test-error-mapping. Signed-off-by: Simon McVittie Bug: https://bugs.freedesktop.org/show_bug.cgi?id=40151 --- test/core/my-object.c | 36 ------------------------------- test/core/test-dbus-glib.c | 45 --------------------------------------- test/core/test-service-glib.xml | 9 ------- 3 files changed, 0 insertions(+), 90 deletions(-) diff --git a/test/core/my-object.c b/test/core/my-object.c index e3636b5..82b6322 100644 --- a/test/core/my-object.c +++ b/test/core/my-object.c @@ -5,9 +5,6 @@ #include "my-object.h" #include "my-object-marshal.h" -static gboolean my_object_throw_error_under_score (MyObject *obj, - GError **error); - #include "test-service-glib-glue.h" void @@ -313,39 +310,6 @@ my_object_throw_error (MyObject *obj, GError **error) } gboolean -my_object_throw_not_supported (MyObject *obj, GError **error) -{ - g_set_error (error, - DBUS_GERROR, - DBUS_GERROR_NOT_SUPPORTED, - "%s", - "this method always loses"); - return FALSE; -} - -gboolean -my_object_throw_error_multi_word (MyObject *obj, GError **error) -{ - g_set_error (error, - MY_OBJECT_ERROR, - MY_OBJECT_ERROR_MULTI_WORD, - "%s", - "this method's error has a hyphen"); - return FALSE; -} - -static gboolean -my_object_throw_error_under_score (MyObject *obj, GError **error) -{ - g_set_error (error, - MY_OBJECT_ERROR, - MY_OBJECT_ERROR_UNDER_SCORE, - "%s", - "this method's error has an underscore"); - return FALSE; -} - -gboolean my_object_throw_unregistered_error (MyObject *obj, GError **error) { /* Unregistered errors shouldn't cause a dbus abort. See diff --git a/test/core/test-dbus-glib.c b/test/core/test-dbus-glib.c index a42ee05..ffc2ae9 100644 --- a/test/core/test-dbus-glib.c +++ b/test/core/test-dbus-glib.c @@ -816,27 +816,6 @@ main (int argc, char **argv) g_print ("ThrowError failed (as expected) returned error: %s\n", error->message); g_clear_error (&error); - g_print ("Calling ThrowNotSupported\n"); - if (dbus_g_proxy_call (proxy, "ThrowNotSupported", &error, - G_TYPE_INVALID, G_TYPE_INVALID) != FALSE) - lose ("ThrowNotSupported call unexpectedly succeeded!"); - - if (error->domain != DBUS_GERROR || error->code != DBUS_GERROR_NOT_SUPPORTED) - lose ("ThrowNotSupported call returned unexpected error: %s #%u: %s %s", - g_quark_to_string (error->domain), error->code, - dbus_g_error_get_name (error), error->message); - - g_print ("ThrowNotSupported correctly returned error: %s\n", error->message); - g_clear_error (&error); - - g_print ("Calling ThrowUnregisteredError\n"); - if (dbus_g_proxy_call (proxy, "ThrowUnregisteredError", &error, - G_TYPE_INVALID, G_TYPE_INVALID) != FALSE) - lose ("ThrowError call unexpectedly succeeded!"); - - g_print ("ThrowUnregisteredError failed (as expected) returned error: %s\n", error->message); - g_clear_error (&error); - g_print ("Calling IncrementRetvalError (for error)\n"); error = NULL; v_UINT32_2 = 0; @@ -911,30 +890,6 @@ main (int argc, char **argv) g_print ("(wrapped) ThrowError failed (as expected) returned error: %s\n", error->message); g_clear_error (&error); - - g_print ("Calling (wrapped) throw_error_multi_word\n"); - if (org_freedesktop_DBus_GLib_Tests_MyObject_throw_error_multi_word (proxy, &error) != FALSE) - lose ("(wrapped) ThrowErrorMultiWord call unexpectedly succeeded!"); - - g_print ("(wrapped) ThrowErrorMultiWord failed (as expected) returned error: %s\n", error->message); - g_clear_error (&error); - - g_print ("Calling (wrapped) throw_error_under_score\n"); - if (org_freedesktop_DBus_GLib_Tests_MyObject_throw_error_under_score (proxy, &error) != FALSE) - lose ("(wrapped) ThrowErrorUnderScore call unexpectedly succeeded!"); - - g_assert_error (error, DBUS_GERROR, DBUS_GERROR_REMOTE_EXCEPTION); - g_assert_cmpstr (dbus_g_error_get_name (error), ==, - "org.freedesktop.DBus.GLib.Tests.MyObject.Under_score"); - - g_print ("(wrapped) ThrowErrorUnderScore failed (as expected) returned error: %s\n", error->message); - g_clear_error (&error); - - if (org_freedesktop_DBus_GLib_Tests_MyObject_async_throw_error (proxy, &error) != FALSE) - lose ("(wrapped) AsyncThrowError call unexpectedly succeeded!"); - - g_print ("(wrapped) AsyncThrowError failed (as expected) returned error: %s\n", error->message); - g_clear_error (&error); g_print ("Calling (wrapped) uppercase\n"); if (!org_freedesktop_DBus_GLib_Tests_MyObject_uppercase (proxy, "foobar", &v_STRING_2, &error)) diff --git a/test/core/test-service-glib.xml b/test/core/test-service-glib.xml index 1b595cc..d91620c 100644 --- a/test/core/test-service-glib.xml +++ b/test/core/test-service-glib.xml @@ -31,15 +31,6 @@ - - - - - - - - - -- 1.7.6.3