diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-10-11 05:22:00 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-10-11 05:22:00 +0200 |
commit | 62b5c2aec12e6a3d305445ee1a88bc18ca0a1548 (patch) | |
tree | ba2ecb8852cb08a674e5a547046fda501fc703a1 /src/libsystemd-bus/test-bus-objects.c | |
parent | 90d184b234fbb72cb06636571655f30ba9858887 (diff) |
bus: make PropertiesChanged emission work
Diffstat (limited to 'src/libsystemd-bus/test-bus-objects.c')
-rw-r--r-- | src/libsystemd-bus/test-bus-objects.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/libsystemd-bus/test-bus-objects.c b/src/libsystemd-bus/test-bus-objects.c index f3571cb3c4..b4facda04b 100644 --- a/src/libsystemd-bus/test-bus-objects.c +++ b/src/libsystemd-bus/test-bus-objects.c @@ -36,8 +36,6 @@ /* Test: * - * sd_bus_emit_properties_changed() - * * Add in: * * automatic properties @@ -134,6 +132,16 @@ static int value_handler(sd_bus *bus, const char *path, const char *interface, c assert_se(PTR_TO_UINT(userdata) == 30); + return 1; +} + +static int notify_test(sd_bus *bus, sd_bus_message *m, void *userdata) { + int r; + + assert_se(sd_bus_emit_properties_changed(bus, m->path, "org.freedesktop.systemd.ValueTest", "Value", NULL) >= 0); + + r = sd_bus_reply_method_return(bus, m, NULL); + assert_se(r >= 0); return 1; } @@ -148,7 +156,8 @@ static const sd_bus_vtable vtable[] = { static const sd_bus_vtable vtable2[] = { SD_BUS_VTABLE_START(0), - SD_BUS_PROPERTY("Value", "s", value_handler, 10, 0), + SD_BUS_METHOD("NotifyTest", "", "", 0, notify_test), + SD_BUS_PROPERTY("Value", "s", value_handler, 10, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE), SD_BUS_VTABLE_END }; @@ -347,6 +356,18 @@ static int client(struct context *c) { sd_bus_message_unref(reply); reply = NULL; + r = sd_bus_call_method(bus, "org.freedesktop.systemd.test", "/value/a", "org.freedesktop.systemd.ValueTest", "NotifyTest", &error, NULL, ""); + assert_se(r >= 0); + + r = sd_bus_process(bus, &reply); + assert_se(r > 0); + + assert_se(sd_bus_message_is_signal(reply, "org.freedesktop.DBus.Properties", "PropertiesChanged")); + bus_message_dump(reply); + + sd_bus_message_unref(reply); + reply = NULL; + r = sd_bus_call_method(bus, "org.freedesktop.systemd.test", "/foo", "org.freedesktop.systemd.test", "Exit", &error, NULL, ""); assert_se(r >= 0); |