2010-05-06 20:13:59 +02:00
|
|
|
/* GLib testing framework examples and tests
|
|
|
|
*
|
2012-04-18 23:28:17 +02:00
|
|
|
* Copyright (C) 2012 Collabora Ltd. <http://www.collabora.co.uk/>
|
2010-05-06 20:13:59 +02:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2017-05-27 17:19:21 +02:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2010-05-06 20:13:59 +02:00
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General
|
2014-01-23 12:58:29 +01:00
|
|
|
* Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
2010-05-06 20:13:59 +02:00
|
|
|
*
|
2012-04-18 23:28:17 +02:00
|
|
|
* Author: Xavier Claessens <xavier.claessens@collabora.co.uk>
|
2010-05-06 20:13:59 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "gdbus-sessionbus.h"
|
|
|
|
|
2012-04-18 23:28:17 +02:00
|
|
|
static GTestDBus *singleton = NULL;
|
2010-05-06 20:13:59 +02:00
|
|
|
|
2012-04-18 08:50:07 +02:00
|
|
|
void
|
2012-04-18 23:28:17 +02:00
|
|
|
session_bus_up (void)
|
2010-05-06 20:13:59 +02:00
|
|
|
{
|
2012-04-18 23:28:17 +02:00
|
|
|
g_assert (singleton == NULL);
|
|
|
|
singleton = g_test_dbus_new (G_TEST_DBUS_NONE);
|
|
|
|
g_test_dbus_up (singleton);
|
2012-04-18 19:47:51 +02:00
|
|
|
}
|
|
|
|
|
2012-04-18 23:28:17 +02:00
|
|
|
void
|
|
|
|
session_bus_stop (void)
|
2012-04-18 19:47:51 +02:00
|
|
|
{
|
2012-04-18 23:28:17 +02:00
|
|
|
g_assert (singleton != NULL);
|
|
|
|
g_test_dbus_stop (singleton);
|
2010-05-06 20:13:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
session_bus_down (void)
|
|
|
|
{
|
2012-04-18 23:28:17 +02:00
|
|
|
g_assert (singleton != NULL);
|
|
|
|
g_test_dbus_down (singleton);
|
|
|
|
g_clear_object (&singleton);
|
2010-05-06 20:13:59 +02:00
|
|
|
}
|
2012-04-18 23:28:17 +02:00
|
|
|
|
2013-10-28 22:18:54 +01:00
|
|
|
gint
|
|
|
|
session_bus_run (void)
|
|
|
|
{
|
|
|
|
gint ret;
|
|
|
|
|
|
|
|
session_bus_up ();
|
|
|
|
ret = g_test_run ();
|
|
|
|
session_bus_down ();
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|