Blame gio/tests/gdbus-sessionbus.c
|
Packit |
ae235b |
/* GLib testing framework examples and tests
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Copyright (C) 2012 Collabora Ltd. <http://www.collabora.co.uk/>
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* This library is free software; you can redistribute it and/or
|
|
Packit |
ae235b |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit |
ae235b |
* License as published by the Free Software Foundation; either
|
|
Packit |
ae235b |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
ae235b |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
ae235b |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
ae235b |
* Lesser General Public License for more details.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* You should have received a copy of the GNU Lesser General
|
|
Packit |
ae235b |
* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
Packit |
ae235b |
*
|
|
Packit |
ae235b |
* Author: Xavier Claessens <xavier.claessens@collabora.co.uk>
|
|
Packit |
ae235b |
*/
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
#include "gdbus-sessionbus.h"
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
static GTestDBus *singleton = NULL;
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
void
|
|
Packit |
ae235b |
session_bus_up (void)
|
|
Packit |
ae235b |
{
|
|
Packit |
ae235b |
g_assert (singleton == NULL);
|
|
Packit |
ae235b |
singleton = g_test_dbus_new (G_TEST_DBUS_NONE);
|
|
Packit |
ae235b |
g_test_dbus_up (singleton);
|
|
Packit |
ae235b |
}
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
void
|
|
Packit |
ae235b |
session_bus_stop (void)
|
|
Packit |
ae235b |
{
|
|
Packit |
ae235b |
g_assert (singleton != NULL);
|
|
Packit |
ae235b |
g_test_dbus_stop (singleton);
|
|
Packit |
ae235b |
}
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
void
|
|
Packit |
ae235b |
session_bus_down (void)
|
|
Packit |
ae235b |
{
|
|
Packit |
ae235b |
g_assert (singleton != NULL);
|
|
Packit |
ae235b |
g_test_dbus_down (singleton);
|
|
Packit |
ae235b |
g_clear_object (&singleton);
|
|
Packit |
ae235b |
}
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
gint
|
|
Packit |
ae235b |
session_bus_run (void)
|
|
Packit |
ae235b |
{
|
|
Packit |
ae235b |
gint ret;
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
session_bus_up ();
|
|
Packit |
ae235b |
ret = g_test_run ();
|
|
Packit |
ae235b |
session_bus_down ();
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
return ret;
|
|
Packit |
ae235b |
}
|