about summary refs log tree commit diff
path: root/libnm-glib/tests/test-remote-settings-client.c
diff options
context:
space:
mode:
authorIain Lane <iain@orangesquash.org.uk>2018-09-24 09:29:55 +0100
committerIain Lane <iain@orangesquash.org.uk>2018-09-24 09:29:55 +0100
commite152ec7bf4ba252ff9d3eb13eabd417b931dac9a (patch)
treec323cf856ee0bb8e44590670dd54c19653a55748 /libnm-glib/tests/test-remote-settings-client.c
parentee9c73a923909e23a649407be77e25235d769e25 (diff)
Import Upstream version 1.12.2
Diffstat (limited to 'libnm-glib/tests/test-remote-settings-client.c')
-rw-r--r--libnm-glib/tests/test-remote-settings-client.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/libnm-glib/tests/test-remote-settings-client.c b/libnm-glib/tests/test-remote-settings-client.c
index 57bc4faa..031e83f8 100644
--- a/libnm-glib/tests/test-remote-settings-client.c
+++ b/libnm-glib/tests/test-remote-settings-client.c
@@ -70,6 +70,9 @@ test_add_connection (void)
 	time_t start, now;
 	gboolean done = FALSE;
 
+	if (!nmtstc_service_available (sinfo))
+		return;
+
 	connection = nm_connection_new ();
 
 	s_con = (NMSettingConnection *) nm_setting_connection_new ();
@@ -145,6 +148,9 @@ test_make_invisible (void)
 	gboolean done = FALSE, has_settings = FALSE;
 	char *path;
 
+	if (!nmtstc_service_available (sinfo))
+		return;
+
 	g_assert (remote != NULL);
 
 	/* Listen for the remove event when the connection becomes invisible */
@@ -212,6 +218,9 @@ test_make_visible (void)
 	char *path;
 	NMRemoteConnection *new = NULL;
 
+	if (!nmtstc_service_available (sinfo))
+		return;
+
 	g_assert (remote != NULL);
 
 	/* Wait for the new-connection signal when the connection is visible again */
@@ -229,7 +238,6 @@ test_make_visible (void)
 	dbus_g_proxy_begin_call (proxy, "SetVisible", set_visible_cb, NULL, NULL,
 	                         G_TYPE_BOOLEAN, TRUE, G_TYPE_INVALID);
 
-
 	/* Wait for the settings service to announce the connection again */
 	start = time (NULL);
 	do {
@@ -293,6 +301,9 @@ test_remove_connection (void)
 	gboolean done = FALSE;
 	char *path;
 
+	if (!nmtstc_service_available (sinfo))
+		return;
+
 	/* Find a connection to delete */
 	list = nm_remote_settings_list_connections (settings);
 	g_assert_cmpint (g_slist_length (list), >, 0);
@@ -361,11 +372,14 @@ settings_service_running_changed (GObject *client,
 static void
 test_service_running (void)
 {
-	NMRemoteSettings *settings2;
+	gs_unref_object NMRemoteSettings *settings2 = NULL;
 	guint quit_id;
 	int running_changed = 0;
 	gboolean running;
 
+	if (!nmtstc_service_available (sinfo))
+		return;
+
 	loop = g_main_loop_new (NULL, FALSE);
 
 	g_object_get (G_OBJECT (settings),
@@ -404,6 +418,7 @@ test_service_running (void)
 
 	/* Now restart it */
 	sinfo =  nmtstc_service_init ();
+	g_assert (nmtstc_service_available (sinfo));
 
 	quit_id = g_timeout_add_seconds (5, loop_quit, loop);
 	g_main_loop_run (loop);
@@ -414,8 +429,6 @@ test_service_running (void)
 	              NM_REMOTE_SETTINGS_SERVICE_RUNNING, &running,
 	              NULL);
 	g_assert (running == TRUE);
-
-	g_object_unref (settings2);
 }
 
 /*****************************************************************************/