[gnome-control-center/wip/benzea/ci: 22/28] tests/network: Return remote connection from add_cb



commit 5566bb4bfde93e68273713b9d9786b0ecb2af152
Author: Benjamin Berg <bberg redhat com>
Date:   Thu May 24 18:36:35 2018 +0200

    tests/network: Return remote connection from add_cb
    
    The add_cb can be useful in other tests. Return the remote connection in
    the info struct to allow its use in other situations.

 tests/network/nmtst-helpers.h      |  1 +
 tests/network/test-network-panel.c | 11 +++++------
 2 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/tests/network/nmtst-helpers.h b/tests/network/nmtst-helpers.h
index fd0074bc4..02c6a4395 100644
--- a/tests/network/nmtst-helpers.h
+++ b/tests/network/nmtst-helpers.h
@@ -76,6 +76,7 @@ typedef struct {
        NMConnection *connection;
 
        NMActiveConnection *ac;
+       NMRemoteConnection *rc;
 
        const gchar * const *client_props;
        const gchar * const *device_props;
diff --git a/tests/network/test-network-panel.c b/tests/network/test-network-panel.c
index 74252197d..db5d36c72 100644
--- a/tests/network/test-network-panel.c
+++ b/tests/network/test-network-panel.c
@@ -212,13 +212,11 @@ add_cb (GObject       *object,
 {
   NMClient *client = NM_CLIENT (object);
   EventWaitInfo *info = user_data;
-  NMRemoteConnection *remote_conn;
   g_autoptr(GError) error = NULL;
 
-  remote_conn = nm_client_add_connection_finish (client, result, &error);
+  info->rc = nm_client_add_connection_finish (client, result, &error);
   g_assert_no_error (error);
-  g_assert_nonnull (remote_conn);
-  g_object_unref (remote_conn);
+  g_assert_nonnull (info->rc);
 
   info->other_remaining--;
   WAIT_CHECK_REMAINING()
@@ -241,10 +239,11 @@ test_connection_add (NetworkPanelFixture  *fixture,
   info.other_remaining = 1;
   WAIT_CLIENT(fixture->client, 1, NM_CLIENT_CONNECTIONS);
 
-  g_object_unref (conn);
-
   WAIT_FINISHED(5)
 
+  g_clear_object (&info.rc);
+  g_object_unref (conn);
+
   /* We have one (non-active) connection only, so we get a special case */
   g_assert_nonnull (gtk_test_find_label (fixture->shell, "Cable unplugged"));
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]