[neon/backports-focal/xdg-desktop-portal/Neon/unstable] tests/backend: tests: Make app chooser backend more debuggable

Simon McVittie null at kde.org
Wed Jan 13 06:32:43 GMT 2021


Git commit 90fd0f9eadf7e17f76cd2e6a79ad524ad9b0ce24 by Simon McVittie.
Committed on 07/09/2020 at 13:20.
Pushed by ash into branch 'Neon/unstable'.

tests: Make app chooser backend more debuggable

Instead of crashing out when our expectations are not met, return an
error that other components can log.

Signed-off-by: Simon McVittie <smcv at collabora.com>

M  +7    -1    tests/backend/appchooser.c

https://invent.kde.org/neon/backports-focal/xdg-desktop-portal/commit/90fd0f9eadf7e17f76cd2e6a79ad524ad9b0ce24

diff --git a/tests/backend/appchooser.c b/tests/backend/appchooser.c
index d8d3f7e..e7bf0f8 100644
--- a/tests/backend/appchooser.c
+++ b/tests/backend/appchooser.c
@@ -122,7 +122,13 @@ handle_choose_application (XdpImplAppChooser *object,
   g_assert_no_error (error);
 
   if (g_key_file_has_key (keyfile, "backend", "expect-no-call", NULL))
-    g_assert_not_reached ();
+    {
+      g_dbus_method_invocation_return_error (invocation,
+                                             G_IO_ERROR,
+                                             G_IO_ERROR_FAILED,
+                                             "Did not expect ChooseApplication to be called here");
+      return TRUE;  /* handled */
+    }
 
   request = request_new (sender, arg_app_id, arg_handle);
 



More information about the Neon-commits mailing list