From ca507bc64f0ad0aa399fc7e54bf7a13cc2d94678 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 5 Feb 2015 09:39:27 -0600 Subject: Connecting into the indicator test --- tests/indicator-test.cc | 6 ++++++ tests/notifications-mock.h | 12 +++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/indicator-test.cc b/tests/indicator-test.cc index 636db1d..97c4948 100644 --- a/tests/indicator-test.cc +++ b/tests/indicator-test.cc @@ -22,6 +22,7 @@ #include "indicator-fixture.h" #include "accounts-service-mock.h" +#include "notifications-mock.h" class IndicatorTest : public IndicatorFixture { @@ -32,6 +33,7 @@ protected: } std::shared_ptr as; + std::shared_ptr notification; virtual void SetUp() override { @@ -45,12 +47,16 @@ protected: as = std::make_shared(); addMock(*as); + notification = std::make_shared(); + addMock(*notification); + IndicatorFixture::SetUp(); } virtual void TearDown() override { as.reset(); + notification.reset(); IndicatorFixture::TearDown(); } diff --git a/tests/notifications-mock.h b/tests/notifications-mock.h index 5b7206a..ef5acd4 100644 --- a/tests/notifications-mock.h +++ b/tests/notifications-mock.h @@ -24,18 +24,20 @@ class NotificationsMock DbusTestDbusMock * mock = nullptr; public: - AccountsServiceMock () { + NotificationsMock () { mock = dbus_test_dbus_mock_new("org.freedesktop.Notifications"); dbus_test_task_set_bus(DBUS_TEST_TASK(mock), DBUS_TEST_SERVICE_BUS_SESSION); + dbus_test_task_set_name(DBUS_TEST_TASK(mock), "Notifications"); } - ~AccountsServiceMock () { + ~NotificationsMock () { g_debug("Destroying the Accounts Service Mock"); g_clear_object(&mock); } operator std::shared_ptr () { - return std::make_shared(g_object_ref(mock), [](DbusTestTask * task) { g_clear_object(&task); }); + std::shared_ptr retval(DBUS_TEST_TASK(g_object_ref(mock)), [](DbusTestTask * task) { g_clear_object(&task); }); + return retval; } operator DbusTestTask* () { @@ -45,8 +47,4 @@ class NotificationsMock operator DbusTestDbusMock* () { return mock; } - - DbusTestDbusMockObject * get_sound () { - return soundobj; - } }; -- cgit v1.2.3