diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2013-09-19 19:41:27 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2013-09-20 12:51:11 +0100 |
commit | 089c6a1562a74b86f7e60c87d43abc1c7a6cb446 (patch) | |
tree | f420000ff2772ac6cd434d5473eade0db5b38f34 | |
parent | eb6a6bf52c1ed476f6dab871cad491d3fff5c8f5 (diff) | |
download | telepathy-mission-control-089c6a1562a74b86f7e60c87d43abc1c7a6cb446.tar.gz |
connectivity test: make sure we've caught up on GDBus messages
Otherwise, the message from the FakeNetworkMonitor saying we've gone
offline might not be received until after the message from the fake NM
saying we've gone online - which would be a problem. There's no
side-effect we can wait for here, so we just have to make sure the
GDBus queue has been processed.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69585
Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
-rw-r--r-- | tests/twisted/account-manager/connectivity.py | 1 | ||||
-rw-r--r-- | tests/twisted/mc-debug-server.c | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/twisted/account-manager/connectivity.py b/tests/twisted/account-manager/connectivity.py index a8b65147..8d80c1d4 100644 --- a/tests/twisted/account-manager/connectivity.py +++ b/tests/twisted/account-manager/connectivity.py @@ -96,6 +96,7 @@ def test(q, bus, mc): q.expect('dbus-method-call', method='Disconnect') mc.connectivity.go_offline() + sync_connectivity_state(mc) # When we turn the network back on, MC should try to sign us back on. # In the process, our RequestedPresence should not have been diff --git a/tests/twisted/mc-debug-server.c b/tests/twisted/mc-debug-server.c index edbce4bd..48f02484 100644 --- a/tests/twisted/mc-debug-server.c +++ b/tests/twisted/mc-debug-server.c @@ -122,10 +122,24 @@ dbus_filter_function (DBusConnection *connection, * drained. */ DBusMessage *reply = dbus_message_new_method_return (message); + GVariant *variant; + GDBusConnection *system_bus; if (reply == NULL) g_error ("Out of memory"); + /* Sync GDBus, too, to make sure we have received any pending + * FakeNetworkMonitor messages. */ + system_bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL); + g_assert (system_bus != NULL); + variant = g_dbus_connection_call_sync (system_bus, + "org.freedesktop.DBus", "/org/freedesktop/DBus", + "org.freedesktop.DBus", "ListNames", + NULL, NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, NULL); + g_assert (variant != NULL); + g_variant_unref (variant); + g_object_unref (system_bus); + g_idle_add_full (G_PRIORITY_LOW, billy_idle, reply, (GDestroyNotify) dbus_message_unref); |