[next] telepathy-mission-control: connectivity test: make sure we' ve caught up on GDBus messages

Simon McVittie smcv at kemper.freedesktop.org
Fri Sep 27 07:01:58 PDT 2013


Module: telepathy-mission-control
Branch: next
Commit: 089c6a1562a74b86f7e60c87d43abc1c7a6cb446
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=089c6a1562a74b86f7e60c87d43abc1c7a6cb446

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Thu Sep 19 19:41:27 2013 +0100

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 at collabora.co.uk>

---

 tests/twisted/account-manager/connectivity.py |    1 +
 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 a8b6514..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 edbce4b..48f0248 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);
 



More information about the telepathy-commits mailing list