aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/greeter-test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/unit/greeter-test.cpp')
-rw-r--r--tests/unit/greeter-test.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/unit/greeter-test.cpp b/tests/unit/greeter-test.cpp
index b33c300..72df3bc 100644
--- a/tests/unit/greeter-test.cpp
+++ b/tests/unit/greeter-test.cpp
@@ -41,6 +41,7 @@ protected:
std::shared_ptr<QtDBusTest::DBusTestRunner> m_dbus_runner;
std::shared_ptr<QtDBusMock::DBusMock> m_dbus_mock;
+ GDBusConnection* m_bus {};
void SetUp() override
{
@@ -49,6 +50,18 @@ protected:
// use a fresh bus for each test run
m_dbus_runner.reset(new QtDBusTest::DBusTestRunner());
m_dbus_mock.reset(new QtDBusMock::DBusMock(*m_dbus_runner.get()));
+
+ GError* error {};
+ m_bus = g_bus_get_sync (G_BUS_TYPE_SESSION, nullptr, &error);
+ g_assert_no_error(error);
+ g_dbus_connection_set_exit_on_close(m_bus, FALSE);
+ }
+
+ void TearDown() override
+ {
+ g_clear_object(&m_bus);
+
+ super::TearDown();
}
void start_greeter_service(bool is_active)