aboutsummaryrefslogtreecommitdiff
path: root/tests/media-player-user.cc
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2015-05-27 11:45:11 -0500
committerTed Gould <ted@gould.cx>2015-05-27 11:45:11 -0500
commit83e25c49ed45d5e16667fe89eb2338f4c3593b52 (patch)
tree8b785c237cf68280b11be395263d1bead05ea391 /tests/media-player-user.cc
parent1f2effb760005ab21a7916708cfe2f52cacba6dc (diff)
downloadayatana-indicator-sound-83e25c49ed45d5e16667fe89eb2338f4c3593b52.tar.gz
ayatana-indicator-sound-83e25c49ed45d5e16667fe89eb2338f4c3593b52.tar.bz2
ayatana-indicator-sound-83e25c49ed45d5e16667fe89eb2338f4c3593b52.zip
Adding in a session bus
Diffstat (limited to 'tests/media-player-user.cc')
-rw-r--r--tests/media-player-user.cc30
1 files changed, 24 insertions, 6 deletions
diff --git a/tests/media-player-user.cc b/tests/media-player-user.cc
index 51e7a49..12e967e 100644
--- a/tests/media-player-user.cc
+++ b/tests/media-player-user.cc
@@ -34,26 +34,42 @@ class MediaPlayerUserTest : public ::testing::Test
{
protected:
- DbusTestService * service = NULL;
+ DbusTestService * testsystem = NULL;
AccountsServiceMock service_mock;
+ DbusTestService * testsession = NULL;
+
GDBusConnection * system = NULL;
+ GDBusConnection * session = NULL;
GDBusProxy * proxy = NULL;
std::chrono::milliseconds _eventuallyTime = std::chrono::seconds{5};
virtual void SetUp() {
- service = dbus_test_service_new(NULL);
- dbus_test_service_set_bus(service, DBUS_TEST_SERVICE_BUS_SYSTEM);
+ /* System Bus */
+ testsystem = dbus_test_service_new(NULL);
+ dbus_test_service_set_bus(testsystem, DBUS_TEST_SERVICE_BUS_SYSTEM);
- dbus_test_service_add_task(service, (DbusTestTask*)service_mock);
- dbus_test_service_start_tasks(service);
+ dbus_test_service_add_task(testsystem, (DbusTestTask*)service_mock);
+ dbus_test_service_start_tasks(testsystem);
system = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, NULL);
ASSERT_NE(nullptr, system);
g_dbus_connection_set_exit_on_close(system, FALSE);
g_object_add_weak_pointer(G_OBJECT(system), (gpointer *)&system);
+ /* Session Bus */
+ testsession = dbus_test_service_new(NULL);
+ dbus_test_service_set_bus(testsession, DBUS_TEST_SERVICE_BUS_SESSION);
+
+ dbus_test_service_start_tasks(testsession);
+
+ session = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, NULL);
+ ASSERT_NE(nullptr, session);
+ g_dbus_connection_set_exit_on_close(session, FALSE);
+ g_object_add_weak_pointer(G_OBJECT(session), (gpointer *)&session);
+
+ /* Setup proxy */
proxy = g_dbus_proxy_new_sync(system,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
@@ -66,9 +82,11 @@ class MediaPlayerUserTest : public ::testing::Test
virtual void TearDown() {
g_clear_object(&proxy);
- g_clear_object(&service);
+ g_clear_object(&testsystem);
+ g_clear_object(&testsession);
g_object_unref(system);
+ g_object_unref(session);
#if 0
/* Accounts Service keeps a bunch of references around so we