aboutsummaryrefslogtreecommitdiff
path: root/tests/accounts-service-mock.h
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2015-02-05 17:19:33 +0000
committerCI Train Bot <ci-train-bot@canonical.com>2015-02-05 17:19:33 +0000
commit2c5d6305dea48e2181a9180cea9e7cae19e94ef0 (patch)
tree3af41afd37e01998d62631843ce707266f926c21 /tests/accounts-service-mock.h
parentc9cb54483cc5966b3c542ec86dd4e6bf7b33d4ec (diff)
parented66db9f090b5f98338e1a47103b0106cc02d980 (diff)
downloadayatana-indicator-sound-2c5d6305dea48e2181a9180cea9e7cae19e94ef0.tar.gz
ayatana-indicator-sound-2c5d6305dea48e2181a9180cea9e7cae19e94ef0.tar.bz2
ayatana-indicator-sound-2c5d6305dea48e2181a9180cea9e7cae19e94ef0.zip
Initial support for indicator service testing from the GMenu/GAction interfaces
Approved by: Jussi Pakkanen, PS Jenkins bot
Diffstat (limited to 'tests/accounts-service-mock.h')
-rw-r--r--tests/accounts-service-mock.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/accounts-service-mock.h b/tests/accounts-service-mock.h
index d4dae7e..1d0c1fe 100644
--- a/tests/accounts-service-mock.h
+++ b/tests/accounts-service-mock.h
@@ -17,6 +17,7 @@
* Ted Gould <ted@canonical.com>
*/
+#include <memory>
#include <libdbustest/dbus-test.h>
class AccountsServiceMock
@@ -24,11 +25,14 @@ class AccountsServiceMock
DbusTestDbusMock * mock = nullptr;
DbusTestDbusMockObject * soundobj = nullptr;
DbusTestDbusMockObject * userobj = nullptr;
+ DbusTestDbusMockObject * syssoundobj = nullptr;
public:
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,
@@ -80,6 +84,11 @@ class AccountsServiceMock
dbus_test_dbus_mock_object_add_property(mock, soundobj,
"ArtUrl", G_VARIANT_TYPE_STRING,
g_variant_new_string(""), NULL);
+
+ syssoundobj = dbus_test_dbus_mock_get_object(mock, "/user", "com.ubuntu.touch.AccountsService.Sound", NULL);
+ dbus_test_dbus_mock_object_add_property(mock, syssoundobj,
+ "SilentMode", G_VARIANT_TYPE_BOOLEAN,
+ g_variant_new_boolean(FALSE), NULL);
}
~AccountsServiceMock () {
@@ -87,6 +96,18 @@ class AccountsServiceMock
g_clear_object(&mock);
}
+ void setSilentMode (bool modeValue) {
+ dbus_test_dbus_mock_object_update_property(mock, syssoundobj,
+ "SilentMode", g_variant_new_boolean(modeValue ? TRUE : FALSE),
+ NULL);
+ }
+
+ operator std::shared_ptr<DbusTestTask> () {
+ return std::shared_ptr<DbusTestTask>(
+ DBUS_TEST_TASK(g_object_ref(mock)),
+ [](DbusTestTask * task) { g_clear_object(&task); });
+ }
+
operator DbusTestTask* () {
return DBUS_TEST_TASK(mock);
}