1 /* GLib testing framework examples and tests
3 * Copyright (C) 2012 Collabora Ltd. <http://www.collabora.co.uk/>
5 * SPDX-License-Identifier: LGPL-2.1-or-later
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General
18 * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
20 * Author: Xavier Claessens <xavier.claessens@collabora.co.uk>
23 #include "gdbus-sessionbus.h"
25 static GTestDBus *singleton = NULL;
30 gchar *relative, *servicesdir;
31 g_assert (singleton == NULL);
32 singleton = g_test_dbus_new (G_TEST_DBUS_NONE);
34 /* We ignore deprecations here so that gdbus-test-codegen-old can
35 * build successfully despite these two functions not being
36 * available in GLib 2.36 */
37 G_GNUC_BEGIN_IGNORE_DEPRECATIONS
38 relative = g_test_build_filename (G_TEST_BUILT, "services", NULL);
39 servicesdir = g_canonicalize_filename (relative, NULL);
40 G_GNUC_END_IGNORE_DEPRECATIONS
43 g_test_dbus_add_service_dir (singleton, servicesdir);
45 g_test_dbus_up (singleton);
49 session_bus_stop (void)
51 g_assert (singleton != NULL);
52 g_test_dbus_stop (singleton);
56 session_bus_down (void)
58 g_assert (singleton != NULL);
59 g_test_dbus_down (singleton);
60 g_clear_object (&singleton);
64 session_bus_run (void)