aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2014-11-11 18:37:59 -0600
committerTed Gould <ted@gould.cx>2014-11-11 18:37:59 -0600
commitbb6126b670654941f717b0b12c5cf94a2ba1b56e (patch)
treef5c57a8a4896a9f43710bd7d326e8138f6a70450
parentb70244a3e24cc666a640445dbc190db8a44f556c (diff)
downloadayatana-indicator-sound-bb6126b670654941f717b0b12c5cf94a2ba1b56e.tar.gz
ayatana-indicator-sound-bb6126b670654941f717b0b12c5cf94a2ba1b56e.tar.bz2
ayatana-indicator-sound-bb6126b670654941f717b0b12c5cf94a2ba1b56e.zip
Putting the accounts service mock onto the system bus
-rw-r--r--tests/accounts-service-mock.h2
-rw-r--r--tests/accounts-service-user.cc3
-rw-r--r--tests/media-player-user.cc4
3 files changed, 4 insertions, 5 deletions
diff --git a/tests/accounts-service-mock.h b/tests/accounts-service-mock.h
index 9507c5f..7a6972d 100644
--- a/tests/accounts-service-mock.h
+++ b/tests/accounts-service-mock.h
@@ -30,6 +30,8 @@ class AccountsServiceMock
AccountsServiceMock () {
mock = dbus_test_dbus_mock_new("org.freedesktop.Accounts");
+ dbus_test_task_set_bus(DBUS_TEST_TASK(mock), DBUS_TEST_SERVICE_BUS_SYSTEM);
+
DbusTestDbusMockObject * baseobj = dbus_test_dbus_mock_get_object(mock, "/org/freedesktop/Accounts", "org.freedesktop.Accounts", NULL);
dbus_test_dbus_mock_object_add_method(mock, baseobj,
diff --git a/tests/accounts-service-user.cc b/tests/accounts-service-user.cc
index b39b546..7110fb3 100644
--- a/tests/accounts-service-user.cc
+++ b/tests/accounts-service-user.cc
@@ -42,14 +42,13 @@ class AccountsServiceUserTest : public ::testing::Test
virtual void SetUp() {
service = dbus_test_service_new(NULL);
+ dbus_test_service_set_bus(service, DBUS_TEST_SERVICE_BUS_BOTH);
AccountsServiceMock service_mock;
dbus_test_service_add_task(service, (DbusTestTask*)service_mock);
dbus_test_service_start_tasks(service);
- g_setenv("DBUS_SYSTEM_BUS_ADDRESS", g_getenv("DBUS_SESSION_BUS_ADDRESS"), TRUE);
-
session = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);
ASSERT_NE(nullptr, session);
g_dbus_connection_set_exit_on_close(session, FALSE);
diff --git a/tests/media-player-user.cc b/tests/media-player-user.cc
index 32c1181..9214961 100644
--- a/tests/media-player-user.cc
+++ b/tests/media-player-user.cc
@@ -40,13 +40,11 @@ class MediaPlayerUserTest : public ::testing::Test
virtual void SetUp() {
service = dbus_test_service_new(NULL);
-
+ dbus_test_service_set_bus(service, DBUS_TEST_SERVICE_BUS_BOTH);
dbus_test_service_add_task(service, (DbusTestTask*)service_mock);
dbus_test_service_start_tasks(service);
- g_setenv("DBUS_SYSTEM_BUS_ADDRESS", g_getenv("DBUS_SESSION_BUS_ADDRESS"), TRUE);
-
session = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, NULL);
ASSERT_NE(nullptr, session);
g_dbus_connection_set_exit_on_close(session, FALSE);