summary refs log tree commit diff
path: root/libnm/tests
diff options
context:
space:
mode:
Diffstat (limited to 'libnm/tests')
-rw-r--r--libnm/tests/Makefile.am41
-rw-r--r--libnm/tests/Makefile.in918
-rw-r--r--libnm/tests/common.c187
-rw-r--r--libnm/tests/common.h37
-rwxr-xr-xlibnm/tests/libnm-test-launch.sh9
-rw-r--r--libnm/tests/test-nm-client.c1193
-rw-r--r--libnm/tests/test-remote-settings-client.c547
-rw-r--r--libnm/tests/test-secret-agent.c655
8 files changed, 3587 insertions, 0 deletions
diff --git a/libnm/tests/Makefile.am b/libnm/tests/Makefile.am
new file mode 100644
index 00000000..38449fad
--- /dev/null
+++ b/libnm/tests/Makefile.am
@@ -0,0 +1,41 @@
+if ENABLE_TESTS
+
+AM_CPPFLAGS = \
+	-I$(top_srcdir)/include \
+	-I$(top_srcdir)/libnm \
+	-I$(top_builddir)/libnm \
+	-I$(top_srcdir)/libnm-core \
+	-I$(top_builddir)/libnm-core \
+	-DNETWORKMANAGER_COMPILATION \
+	-DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \
+	-DTEST_NM_SERVICE=\"$(abs_top_srcdir)/tools/test-networkmanager-service.py\" \
+	$(GLIB_CFLAGS)
+
+LDADD = \
+	$(top_builddir)/libnm/libnm.la \
+	$(GLIB_LIBS)
+
+noinst_PROGRAMS = $(TESTS)
+
+TESTS = test-nm-client test-remote-settings-client test-secret-agent
+
+test_nm_client_SOURCES = \
+	common.c \
+	common.h \
+	test-nm-client.c
+
+test_remote_settings_client_SOURCES = \
+	common.c \
+	common.h \
+	test-remote-settings-client.c
+
+test_secret_agent_SOURCES = \
+	common.c \
+	common.h \
+	test-secret-agent.c
+
+TESTS_ENVIRONMENT = $(srcdir)/libnm-test-launch.sh
+
+endif
+
+EXTRA_DIST = libnm-test-launch.sh
diff --git a/libnm/tests/Makefile.in b/libnm/tests/Makefile.in
new file mode 100644
index 00000000..ab5f794c
--- /dev/null
+++ b/libnm/tests/Makefile.in
@@ -0,0 +1,918 @@
+# Makefile.in generated by automake 1.13.4 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+  case $${target_option-} in \
+      ?) ;; \
+      *) echo "am__make_running_with_option: internal error: invalid" \
+              "target option '$${target_option-}' specified" >&2; \
+         exit 1;; \
+  esac; \
+  has_opt=no; \
+  sane_makeflags=$$MAKEFLAGS; \
+  if $(am__is_gnu_make); then \
+    sane_makeflags=$$MFLAGS; \
+  else \
+    case $$MAKEFLAGS in \
+      *\\[\ \	]*) \
+        bs=\\; \
+        sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+          | sed "s/$$bs$$bs[$$bs $$bs	]*//g"`;; \
+    esac; \
+  fi; \
+  skip_next=no; \
+  strip_trailopt () \
+  { \
+    flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+  }; \
+  for flg in $$sane_makeflags; do \
+    test $$skip_next = yes && { skip_next=no; continue; }; \
+    case $$flg in \
+      *=*|--*) continue;; \
+        -*I) strip_trailopt 'I'; skip_next=yes;; \
+      -*I?*) strip_trailopt 'I';; \
+        -*O) strip_trailopt 'O'; skip_next=yes;; \
+      -*O?*) strip_trailopt 'O';; \
+        -*l) strip_trailopt 'l'; skip_next=yes;; \
+      -*l?*) strip_trailopt 'l';; \
+      -[dEDm]) skip_next=yes;; \
+      -[JT]) skip_next=yes;; \
+    esac; \
+    case $$flg in \
+      *$$target_option*) has_opt=yes; break;; \
+    esac; \
+  done; \
+  test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+@ENABLE_TESTS_TRUE@noinst_PROGRAMS = $(am__EXEEXT_1)
+@ENABLE_TESTS_TRUE@TESTS = test-nm-client$(EXEEXT) \
+@ENABLE_TESTS_TRUE@	test-remote-settings-client$(EXEEXT) \
+@ENABLE_TESTS_TRUE@	test-secret-agent$(EXEEXT)
+subdir = libnm/tests
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+	$(top_srcdir)/build-aux/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/ax_lib_readline.m4 \
+	$(top_srcdir)/m4/compiler_warnings.m4 \
+	$(top_srcdir)/m4/gettext.m4 \
+	$(top_srcdir)/m4/gnome-code-coverage.m4 \
+	$(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \
+	$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intltool.m4 \
+	$(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \
+	$(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
+	$(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \
+	$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
+	$(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+@ENABLE_TESTS_TRUE@am__EXEEXT_1 = test-nm-client$(EXEEXT) \
+@ENABLE_TESTS_TRUE@	test-remote-settings-client$(EXEEXT) \
+@ENABLE_TESTS_TRUE@	test-secret-agent$(EXEEXT)
+PROGRAMS = $(noinst_PROGRAMS)
+am__test_nm_client_SOURCES_DIST = common.c common.h test-nm-client.c
+@ENABLE_TESTS_TRUE@am_test_nm_client_OBJECTS = common.$(OBJEXT) \
+@ENABLE_TESTS_TRUE@	test-nm-client.$(OBJEXT)
+test_nm_client_OBJECTS = $(am_test_nm_client_OBJECTS)
+test_nm_client_LDADD = $(LDADD)
+am__DEPENDENCIES_1 =
+@ENABLE_TESTS_TRUE@test_nm_client_DEPENDENCIES =  \
+@ENABLE_TESTS_TRUE@	$(top_builddir)/libnm/libnm.la \
+@ENABLE_TESTS_TRUE@	$(am__DEPENDENCIES_1)
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 = 
+am__test_remote_settings_client_SOURCES_DIST = common.c common.h \
+	test-remote-settings-client.c
+@ENABLE_TESTS_TRUE@am_test_remote_settings_client_OBJECTS =  \
+@ENABLE_TESTS_TRUE@	common.$(OBJEXT) \
+@ENABLE_TESTS_TRUE@	test-remote-settings-client.$(OBJEXT)
+test_remote_settings_client_OBJECTS =  \
+	$(am_test_remote_settings_client_OBJECTS)
+test_remote_settings_client_LDADD = $(LDADD)
+@ENABLE_TESTS_TRUE@test_remote_settings_client_DEPENDENCIES =  \
+@ENABLE_TESTS_TRUE@	$(top_builddir)/libnm/libnm.la \
+@ENABLE_TESTS_TRUE@	$(am__DEPENDENCIES_1)
+am__test_secret_agent_SOURCES_DIST = common.c common.h \
+	test-secret-agent.c
+@ENABLE_TESTS_TRUE@am_test_secret_agent_OBJECTS = common.$(OBJEXT) \
+@ENABLE_TESTS_TRUE@	test-secret-agent.$(OBJEXT)
+test_secret_agent_OBJECTS = $(am_test_secret_agent_OBJECTS)
+test_secret_agent_LDADD = $(LDADD)
+@ENABLE_TESTS_TRUE@test_secret_agent_DEPENDENCIES =  \
+@ENABLE_TESTS_TRUE@	$(top_builddir)/libnm/libnm.la \
+@ENABLE_TESTS_TRUE@	$(am__DEPENDENCIES_1)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo "  GEN     " $@;
+am__v_GEN_1 = 
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 = 
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+	$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+	$(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo "  CC      " $@;
+am__v_CC_1 = 
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+	$(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo "  CCLD    " $@;
+am__v_CCLD_1 = 
+SOURCES = $(test_nm_client_SOURCES) \
+	$(test_remote_settings_client_SOURCES) \
+	$(test_secret_agent_SOURCES)
+DIST_SOURCES = $(am__test_nm_client_SOURCES_DIST) \
+	$(am__test_remote_settings_client_SOURCES_DIST) \
+	$(am__test_secret_agent_SOURCES_DIST)
+am__can_run_installinfo = \
+  case $$AM_UPDATE_INFO_DIR in \
+    n|no|NO) false;; \
+    *) (install-info --version) >/dev/null 2>&1;; \
+  esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates.  Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+  BEGIN { nonempty = 0; } \
+  { items[$$0] = 1; nonempty = 1; } \
+  END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique.  This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+  list='$(am__tagged_files)'; \
+  unique=`for i in $$list; do \
+    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+  done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+  mgn= red= grn= lgn= blu= brg= std=; \
+  am__color_tests=no
+am__tty_colors = { \
+  $(am__tty_colors_dummy); \
+  if test "X$(AM_COLOR_TESTS)" = Xno; then \
+    am__color_tests=no; \
+  elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
+    am__color_tests=yes; \
+  elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
+    am__color_tests=yes; \
+  fi; \
+  if test $$am__color_tests = yes; then \
+    red=''; \
+    grn=''; \
+    lgn=''; \
+    blu=''; \
+    mgn=''; \
+    brg=''; \
+    std=''; \
+  fi; \
+}
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALL_LINGUAS = @ALL_LINGUAS@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@
+BLUEZ5_LIBS = @BLUEZ5_LIBS@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CKDB_PATH = @CKDB_PATH@
+CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@
+CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@
+CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIRNAME = @DATADIRNAME@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_GLIB_100_CFLAGS = @DBUS_GLIB_100_CFLAGS@
+DBUS_GLIB_100_LIBS = @DBUS_GLIB_100_LIBS@
+DBUS_LIBS = @DBUS_LIBS@
+DBUS_SYS_DIR = @DBUS_SYS_DIR@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DHCLIENT_PATH = @DHCLIENT_PATH@
+DHCPCD_PATH = @DHCPCD_PATH@
+DISTRO_NETWORK_SERVICE = @DISTRO_NETWORK_SERVICE@
+DLLTOOL = @DLLTOOL@
+DNSMASQ_PATH = @DNSMASQ_PATH@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GENHTML = @GENHTML@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GLIB_MAKEFILE = @GLIB_MAKEFILE@
+GLIB_MKENUMS = @GLIB_MKENUMS@
+GMSGFMT = @GMSGFMT@
+GMSGFMT_015 = @GMSGFMT_015@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
+GREP = @GREP@
+GTKDOC_CHECK = @GTKDOC_CHECK@
+GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@
+GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@
+GTKDOC_MKPDF = @GTKDOC_MKPDF@
+GTKDOC_REBASE = @GTKDOC_REBASE@
+GUDEV_CFLAGS = @GUDEV_CFLAGS@
+GUDEV_LIBS = @GUDEV_LIBS@
+HTML_DIR = @HTML_DIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INTLLIBS = @INTLLIBS@
+INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
+INTLTOOL_MERGE = @INTLTOOL_MERGE@
+INTLTOOL_PERL = @INTLTOOL_PERL@
+INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
+INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@
+INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@
+INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@
+INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@
+INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
+INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@
+INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@
+INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@
+INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@
+INTROSPECTION_LIBS = @INTROSPECTION_LIBS@
+INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@
+INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
+INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@
+IPTABLES_PATH = @IPTABLES_PATH@
+IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@
+IWMX_SDK_LIBS = @IWMX_SDK_LIBS@
+KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@
+LCOV = @LCOV@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDL = @LIBDL@
+LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+LIBICONV = @LIBICONV@
+LIBINTL = @LIBINTL@
+LIBM = @LIBM@
+LIBNDP_CFLAGS = @LIBNDP_CFLAGS@
+LIBNDP_LIBS = @LIBNDP_LIBS@
+LIBNL_CFLAGS = @LIBNL_CFLAGS@
+LIBNL_LIBS = @LIBNL_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@
+LIBSOUP_LIBS = @LIBSOUP_LIBS@
+LIBTEAMDCTL_CFLAGS = @LIBTEAMDCTL_CFLAGS@
+LIBTEAMDCTL_LIBS = @LIBTEAMDCTL_LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBICONV = @LTLIBICONV@
+LTLIBINTL = @LTLIBINTL@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MM_GLIB_CFLAGS = @MM_GLIB_CFLAGS@
+MM_GLIB_LIBS = @MM_GLIB_LIBS@
+MOC = @MOC@
+MSGFMT = @MSGFMT@
+MSGFMT_015 = @MSGFMT_015@
+MSGMERGE = @MSGMERGE@
+NEWT_CFLAGS = @NEWT_CFLAGS@
+NEWT_LIBS = @NEWT_LIBS@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@
+NM_MAJOR_VERSION = @NM_MAJOR_VERSION@
+NM_MICRO_VERSION = @NM_MICRO_VERSION@
+NM_MINOR_VERSION = @NM_MINOR_VERSION@
+NM_MODIFY_SYSTEM_POLICY = @NM_MODIFY_SYSTEM_POLICY@
+NM_VERSION = @NM_VERSION@
+NSS_CFLAGS = @NSS_CFLAGS@
+NSS_LIBS = @NSS_LIBS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+POLKIT_CFLAGS = @POLKIT_CFLAGS@
+POLKIT_LIBS = @POLKIT_LIBS@
+POSUB = @POSUB@
+PPPD_PATH = @PPPD_PATH@
+PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@
+PPPOE_PATH = @PPPOE_PATH@
+QT_CFLAGS = @QT_CFLAGS@
+QT_LIBS = @QT_LIBS@
+RANLIB = @RANLIB@
+READLINE_LIBS = @READLINE_LIBS@
+SED = @SED@
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
+SELINUX_LIBS = @SELINUX_LIBS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+SYSTEMD_200_CFLAGS = @SYSTEMD_200_CFLAGS@
+SYSTEMD_200_LIBS = @SYSTEMD_200_LIBS@
+SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@
+SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@
+SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@
+SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@
+SYSTEM_CA_PATH = @SYSTEM_CA_PATH@
+UDEV_DIR = @UDEV_DIR@
+USE_NLS = @USE_NLS@
+UUID_CFLAGS = @UUID_CFLAGS@
+UUID_LIBS = @UUID_LIBS@
+VALGRIND_RULES = @VALGRIND_RULES@
+VAPIGEN = @VAPIGEN@
+VAPIGEN_MAKEFILE = @VAPIGEN_MAKEFILE@
+VAPIGEN_VAPIDIR = @VAPIGEN_VAPIDIR@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+XGETTEXT_015 = @XGETTEXT_015@
+XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+intltool__v_merge_options_ = @intltool__v_merge_options_@
+intltool__v_merge_options_0 = @intltool__v_merge_options_0@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+nmbinary = @nmbinary@
+nmconfdir = @nmconfdir@
+nmdatadir = @nmdatadir@
+nmrundir = @nmrundir@
+nmstatedir = @nmstatedir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+subdirs = @subdirs@
+sysconfdir = @sysconfdir@
+systemdsystemunitdir = @systemdsystemunitdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+with_dhclient = @with_dhclient@
+with_dhcpcd = @with_dhcpcd@
+with_netconfig = @with_netconfig@
+with_resolvconf = @with_resolvconf@
+with_valgrind = @with_valgrind@
+@ENABLE_TESTS_TRUE@AM_CPPFLAGS = \
+@ENABLE_TESTS_TRUE@	-I$(top_srcdir)/include \
+@ENABLE_TESTS_TRUE@	-I$(top_srcdir)/libnm \
+@ENABLE_TESTS_TRUE@	-I$(top_builddir)/libnm \
+@ENABLE_TESTS_TRUE@	-I$(top_srcdir)/libnm-core \
+@ENABLE_TESTS_TRUE@	-I$(top_builddir)/libnm-core \
+@ENABLE_TESTS_TRUE@	-DNETWORKMANAGER_COMPILATION \
+@ENABLE_TESTS_TRUE@	-DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \
+@ENABLE_TESTS_TRUE@	-DTEST_NM_SERVICE=\"$(abs_top_srcdir)/tools/test-networkmanager-service.py\" \
+@ENABLE_TESTS_TRUE@	$(GLIB_CFLAGS)
+
+@ENABLE_TESTS_TRUE@LDADD = \
+@ENABLE_TESTS_TRUE@	$(top_builddir)/libnm/libnm.la \
+@ENABLE_TESTS_TRUE@	$(GLIB_LIBS)
+
+@ENABLE_TESTS_TRUE@test_nm_client_SOURCES = \
+@ENABLE_TESTS_TRUE@	common.c \
+@ENABLE_TESTS_TRUE@	common.h \
+@ENABLE_TESTS_TRUE@	test-nm-client.c
+
+@ENABLE_TESTS_TRUE@test_remote_settings_client_SOURCES = \
+@ENABLE_TESTS_TRUE@	common.c \
+@ENABLE_TESTS_TRUE@	common.h \
+@ENABLE_TESTS_TRUE@	test-remote-settings-client.c
+
+@ENABLE_TESTS_TRUE@test_secret_agent_SOURCES = \
+@ENABLE_TESTS_TRUE@	common.c \
+@ENABLE_TESTS_TRUE@	common.h \
+@ENABLE_TESTS_TRUE@	test-secret-agent.c
+
+@ENABLE_TESTS_TRUE@TESTS_ENVIRONMENT = $(srcdir)/libnm-test-launch.sh
+EXTRA_DIST = libnm-test-launch.sh
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libnm/tests/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu libnm/tests/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstPROGRAMS:
+	@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+
+test-nm-client$(EXEEXT): $(test_nm_client_OBJECTS) $(test_nm_client_DEPENDENCIES) $(EXTRA_test_nm_client_DEPENDENCIES) 
+	@rm -f test-nm-client$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(test_nm_client_OBJECTS) $(test_nm_client_LDADD) $(LIBS)
+
+test-remote-settings-client$(EXEEXT): $(test_remote_settings_client_OBJECTS) $(test_remote_settings_client_DEPENDENCIES) $(EXTRA_test_remote_settings_client_DEPENDENCIES) 
+	@rm -f test-remote-settings-client$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(test_remote_settings_client_OBJECTS) $(test_remote_settings_client_LDADD) $(LIBS)
+
+test-secret-agent$(EXEEXT): $(test_secret_agent_OBJECTS) $(test_secret_agent_DEPENDENCIES) $(EXTRA_test_secret_agent_DEPENDENCIES) 
+	@rm -f test-secret-agent$(EXEEXT)
+	$(AM_V_CCLD)$(LINK) $(test_secret_agent_OBJECTS) $(test_secret_agent_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-nm-client.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-remote-settings-client.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-secret-agent.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+	$(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	set x; \
+	here=`pwd`; \
+	$(am__define_uniq_tagged_files); \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+	$(am__define_uniq_tagged_files); \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+	list='$(am__tagged_files)'; \
+	case "$(srcdir)" in \
+	  [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+	  *) sdir=$(subdir)/$(srcdir) ;; \
+	esac; \
+	for i in $$list; do \
+	  if test -f "$$i"; then \
+	    echo "$(subdir)/$$i"; \
+	  else \
+	    echo "$$sdir/$$i"; \
+	  fi; \
+	done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+	@failed=0; all=0; xfail=0; xpass=0; skip=0; \
+	srcdir=$(srcdir); export srcdir; \
+	list=' $(TESTS) '; \
+	$(am__tty_colors); \
+	if test -n "$$list"; then \
+	  for tst in $$list; do \
+	    if test -f ./$$tst; then dir=./; \
+	    elif test -f $$tst; then dir=; \
+	    else dir="$(srcdir)/"; fi; \
+	    if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \
+	      all=`expr $$all + 1`; \
+	      case " $(XFAIL_TESTS) " in \
+	      *[\ \	]$$tst[\ \	]*) \
+		xpass=`expr $$xpass + 1`; \
+		failed=`expr $$failed + 1`; \
+		col=$$red; res=XPASS; \
+	      ;; \
+	      *) \
+		col=$$grn; res=PASS; \
+	      ;; \
+	      esac; \
+	    elif test $$? -ne 77; then \
+	      all=`expr $$all + 1`; \
+	      case " $(XFAIL_TESTS) " in \
+	      *[\ \	]$$tst[\ \	]*) \
+		xfail=`expr $$xfail + 1`; \
+		col=$$lgn; res=XFAIL; \
+	      ;; \
+	      *) \
+		failed=`expr $$failed + 1`; \
+		col=$$red; res=FAIL; \
+	      ;; \
+	      esac; \
+	    else \
+	      skip=`expr $$skip + 1`; \
+	      col=$$blu; res=SKIP; \
+	    fi; \
+	    echo "$${col}$$res$${std}: $$tst"; \
+	  done; \
+	  if test "$$all" -eq 1; then \
+	    tests="test"; \
+	    All=""; \
+	  else \
+	    tests="tests"; \
+	    All="All "; \
+	  fi; \
+	  if test "$$failed" -eq 0; then \
+	    if test "$$xfail" -eq 0; then \
+	      banner="$$All$$all $$tests passed"; \
+	    else \
+	      if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
+	      banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+	    fi; \
+	  else \
+	    if test "$$xpass" -eq 0; then \
+	      banner="$$failed of $$all $$tests failed"; \
+	    else \
+	      if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
+	      banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+	    fi; \
+	  fi; \
+	  dashes="$$banner"; \
+	  skipped=""; \
+	  if test "$$skip" -ne 0; then \
+	    if test "$$skip" -eq 1; then \
+	      skipped="($$skip test was not run)"; \
+	    else \
+	      skipped="($$skip tests were not run)"; \
+	    fi; \
+	    test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+	      dashes="$$skipped"; \
+	  fi; \
+	  report=""; \
+	  if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+	    report="Please report to $(PACKAGE_BUGREPORT)"; \
+	    test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+	      dashes="$$report"; \
+	  fi; \
+	  dashes=`echo "$$dashes" | sed s/./=/g`; \
+	  if test "$$failed" -eq 0; then \
+	    col="$$grn"; \
+	  else \
+	    col="$$red"; \
+	  fi; \
+	  echo "$${col}$$dashes$${std}"; \
+	  echo "$${col}$$banner$${std}"; \
+	  test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
+	  test -z "$$report" || echo "$${col}$$report$${std}"; \
+	  echo "$${col}$$dashes$${std}"; \
+	  test "$$failed" -eq 0; \
+	else :; fi
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+	$(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	if test -z '$(STRIP)'; then \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	      install; \
+	else \
+	  $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	    install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	    "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+	fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
+	mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
+	clean-generic clean-libtool clean-noinstPROGRAMS cscopelist-am \
+	ctags ctags-am distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-data \
+	install-data-am install-dvi install-dvi-am install-exec \
+	install-exec-am install-html install-html-am install-info \
+	install-info-am install-man install-pdf install-pdf-am \
+	install-ps install-ps-am install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags tags-am uninstall uninstall-am
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/libnm/tests/common.c b/libnm/tests/common.c
new file mode 100644
index 00000000..a28e5112
--- /dev/null
+++ b/libnm/tests/common.c
@@ -0,0 +1,187 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright 2010 - 2014 Red Hat, Inc.
+ *
+ */
+
+#include "config.h"
+
+#include <glib.h>
+#include <string.h>
+
+#include "NetworkManager.h"
+
+#include "common.h"
+
+static gboolean
+name_exists (GDBusConnection *c, const char *name)
+{
+	GVariant *reply;
+	gboolean exists = FALSE;
+
+	reply = g_dbus_connection_call_sync (c,
+	                                     "org.freedesktop.DBus",
+	                                     "/org/freedesktop/DBus",
+	                                     "org.freedesktop.DBus",
+	                                     "GetNameOwner",
+	                                     g_variant_new ("(s)", name),
+	                                     NULL,
+	                                     G_DBUS_CALL_FLAGS_NO_AUTO_START,
+	                                     -1,
+	                                     NULL,
+	                                     NULL);
+	if (reply != NULL) {
+		exists = TRUE;
+		g_variant_unref (reply);
+	}
+
+	return exists;
+}
+
+NMTestServiceInfo *
+nm_test_service_init (void)
+{
+	NMTestServiceInfo *info;
+	const char *args[2] = { TEST_NM_SERVICE, NULL };
+	GError *error = NULL;
+	int i;
+
+	info = g_malloc0 (sizeof (*info));
+
+	info->bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL,  &error);
+	g_assert_no_error (error);
+
+	/* Spawn the test service. info->keepalive_fd will be a pipe to the service's
+	 * stdin; if it closes, the service will exit immediately. We use this to
+	 * make sure the service exits if the test program crashes.
+	 */
+	g_spawn_async_with_pipes (NULL, (char **) args, NULL, 0, NULL, NULL,
+	                          &info->pid, &info->keepalive_fd, NULL, NULL, &error);
+	g_assert_no_error (error);
+
+	/* Wait until the service is registered on the bus */
+	for (i = 100; i > 0; i--) {
+		if (name_exists (info->bus, "org.freedesktop.NetworkManager"))
+			break;
+		g_usleep (G_USEC_PER_SEC / 50);
+	}
+	g_assert (i > 0);
+
+	/* Grab a proxy to our fake NM service to trigger tests */
+	info->proxy = g_dbus_proxy_new_sync (info->bus,
+	                                     G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
+	                                     G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS |
+	                                     G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
+	                                     NULL,
+	                                     NM_DBUS_SERVICE,
+	                                     NM_DBUS_PATH,
+	                                     "org.freedesktop.NetworkManager.LibnmGlibTest",
+	                                     NULL, &error);
+	g_assert_no_error (error);
+
+	return info;
+}
+
+void
+nm_test_service_cleanup (NMTestServiceInfo *info)
+{
+	int i;
+
+	g_object_unref (info->proxy);
+	kill (info->pid, SIGTERM);
+
+	/* Wait until the bus notices the service is gone */
+	for (i = 100; i > 0; i--) {
+		if (!name_exists (info->bus, "org.freedesktop.NetworkManager"))
+			break;
+		g_usleep (G_USEC_PER_SEC / 50);
+	}
+	g_assert (i > 0);
+
+	g_object_unref (info->bus);
+	close (info->keepalive_fd);
+
+	memset (info, 0, sizeof (*info));
+	g_free (info);
+}
+
+typedef struct {
+	GMainLoop *loop;
+	const char *ifname;
+	char *path;
+	NMDevice *device;
+} AddDeviceInfo;
+
+static void
+device_added_cb (NMClient *client,
+                 NMDevice *device,
+                 gpointer user_data)
+{
+	AddDeviceInfo *info = user_data;
+
+	g_assert (device);
+	g_assert_cmpstr (nm_object_get_path (NM_OBJECT (device)), ==, info->path);
+	g_assert_cmpstr (nm_device_get_iface (device), ==, info->ifname);
+
+	info->device = device;
+	g_main_loop_quit (info->loop);
+}
+
+static gboolean
+timeout (gpointer user_data)
+{
+	g_assert_not_reached ();
+	return G_SOURCE_REMOVE;
+}
+
+NMDevice *
+nm_test_service_add_device (NMTestServiceInfo *sinfo, NMClient *client,
+                            const char *method, const char *ifname)
+{
+	AddDeviceInfo info;
+	GError *error = NULL;
+	GVariant *ret;
+	guint timeout_id;
+
+	ret = g_dbus_proxy_call_sync (sinfo->proxy,
+	                              method,
+	                              g_variant_new ("(s)", ifname),
+	                              G_DBUS_CALL_FLAGS_NO_AUTO_START,
+	                              3000,
+	                              NULL,
+	                              &error);
+	g_assert_no_error (error);
+	g_assert (ret);
+	g_assert_cmpstr (g_variant_get_type_string (ret), ==, "(o)");
+	g_variant_get (ret, "(o)", &info.path);
+	g_variant_unref (ret);
+
+	/* Wait for libnm to find the device */
+	info.ifname = ifname;
+	info.loop = g_main_loop_new (NULL, FALSE);
+	g_signal_connect (client, "device-added",
+	                  G_CALLBACK (device_added_cb), &info);
+	timeout_id = g_timeout_add_seconds (5, timeout, NULL);
+	g_main_loop_run (info.loop);
+
+	g_source_remove (timeout_id);
+	g_signal_handlers_disconnect_by_func (client, device_added_cb, &info);
+	g_free (info.path);
+	g_main_loop_unref (info.loop);
+
+	return info.device;
+}
diff --git a/libnm/tests/common.h b/libnm/tests/common.h
new file mode 100644
index 00000000..aa15167b
--- /dev/null
+++ b/libnm/tests/common.h
@@ -0,0 +1,37 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * Copyright 2014 Red Hat, Inc.
+ */
+
+#include <gio/gio.h>
+#include <NetworkManager.h>
+
+typedef struct {
+	GDBusConnection *bus;
+	GDBusProxy *proxy;
+	GPid pid;
+	int keepalive_fd;
+} NMTestServiceInfo;
+
+NMTestServiceInfo *nm_test_service_init (void);
+void nm_test_service_cleanup (NMTestServiceInfo *info);
+
+NMDevice *nm_test_service_add_device (NMTestServiceInfo *info,
+                                      NMClient *client,
+                                      const char *method,
+                                      const char *ifname);
diff --git a/libnm/tests/libnm-test-launch.sh b/libnm/tests/libnm-test-launch.sh
new file mode 100755
index 00000000..42d9fbe2
--- /dev/null
+++ b/libnm/tests/libnm-test-launch.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+# Spawn DBus if there's none
+if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
+    eval `dbus-launch --sh-syntax`
+    trap "kill $DBUS_SESSION_BUS_PID" EXIT
+fi
+
+"$@"
diff --git a/libnm/tests/test-nm-client.c b/libnm/tests/test-nm-client.c
new file mode 100644
index 00000000..3541c741
--- /dev/null
+++ b/libnm/tests/test-nm-client.c
@@ -0,0 +1,1193 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright 2010 - 2014 Red Hat, Inc.
+ *
+ */
+
+#include "config.h"
+
+#include <glib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <signal.h>
+
+#include <NetworkManager.h>
+#include "nm-glib-compat.h"
+
+#include "common.h"
+
+#include "nm-test-utils.h"
+
+static GMainLoop *loop = NULL;
+static NMTestServiceInfo *sinfo;
+
+/*******************************************************************/
+
+static gboolean
+loop_quit (gpointer user_data)
+{
+	g_main_loop_quit ((GMainLoop *) user_data);
+	return G_SOURCE_REMOVE;
+}
+
+/*******************************************************************/
+
+static void
+devices_notify_cb (NMClient *c,
+                   GParamSpec *pspec,
+                   gpointer user_data)
+{
+	gboolean *notified = user_data;
+	const GPtrArray *devices;
+	NMDevice *device;
+
+	devices = nm_client_get_devices (c);
+	g_assert (devices);
+	g_assert_cmpint (devices->len, ==, 1);
+
+	device = g_ptr_array_index (devices, 0);
+	g_assert (device);
+	g_assert_cmpstr (nm_device_get_iface (device), ==, "eth0");
+
+	*notified = TRUE;
+}
+
+static void
+test_device_added (void)
+{
+	NMClient *client;
+	const GPtrArray *devices;
+	NMDevice *device;
+	gboolean notified = FALSE;
+	GError *error = NULL;
+
+	sinfo = nm_test_service_init ();
+	client = nm_client_new (NULL, &error);
+	g_assert_no_error (error);
+
+	devices = nm_client_get_devices (client);
+	g_assert (devices->len == 0);
+
+	g_signal_connect (client,
+	                  "notify::devices",
+	                  (GCallback) devices_notify_cb,
+	                  &notified);
+
+	/* Tell the test service to add a new device */
+	nm_test_service_add_device (sinfo, client, "AddWiredDevice", "eth0");
+
+	/* coverity[loop_condition] */
+	while (!notified)
+		g_main_context_iteration (NULL, TRUE);
+
+	g_signal_handlers_disconnect_by_func (client, devices_notify_cb, &notified);
+
+	devices = nm_client_get_devices (client);
+	g_assert (devices);
+	g_assert_cmpint (devices->len, ==, 1);
+
+	device = g_ptr_array_index (devices, 0);
+	g_assert (device);
+	g_assert_cmpstr (nm_device_get_iface (device), ==, "eth0");
+
+	/* Try deleting the device via the ordinary NM interface, which should fail */
+	nm_device_delete (device, NULL, &error);
+	g_assert_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_NOT_SOFTWARE);
+
+	g_object_unref (client);
+	g_clear_pointer (&sinfo, nm_test_service_cleanup);
+}
+
+/*******************************************************************/
+
+typedef enum {
+	SIGNAL_FIRST  = 0x01,
+	SIGNAL_SECOND = 0x02,
+	SIGNAL_MASK   = 0x0F,
+	NOTIFY_FIRST  = 0x10,
+	NOTIFY_SECOND = 0x20,
+	NOTIFY_MASK   = 0xF0
+} DeviceSignaledAfterInitType;
+
+static void
+device_sai_added_cb (NMClient *c,
+                     NMDevice *device,
+                     gpointer user_data)
+{
+	guint *result = user_data;
+
+	g_assert (device);
+	g_assert_cmpstr (nm_device_get_iface (device), ==, "eth0");
+
+	g_assert ((*result & SIGNAL_MASK) == 0);
+	*result |= *result ? SIGNAL_SECOND : SIGNAL_FIRST;
+}
+
+static void
+devices_sai_notify_cb (NMClient *c,
+                       GParamSpec *pspec,
+                       gpointer user_data)
+{
+	guint *result = user_data;
+	const GPtrArray *devices;
+	NMDevice *device;
+
+	devices = nm_client_get_devices (c);
+	g_assert (devices);
+	g_assert_cmpint (devices->len, ==, 1);
+
+	device = g_ptr_array_index (devices, 0);
+	g_assert (device);
+	g_assert_cmpstr (nm_device_get_iface (device), ==, "eth0");
+
+	g_assert ((*result & NOTIFY_MASK) == 0);
+	*result |= *result ? NOTIFY_SECOND : NOTIFY_FIRST;
+}
+
+static void
+test_device_added_signal_after_init (void)
+{
+	NMClient *client;
+	const GPtrArray *devices;
+	NMDevice *device;
+	guint result = 0;
+	GError *error = NULL;
+
+	sinfo = nm_test_service_init ();
+	client = nm_client_new (NULL, &error);
+	g_assert_no_error (error);
+
+	devices = nm_client_get_devices (client);
+	g_assert (devices->len == 0);
+
+	g_signal_connect (client,
+	                  NM_CLIENT_DEVICE_ADDED,
+	                  (GCallback) device_sai_added_cb,
+	                  &result);
+
+	g_signal_connect (client,
+	                  "notify::" NM_CLIENT_DEVICES,
+	                  (GCallback) devices_sai_notify_cb,
+	                  &result);
+
+	/* Tell the test service to add a new device */
+	nm_test_service_add_device (sinfo, client, "AddWiredDevice", "eth0");
+
+	/* Ensure the 'device-added' signal doesn't show up before
+	 * the 'Devices' property change notification */
+	/* coverity[loop_condition] */
+	while (!(result & SIGNAL_MASK) && !(result & NOTIFY_MASK))
+		g_main_context_iteration (NULL, TRUE);
+
+	g_signal_handlers_disconnect_by_func (client, device_sai_added_cb, &result);
+	g_signal_handlers_disconnect_by_func (client, devices_sai_notify_cb, &result);
+
+	g_assert ((result & SIGNAL_MASK) == SIGNAL_FIRST);
+	g_assert ((result & NOTIFY_MASK) == NOTIFY_SECOND);
+
+	devices = nm_client_get_devices (client);
+	g_assert (devices);
+	g_assert_cmpint (devices->len, ==, 1);
+
+	device = g_ptr_array_index (devices, 0);
+	g_assert (device);
+	g_assert_cmpstr (nm_device_get_iface (device), ==, "eth0");
+
+	g_object_unref (client);
+	g_clear_pointer (&sinfo, nm_test_service_cleanup);
+}
+
+/*******************************************************************/
+
+static const char *expected_bssid = "66:55:44:33:22:11";
+
+typedef struct {
+	GMainLoop *loop;
+	gboolean found;
+	char *ap_path;
+	gboolean signaled;
+	gboolean notified;
+	guint quit_id;
+	guint quit_count;
+} WifiApInfo;
+
+static void
+wifi_check_quit (WifiApInfo *info)
+{
+	info->quit_count--;
+	if (info->quit_count == 0) {
+		g_source_remove (info->quit_id);
+		info->quit_id = 0;
+		g_main_loop_quit (info->loop);
+	}
+}
+
+static void
+got_ap_path (WifiApInfo *info, const char *path)
+{
+	if (info->ap_path)
+		g_assert_cmpstr (info->ap_path, ==, path);
+	else
+		info->ap_path = g_strdup (path);
+}
+
+static void
+wifi_ap_added_cb (NMDeviceWifi *w,
+                  NMAccessPoint *ap,
+                  WifiApInfo *info)
+{
+	g_assert (ap);
+	g_assert_cmpstr (nm_access_point_get_bssid (ap), ==, expected_bssid);
+	got_ap_path (info, nm_object_get_path (NM_OBJECT (ap)));
+
+	info->signaled = TRUE;
+	wifi_check_quit (info);
+}
+
+static void
+wifi_ap_add_notify_cb (NMDeviceWifi *w,
+                       GParamSpec *pspec,
+                       WifiApInfo *info)
+{
+	const GPtrArray *aps;
+	NMAccessPoint *ap;
+
+	aps = nm_device_wifi_get_access_points (w);
+	g_assert (aps);
+	g_assert_cmpint (aps->len, ==, 1);
+
+	ap = g_ptr_array_index (aps, 0);
+	g_assert (ap);
+	g_assert_cmpstr (nm_access_point_get_bssid (ap), ==, "66:55:44:33:22:11");
+	got_ap_path (info, nm_object_get_path (NM_OBJECT (ap)));
+
+	info->notified = TRUE;
+	wifi_check_quit (info);
+}
+
+static void
+wifi_ap_removed_cb (NMDeviceWifi *w,
+                    NMAccessPoint *ap,
+                    WifiApInfo *info)
+{
+	g_assert (ap);
+	g_assert_cmpstr (info->ap_path, ==, nm_object_get_path (NM_OBJECT (ap)));
+
+	info->signaled = TRUE;
+	wifi_check_quit (info);
+}
+
+static void
+wifi_ap_remove_notify_cb (NMDeviceWifi *w,
+                          GParamSpec *pspec,
+                          WifiApInfo *info)
+{
+	const GPtrArray *aps;
+
+	aps = nm_device_wifi_get_access_points (w);
+	g_assert (aps->len == 0);
+
+	info->notified = TRUE;
+	wifi_check_quit (info);
+}
+
+static void
+test_wifi_ap_added_removed (void)
+{
+	NMClient *client;
+	NMDeviceWifi *wifi;
+	WifiApInfo info = { loop, FALSE, FALSE, 0, 0 };
+	GVariant *ret;
+	GError *error = NULL;
+	char *expected_path = NULL;
+
+	sinfo = nm_test_service_init ();
+	client = nm_client_new (NULL, &error);
+	g_assert_no_error (error);
+
+	/*************************************/
+	/* Add the wifi device */
+	wifi = (NMDeviceWifi *) nm_test_service_add_device (sinfo, client, "AddWifiDevice", "wlan0");
+	g_assert (NM_IS_DEVICE_WIFI (wifi));
+
+	/*************************************/
+	/* Add the wifi AP */
+	info.signaled =  FALSE;
+	info.notified = FALSE;
+	info.quit_id = 0;
+
+	ret = g_dbus_proxy_call_sync (sinfo->proxy,
+	                              "AddWifiAp",
+	                              g_variant_new ("(sss)", "wlan0", "test-ap", expected_bssid),
+	                              G_DBUS_CALL_FLAGS_NO_AUTO_START,
+	                              3000,
+	                              NULL,
+	                              &error);
+	g_assert_no_error (error);
+	g_assert (ret);
+	g_assert_cmpstr (g_variant_get_type_string (ret), ==, "(o)");
+	g_variant_get (ret, "(o)", &expected_path);
+	g_variant_unref (ret);
+
+	g_signal_connect (wifi,
+	                  "access-point-added",
+	                  (GCallback) wifi_ap_added_cb,
+	                  &info);
+	info.quit_count = 1;
+
+	g_signal_connect (wifi,
+	                  "notify::access-points",
+	                  (GCallback) wifi_ap_add_notify_cb,
+	                  &info);
+	info.quit_count++;
+
+	/* Wait for libnm to find the AP */
+	info.quit_id = g_timeout_add_seconds (5, loop_quit, loop);
+	g_main_loop_run (loop);
+
+	g_assert (info.signaled);
+	g_assert (info.notified);
+	g_assert (info.ap_path);
+	g_assert_cmpstr (info.ap_path, ==, expected_path);
+	g_signal_handlers_disconnect_by_func (wifi, wifi_ap_added_cb, &info);
+	g_signal_handlers_disconnect_by_func (wifi, wifi_ap_add_notify_cb, &info);
+
+	/*************************************/
+	/* Remove the wifi device */
+	info.signaled =  FALSE;
+	info.notified = FALSE;
+	info.quit_id = 0;
+
+	ret = g_dbus_proxy_call_sync (sinfo->proxy,
+	                              "RemoveWifiAp",
+	                              g_variant_new ("(so)", "wlan0", expected_path),
+	                              G_DBUS_CALL_FLAGS_NO_AUTO_START,
+	                              3000,
+	                              NULL,
+	                              &error);
+	g_assert_no_error (error);
+	g_clear_pointer (&ret, g_variant_unref);
+
+	g_signal_connect (wifi,
+	                  "access-point-removed",
+	                  (GCallback) wifi_ap_removed_cb,
+	                  &info);
+	info.quit_count = 1;
+
+	g_signal_connect (wifi,
+	                  "notify::access-points",
+	                  (GCallback) wifi_ap_remove_notify_cb,
+	                  &info);
+	info.quit_count++;
+
+	/* Wait for libnm to find the AP */
+	info.quit_id = g_timeout_add_seconds (5, loop_quit, loop);
+	g_main_loop_run (loop);
+
+	g_assert (info.signaled);
+	g_assert (info.notified);
+	g_signal_handlers_disconnect_by_func (wifi, wifi_ap_removed_cb, &info);
+	g_signal_handlers_disconnect_by_func (wifi, wifi_ap_remove_notify_cb, &info);
+
+	g_free (info.ap_path);
+	g_free (expected_path);
+
+	g_object_unref (client);
+	g_clear_pointer (&sinfo, nm_test_service_cleanup);
+}
+
+/*******************************************************************/
+
+static const char *expected_nsp_name = "Clear";
+
+typedef struct {
+	GMainLoop *loop;
+	gboolean found;
+	char *nsp_path;
+	gboolean signaled;
+	gboolean notified;
+	guint quit_id;
+	guint quit_count;
+} WimaxNspInfo;
+
+static void
+wimax_check_quit (WimaxNspInfo *info)
+{
+	info->quit_count--;
+	if (info->quit_count == 0) {
+		g_source_remove (info->quit_id);
+		info->quit_id = 0;
+		g_main_loop_quit (info->loop);
+	}
+}
+
+static void
+got_nsp_path (WimaxNspInfo *info, const char *path)
+{
+	if (info->nsp_path)
+		g_assert_cmpstr (info->nsp_path, ==, path);
+	else
+		info->nsp_path = g_strdup (path);
+}
+
+static void
+wimax_nsp_added_cb (NMDeviceWimax *w,
+                    NMWimaxNsp *nsp,
+                    WimaxNspInfo *info)
+{
+	g_assert (nsp);
+	g_assert_cmpstr (nm_wimax_nsp_get_name (nsp), ==, expected_nsp_name);
+	got_nsp_path (info, nm_object_get_path (NM_OBJECT (nsp)));
+
+	info->signaled = TRUE;
+	wimax_check_quit (info);
+}
+
+static void
+wimax_nsp_add_notify_cb (NMDeviceWimax *w,
+                         GParamSpec *pspec,
+                         WimaxNspInfo *info)
+{
+	const GPtrArray *nsps;
+	NMWimaxNsp *nsp;
+
+	nsps = nm_device_wimax_get_nsps (w);
+	g_assert (nsps);
+	g_assert_cmpint (nsps->len, ==, 1);
+
+	nsp = g_ptr_array_index (nsps, 0);
+	g_assert (nsp);
+	g_assert_cmpstr (nm_wimax_nsp_get_name (nsp), ==, expected_nsp_name);
+	got_nsp_path (info, nm_object_get_path (NM_OBJECT (nsp)));
+
+	info->notified = TRUE;
+	wimax_check_quit (info);
+}
+
+static void
+wimax_nsp_removed_cb (NMDeviceWimax *w,
+                      NMWimaxNsp *nsp,
+                      WimaxNspInfo *info)
+{
+	g_assert (nsp);
+	g_assert_cmpstr (info->nsp_path, ==, nm_object_get_path (NM_OBJECT (nsp)));
+
+	info->signaled = TRUE;
+	wimax_check_quit (info);
+}
+
+static void
+wimax_nsp_remove_notify_cb (NMDeviceWimax *w,
+                            GParamSpec *pspec,
+                            WimaxNspInfo *info)
+{
+	const GPtrArray *nsps;
+
+	nsps = nm_device_wimax_get_nsps (w);
+	g_assert (nsps->len == 0);
+
+	info->notified = TRUE;
+	wimax_check_quit (info);
+}
+
+static void
+test_wimax_nsp_added_removed (void)
+{
+	NMClient *client;
+	NMDeviceWimax *wimax;
+	WimaxNspInfo info = { loop, FALSE, FALSE, 0, 0 };
+	GVariant *ret;
+	GError *error = NULL;
+	char *expected_path = NULL;
+
+	sinfo = nm_test_service_init ();
+	client = nm_client_new (NULL, &error);
+	g_assert_no_error (error);
+
+	/*************************************/
+	/* Add the wimax device */
+	wimax = (NMDeviceWimax *) nm_test_service_add_device (sinfo, client, "AddWimaxDevice", "wmx0");
+	g_assert (NM_IS_DEVICE_WIMAX (wimax));
+
+	/*************************************/
+	/* Add the wimax NSP */
+	info.signaled =  FALSE;
+	info.notified = FALSE;
+	info.quit_id = 0;
+
+	ret = g_dbus_proxy_call_sync (sinfo->proxy,
+	                              "AddWimaxNsp",
+	                              g_variant_new ("(ss)", "wmx0", expected_nsp_name),
+	                              G_DBUS_CALL_FLAGS_NO_AUTO_START,
+	                              3000,
+	                              NULL,
+	                              &error);
+	g_assert_no_error (error);
+	g_assert (ret);
+	g_assert_cmpstr (g_variant_get_type_string (ret), ==, "(o)");
+	g_variant_get (ret, "(o)", &expected_path);
+	g_variant_unref (ret);
+
+	g_signal_connect (wimax,
+	                  "nsp-added",
+	                  (GCallback) wimax_nsp_added_cb,
+	                  &info);
+	info.quit_count = 1;
+
+	g_signal_connect (wimax,
+	                  "notify::nsps",
+	                  (GCallback) wimax_nsp_add_notify_cb,
+	                  &info);
+	info.quit_count++;
+
+	/* Wait for libnm to find the AP */
+	info.quit_id = g_timeout_add_seconds (5, loop_quit, loop);
+	g_main_loop_run (loop);
+
+	g_assert (info.signaled);
+	g_assert (info.notified);
+	g_assert (info.nsp_path);
+	g_assert_cmpstr (info.nsp_path, ==, expected_path);
+	g_signal_handlers_disconnect_by_func (wimax, wimax_nsp_added_cb, &info);
+	g_signal_handlers_disconnect_by_func (wimax, wimax_nsp_add_notify_cb, &info);
+
+	/*************************************/
+	/* Remove the wimax NSP */
+	info.signaled =  FALSE;
+	info.notified = FALSE;
+	info.quit_id = 0;
+
+	ret = g_dbus_proxy_call_sync (sinfo->proxy,
+	                              "RemoveWimaxNsp",
+	                              g_variant_new ("(so)", "wmx0", expected_path),
+	                              G_DBUS_CALL_FLAGS_NO_AUTO_START,
+	                              3000,
+	                              NULL,
+	                              &error);
+	g_assert_no_error (error);
+	g_clear_pointer (&ret, g_variant_unref);
+
+	g_signal_connect (wimax,
+	                  "nsp-removed",
+	                  (GCallback) wimax_nsp_removed_cb,
+	                  &info);
+	info.quit_count = 1;
+
+	g_signal_connect (wimax,
+	                  "notify::nsps",
+	                  (GCallback) wimax_nsp_remove_notify_cb,
+	                  &info);
+	info.quit_count++;
+
+	/* Wait for libnm to find the AP */
+	info.quit_id = g_timeout_add_seconds (5, loop_quit, loop);
+	g_main_loop_run (loop);
+
+	g_assert (info.signaled);
+	g_assert (info.notified);
+	g_signal_handlers_disconnect_by_func (wimax, wimax_nsp_removed_cb, &info);
+	g_signal_handlers_disconnect_by_func (wimax, wimax_nsp_remove_notify_cb, &info);
+
+	g_free (info.nsp_path);
+	g_free (expected_path);
+
+	g_object_unref (client);
+	g_clear_pointer (&sinfo, nm_test_service_cleanup);
+}
+
+/*******************************************************************/
+
+typedef struct {
+	GMainLoop *loop;
+	gboolean signaled;
+	gboolean notified;
+	guint quit_count;
+	guint quit_id;
+} DaInfo;
+
+static void
+da_check_quit (DaInfo *info)
+{
+	info->quit_count--;
+	if (info->quit_count == 0) {
+		g_source_remove (info->quit_id);
+		info->quit_id = 0;
+		g_main_loop_quit (info->loop);
+	}
+}
+
+static void
+da_device_removed_cb (NMClient *c,
+                      NMDevice *device,
+                      DaInfo *info)
+{
+	g_assert_cmpstr (nm_device_get_iface (device), ==, "eth0");
+	info->signaled = TRUE;
+	da_check_quit (info);
+}
+
+static void
+da_devices_notify_cb (NMClient *c,
+                      GParamSpec *pspec,
+                      DaInfo *info)
+{
+	const GPtrArray *devices;
+	NMDevice *device;
+	guint i;
+	const char *iface;
+
+	devices = nm_client_get_devices (c);
+	g_assert (devices);
+	g_assert_cmpint (devices->len, ==, 2);
+
+	for (i = 0; i < devices->len; i++) {
+		device = g_ptr_array_index (devices, i);
+		iface = nm_device_get_iface (device);
+
+		g_assert (!strcmp (iface, "wlan0") || !strcmp (iface, "eth1"));
+	}
+
+	info->notified = TRUE;
+	da_check_quit (info);
+}
+
+static void
+new_client_cb (GObject *object,
+               GAsyncResult *result,
+               gpointer user_data)
+{
+	NMClient **out_client = user_data;
+	GError *error = NULL;
+
+	*out_client = nm_client_new_finish (result, &error);
+	g_assert_no_error (error);
+	g_assert (*out_client != NULL);
+
+	g_main_loop_quit (loop);
+}
+
+static void
+test_devices_array (void)
+{
+	NMClient *client = NULL;
+	DaInfo info = { loop };
+	NMDevice *wlan0, *eth0, *eth1, *device;
+	const GPtrArray *devices;
+	GError *error = NULL;
+	GVariant *ret;
+
+	sinfo = nm_test_service_init ();
+
+	/* Make sure that we test the async codepath in at least one test... */
+	nm_client_new_async (NULL, new_client_cb, &client);
+	g_main_loop_run (loop);
+	g_assert (client != NULL);
+
+	/*************************************/
+	/* Add some devices */
+	wlan0 = nm_test_service_add_device (sinfo, client,"AddWifiDevice", "wlan0");
+	eth0 = nm_test_service_add_device (sinfo, client, "AddWiredDevice", "eth0");
+	eth1 = nm_test_service_add_device (sinfo, client, "AddWiredDevice", "eth1");
+
+	/* Ensure the devices now exist */
+	devices = nm_client_get_devices (client);
+	g_assert (devices);
+	g_assert_cmpint (devices->len, ==, 3);
+
+	device = nm_client_get_device_by_iface (client, "wlan0");
+	g_assert (NM_IS_DEVICE_WIFI (device));
+	g_assert (device == wlan0);
+
+	device = nm_client_get_device_by_iface (client, "eth0");
+	g_assert (NM_IS_DEVICE_ETHERNET (device));
+	g_assert (device == eth0);
+
+	device = nm_client_get_device_by_iface (client, "eth1");
+	g_assert (NM_IS_DEVICE_ETHERNET (device));
+	g_assert (device == eth1);
+
+	/********************************/
+	/* Now remove the device in the middle */
+	ret = g_dbus_proxy_call_sync (sinfo->proxy,
+	                              "RemoveDevice",
+	                              g_variant_new ("(o)", nm_object_get_path (NM_OBJECT (eth0))),
+	                              G_DBUS_CALL_FLAGS_NO_AUTO_START,
+	                              3000,
+	                              NULL,
+	                              &error);
+	g_assert_no_error (error);
+	g_assert (ret);
+	g_variant_unref (ret);
+
+	g_signal_connect (client,
+	                  "device-removed",
+	                  (GCallback) da_device_removed_cb,
+	                  &info);
+
+	g_signal_connect (client,
+	                  "notify::devices",
+	                  (GCallback) da_devices_notify_cb,
+	                  &info);
+	info.quit_count = 2;
+
+	/* Wait for libnm to notice the changes */
+	info.quit_id = g_timeout_add_seconds (5, loop_quit, loop);
+	g_main_loop_run (loop);
+
+	g_assert_cmpint (info.quit_count, ==, 0);
+	g_signal_handlers_disconnect_by_func (client, da_device_removed_cb, &info);
+	g_signal_handlers_disconnect_by_func (client, da_devices_notify_cb, &info);
+
+	/* Ensure only two are left */
+	devices = nm_client_get_devices (client);
+	g_assert (devices);
+	g_assert_cmpint (devices->len, ==, 2);
+
+	device = nm_client_get_device_by_iface (client, "wlan0");
+	g_assert (NM_IS_DEVICE_WIFI (device));
+	g_assert (device == wlan0);
+
+	device = nm_client_get_device_by_iface (client, "eth1");
+	g_assert (NM_IS_DEVICE_ETHERNET (device));
+	g_assert (device == eth1);
+
+	g_object_unref (client);
+	g_clear_pointer (&sinfo, nm_test_service_cleanup);
+}
+
+static void
+nm_running_changed (GObject *client,
+                    GParamSpec *pspec,
+                    gpointer user_data)
+{
+	int *running_changed = user_data;
+
+	(*running_changed)++;
+	g_main_loop_quit (loop);
+}
+
+static void
+test_client_nm_running (void)
+{
+	NMClient *client1, *client2;
+	guint quit_id;
+	int running_changed = 0;
+	GError *error = NULL;
+
+	client1 = nm_client_new (NULL, &error);
+	g_assert_no_error (error);
+
+	g_assert (!nm_client_get_nm_running (client1));
+	g_assert_cmpstr (nm_client_get_version (client1), ==, NULL);
+
+	g_assert (!nm_client_networking_get_enabled (client1));
+	/* This will have no effect, but it shouldn't cause any warnings either. */
+	nm_client_networking_set_enabled (client1, TRUE, NULL);
+	g_assert (!nm_client_networking_get_enabled (client1));
+
+	/* OTOH, this should result in an error */
+	nm_client_set_logging (client1, "DEFAULT", "INFO", &error);
+	g_assert_error (error, NM_CLIENT_ERROR, NM_CLIENT_ERROR_MANAGER_NOT_RUNNING);
+	g_clear_error (&error);
+
+	/* Now start the test service. */
+	sinfo = nm_test_service_init ();
+	client2 = nm_client_new (NULL, &error);
+	g_assert_no_error (error);
+
+	/* client2 should know that NM is running, but the previously-created
+	 * client1 hasn't gotten the news yet.
+	 */
+	g_assert (!nm_client_get_nm_running (client1));
+	g_assert (nm_client_get_nm_running (client2));
+
+	g_signal_connect (client1, "notify::" NM_CLIENT_NM_RUNNING,
+	                  G_CALLBACK (nm_running_changed), &running_changed);
+	quit_id = g_timeout_add_seconds (5, loop_quit, loop);
+	g_main_loop_run (loop);
+	g_assert_cmpint (running_changed, ==, 1);
+	g_assert (nm_client_get_nm_running (client1));
+	g_source_remove (quit_id);
+
+	/* And kill it */
+	g_clear_pointer (&sinfo, nm_test_service_cleanup);
+
+	g_assert (nm_client_get_nm_running (client1));
+
+	quit_id = g_timeout_add_seconds (5, loop_quit, loop);
+	g_main_loop_run (loop);
+	g_assert_cmpint (running_changed, ==, 2);
+	g_assert (!nm_client_get_nm_running (client1));
+	g_source_remove (quit_id);
+
+	g_object_unref (client1);
+	g_object_unref (client2);
+}
+
+typedef struct {
+	GMainLoop *loop;
+	NMActiveConnection *ac;
+
+	int remaining;
+} TestACInfo;
+
+static void
+assert_ac_and_device (NMClient *client)
+{
+	const GPtrArray *devices, *acs, *ac_devices;
+	NMDevice *device, *ac_device;
+	NMActiveConnection *ac, *device_ac;
+
+	acs = nm_client_get_active_connections (client);
+	g_assert (acs != NULL);
+	g_assert_cmpint (acs->len, ==, 1);
+	devices = nm_client_get_devices (client);
+	g_assert (devices != NULL);
+	g_assert_cmpint (devices->len, >=, 1);
+
+	ac = acs->pdata[0];
+	ac_devices = nm_active_connection_get_devices (ac);
+	g_assert (ac_devices != NULL);
+	g_assert_cmpint (ac_devices->len, ==, 1);
+	ac_device = ac_devices->pdata[0];
+	g_assert (ac_device != NULL);
+
+	device = devices->pdata[0];
+	if (device != ac_device && devices->len > 1)
+		device = devices->pdata[1];
+	device_ac = nm_device_get_active_connection (device);
+	g_assert (device_ac != NULL);
+
+	g_assert_cmpstr (nm_object_get_path (NM_OBJECT (device)), ==, nm_object_get_path (NM_OBJECT (ac_device)));
+	g_assert (device == ac_device);
+	g_assert_cmpstr (nm_object_get_path (NM_OBJECT (ac)), ==, nm_object_get_path (NM_OBJECT (device_ac)));
+	g_assert (ac == device_ac);
+}
+
+static void
+add_and_activate_cb (GObject *object,
+                     GAsyncResult *result,
+                     gpointer user_data)
+{
+	NMClient *client = NM_CLIENT (object);
+	TestACInfo *info = user_data;
+	GError *error = NULL;
+
+	info->ac = nm_client_add_and_activate_connection_finish (client, result, &error);
+	g_assert_no_error (error);
+	g_assert (info->ac != NULL);
+
+	assert_ac_and_device (client);
+
+	info->remaining--;
+	if (!info->remaining)
+		g_main_loop_quit (info->loop);
+}
+
+static void
+client_acs_changed_cb (GObject *client,
+                       GParamSpec *pspec,
+                       gpointer user_data)
+{
+	TestACInfo *info = user_data;
+	const GPtrArray *acs;
+
+	acs = nm_client_get_active_connections (NM_CLIENT (client));
+	g_assert (acs != NULL);
+	g_assert_cmpint (acs->len, ==, 1);
+
+	info->remaining--;
+	if (!info->remaining)
+		g_main_loop_quit (info->loop);
+}
+
+static void
+device_ac_changed_cb (GObject *device,
+                      GParamSpec *pspec,
+                      gpointer user_data)
+{
+	TestACInfo *info = user_data;
+
+	g_assert (nm_device_get_active_connection (NM_DEVICE (device)) != NULL);
+
+	info->remaining--;
+	if (!info->remaining)
+		g_main_loop_quit (info->loop);
+}
+
+static void
+test_active_connections (void)
+{
+	NMClient *client;
+	NMDevice *device;
+	NMConnection *conn;
+	TestACInfo info = { loop, NULL, 0 };
+	GError *error = NULL;
+
+	sinfo = nm_test_service_init ();
+	client = nm_client_new (NULL, &error);
+	g_assert_no_error (error);
+
+	/* Tell the test service to add a new device */
+	device = nm_test_service_add_device (sinfo, client, "AddWiredDevice", "eth0");
+
+	conn = nmtst_create_minimal_connection ("test-ac", NULL, NM_SETTING_WIRED_SETTING_NAME, NULL);
+	nm_client_add_and_activate_connection_async (client, conn, device, NULL,
+	                                             NULL, add_and_activate_cb, &info);
+	g_object_unref (conn);
+
+	g_signal_connect (client, "notify::" NM_CLIENT_ACTIVE_CONNECTIONS,
+	                  G_CALLBACK (client_acs_changed_cb), &info);
+	g_signal_connect (device, "notify::" NM_DEVICE_ACTIVE_CONNECTION,
+	                  G_CALLBACK (device_ac_changed_cb), &info);
+
+	/* Two signals plus activate_cb */
+	info.remaining = 3;
+	g_main_loop_run (loop);
+	g_signal_handlers_disconnect_by_func (client, client_acs_changed_cb, &info);
+	g_signal_handlers_disconnect_by_func (device, device_ac_changed_cb, &info);
+
+	g_assert (info.ac != NULL);
+
+	g_object_unref (info.ac);
+	g_object_unref (client);
+
+	/* Ensure that we can correctly resolve the recursive property link between the
+	 * AC and the Device in a newly-created client.
+	 */
+	client = nm_client_new (NULL, &error);
+	g_assert_no_error (error);
+	assert_ac_and_device (client);
+	g_object_unref (client);
+
+	client = NULL;
+	nm_client_new_async (NULL, new_client_cb, &client);
+	g_main_loop_run (loop);
+	assert_ac_and_device (client);
+	g_object_unref (client);
+
+	g_clear_pointer (&sinfo, nm_test_service_cleanup);
+}
+
+static void
+client_devices_changed_cb (GObject *client,
+                           GParamSpec *pspec,
+                           gpointer user_data)
+{
+	TestACInfo *info = user_data;
+	const GPtrArray *devices;
+	NMDevice *device;
+
+	devices = nm_client_get_devices (NM_CLIENT (client));
+	g_assert (devices != NULL);
+	if (devices->len < 2)
+		return;
+	g_assert_cmpint (devices->len, ==, 2);
+
+	if (NM_IS_DEVICE_VLAN (devices->pdata[0]))
+		device = devices->pdata[0];
+	else if (NM_IS_DEVICE_VLAN (devices->pdata[1]))
+		device = devices->pdata[1];
+	else
+		g_assert_not_reached ();
+
+	g_assert_cmpstr (nm_device_get_iface (device), ==, "eth0.1");
+
+	if (nm_device_get_active_connection (device))
+		info->remaining--;
+	else {
+		g_signal_connect (device, "notify::" NM_DEVICE_ACTIVE_CONNECTION,
+		                  G_CALLBACK (device_ac_changed_cb), info);
+	}
+
+	info->remaining--;
+	if (!info->remaining)
+		g_main_loop_quit (info->loop);
+}
+
+typedef struct {
+	GMainLoop *loop;
+	NMRemoteConnection *remote;
+} TestConnectionInfo;
+
+static void
+add_connection_cb (GObject *object,
+                   GAsyncResult *result,
+                   gpointer user_data)
+{
+	TestConnectionInfo *info = user_data;
+	GError *error = NULL;
+
+	info->remote = nm_client_add_connection_finish (NM_CLIENT (object), result, &error);
+	g_assert_no_error (error);
+	g_main_loop_quit (info->loop);
+}
+
+static void
+activate_cb (GObject *object,
+             GAsyncResult *result,
+             gpointer user_data)
+{
+	NMClient *client = NM_CLIENT (object);
+	TestACInfo *info = user_data;
+	GError *error = NULL;
+
+	info->ac = nm_client_activate_connection_finish (client, result, &error);
+	g_assert_no_error (error);
+	g_assert (info->ac != NULL);
+
+	assert_ac_and_device (client);
+
+	info->remaining--;
+	if (!info->remaining)
+		g_main_loop_quit (info->loop);
+}
+
+static void
+test_activate_virtual (void)
+{
+	NMClient *client;
+	NMConnection *conn;
+	NMSettingConnection *s_con;
+	NMSettingVlan *s_vlan;
+	TestACInfo info = { loop, NULL, 0 };
+	TestConnectionInfo conn_info = { loop, NULL };
+	GError *error = NULL;
+
+	sinfo = nm_test_service_init ();
+	client = nm_client_new (NULL, &error);
+	g_assert_no_error (error);
+
+	nm_test_service_add_device (sinfo, client, "AddWiredDevice", "eth0");
+
+	conn = nmtst_create_minimal_connection ("test-ac", NULL, NM_SETTING_VLAN_SETTING_NAME, &s_con);
+	g_object_set (s_con,
+	              NM_SETTING_CONNECTION_INTERFACE_NAME, "eth0.1",
+	              NULL);
+	s_vlan = nm_connection_get_setting_vlan (conn);
+	g_object_set (s_vlan,
+	              NM_SETTING_VLAN_ID, 1,
+	              NM_SETTING_VLAN_PARENT, "eth0",
+	              NULL);
+
+	nm_client_add_connection_async (client, conn, TRUE,
+	                                NULL, add_connection_cb, &conn_info);
+	g_main_loop_run (loop);
+	g_object_unref (conn);
+	conn = NM_CONNECTION (conn_info.remote);
+
+	nm_client_activate_connection_async (client, conn, NULL, NULL,
+	                                     NULL, activate_cb, &info);
+	g_object_unref (conn);
+
+	g_signal_connect (client, "notify::" NM_CLIENT_ACTIVE_CONNECTIONS,
+	                  G_CALLBACK (client_acs_changed_cb), &info);
+	g_signal_connect (client, "notify::" NM_CLIENT_DEVICES,
+	                  G_CALLBACK (client_devices_changed_cb), &info);
+
+	/* As with test_active_connections() above, except that now we're waiting
+	 * for NMClient:devices to change rather than NMDevice:active-connections.
+	 */
+	info.remaining = 3;
+
+	g_main_loop_run (loop);
+	g_signal_handlers_disconnect_by_func (client, client_acs_changed_cb, &info);
+	g_signal_handlers_disconnect_by_func (client, client_devices_changed_cb, &info);
+
+	g_assert (info.ac != NULL);
+
+	g_object_unref (info.ac);
+	g_object_unref (client);
+
+	g_clear_pointer (&sinfo, nm_test_service_cleanup);
+}
+
+static void
+activate_failed_cb (GObject *object,
+                    GAsyncResult *result,
+                    gpointer user_data)
+{
+	NMClient *client = NM_CLIENT (object);
+	NMActiveConnection *ac;
+	GError *error = NULL;
+
+	ac = nm_client_activate_connection_finish (client, result, &error);
+	g_assert (ac == NULL);
+	g_assert_error (error, NM_CLIENT_ERROR, NM_CLIENT_ERROR_OBJECT_CREATION_FAILED);
+	g_clear_error (&error);
+
+	g_main_loop_quit (loop);
+}
+
+static void
+test_activate_failed (void)
+{
+	NMClient *client;
+	NMDevice *device;
+	NMConnection *conn;
+	GError *error = NULL;
+
+	sinfo = nm_test_service_init ();
+	client = nm_client_new (NULL, &error);
+	g_assert_no_error (error);
+
+	device = nm_test_service_add_device (sinfo, client, "AddWiredDevice", "eth0");
+
+	/* Note that test-networkmanager-service.py checks for this exact name */
+	conn = nmtst_create_minimal_connection ("object-creation-failed-test", NULL,
+	                                        NM_SETTING_WIRED_SETTING_NAME, NULL);
+
+	nm_client_add_and_activate_connection_async (client, conn, device, NULL,
+	                                             NULL, activate_failed_cb, NULL);
+	g_main_loop_run (loop);
+
+	g_object_unref (conn);
+	g_object_unref (client);
+
+	g_clear_pointer (&sinfo, nm_test_service_cleanup);
+}
+
+/*******************************************************************/
+
+NMTST_DEFINE ();
+
+int
+main (int argc, char **argv)
+{
+	g_setenv ("LIBNM_USE_SESSION_BUS", "1", TRUE);
+
+#if !GLIB_CHECK_VERSION (2, 35, 0)
+	g_type_init ();
+#endif
+
+	nmtst_init (&argc, &argv, TRUE);
+
+	loop = g_main_loop_new (NULL, FALSE);
+
+	g_test_add_func ("/libnm/device-added", test_device_added);
+	g_test_add_func ("/libnm/device-added-signal-after-init", test_device_added_signal_after_init);
+	g_test_add_func ("/libnm/wifi-ap-added-removed", test_wifi_ap_added_removed);
+	g_test_add_func ("/libnm/wimax-nsp-added-removed", test_wimax_nsp_added_removed);
+	g_test_add_func ("/libnm/devices-array", test_devices_array);
+	g_test_add_func ("/libnm/client-nm-running", test_client_nm_running);
+	g_test_add_func ("/libnm/active-connections", test_active_connections);
+	g_test_add_func ("/libnm/activate-virtual", test_activate_virtual);
+	g_test_add_func ("/libnm/activate-failed", test_activate_failed);
+
+	return g_test_run ();
+}
+
diff --git a/libnm/tests/test-remote-settings-client.c b/libnm/tests/test-remote-settings-client.c
new file mode 100644
index 00000000..8f9dc27f
--- /dev/null
+++ b/libnm/tests/test-remote-settings-client.c
@@ -0,0 +1,547 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright 2010 - 2011 Red Hat, Inc.
+ *
+ */
+
+#include "config.h"
+
+#include <glib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <signal.h>
+
+#include <NetworkManager.h>
+
+#include "common.h"
+
+#include "nm-test-utils.h"
+
+static NMTestServiceInfo *sinfo;
+static NMClient *client = NULL;
+GDBusConnection *bus = NULL;
+NMRemoteConnection *remote = NULL;
+
+/*******************************************************************/
+
+static void
+add_cb (GObject *s,
+        GAsyncResult *result,
+        gpointer user_data)
+{
+	gboolean *done = user_data;
+	GError *error = NULL;
+
+	remote = nm_client_add_connection_finish (client, result, &error);
+	g_assert_no_error (error);
+
+	*done = TRUE;
+	g_object_add_weak_pointer (G_OBJECT (remote), (void **) &remote);
+
+	/* nm_client_add_connection_finish() adds a ref to @remote, but we
+	 * want the weak pointer to be cleared as soon as @client drops its own ref.
+	 * So drop ours.
+	 */
+	g_object_unref (remote);
+}
+
+#define TEST_CON_ID "blahblahblah"
+
+static void
+test_add_connection (void)
+{
+	NMConnection *connection;
+	time_t start, now;
+	gboolean done = FALSE;
+
+	connection = nmtst_create_minimal_connection (TEST_CON_ID, NULL, NM_SETTING_WIRED_SETTING_NAME, NULL);
+
+	nm_client_add_connection_async (client,
+	                                connection,
+	                                TRUE,
+	                                NULL,
+	                                add_cb,
+	                                &done);
+
+	start = time (NULL);
+	do {
+		now = time (NULL);
+		g_main_context_iteration (NULL, FALSE);
+	} while ((done == FALSE) && (now - start < 5));
+	g_assert (done == TRUE);
+	g_assert (remote != NULL);
+
+	/* Make sure the connection is the same as what we added */
+	g_assert (nm_connection_compare (connection,
+	                                 NM_CONNECTION (remote),
+	                                 NM_SETTING_COMPARE_FLAG_EXACT) == TRUE);
+	g_object_unref (connection);
+}
+
+/*******************************************************************/
+
+static void
+set_visible_cb (GObject *proxy,
+                GAsyncResult *result,
+                gpointer user_data)
+{
+	GError *error = NULL;
+	GVariant *ret;
+
+	ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), result, &error);
+	g_assert_no_error (error);
+	g_variant_unref (ret);
+}
+
+static void
+visible_changed_cb (GObject *object, GParamSpec *pspec, gboolean *done)
+{
+	if (!nm_remote_connection_get_visible (NM_REMOTE_CONNECTION (object)))
+		*done = TRUE;
+}
+
+static void
+connection_removed_cb (NMClient *s, NMRemoteConnection *connection, gboolean *done)
+{
+	if (connection == remote)
+		*done = TRUE;
+}
+
+static void
+invis_has_settings_cb (NMSetting *setting,
+                       const char *key,
+                       const GValue *value,
+                       GParamFlags flags,
+                       gpointer user_data)
+{
+	*((gboolean *) user_data) = TRUE;
+}
+
+static void
+test_make_invisible (void)
+{
+	time_t start, now;
+	const GPtrArray *conns;
+	int i;
+	GDBusProxy *proxy;
+	gboolean visible_changed = FALSE, connection_removed = FALSE;
+	gboolean has_settings = FALSE;
+	char *path;
+
+	g_assert (remote != NULL);
+
+	/* Listen for the remove event when the connection becomes invisible */
+	g_signal_connect (remote, "notify::" NM_REMOTE_CONNECTION_VISIBLE, G_CALLBACK (visible_changed_cb), &visible_changed);
+	g_signal_connect (client, "connection-removed", G_CALLBACK (connection_removed_cb), &connection_removed);
+
+	path = g_strdup (nm_connection_get_path (NM_CONNECTION (remote)));
+	proxy = g_dbus_proxy_new_sync (bus,
+	                               G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
+	                               NULL,
+	                               NM_DBUS_SERVICE,
+	                               path,
+	                               NM_DBUS_INTERFACE_SETTINGS_CONNECTION,
+	                               NULL,
+	                               NULL);
+	g_assert (proxy != NULL);
+
+	/* Bypass the NMClient object so we can test it independently */
+	g_dbus_proxy_call (proxy,
+	                   "SetVisible",
+	                   g_variant_new ("(b)", FALSE),
+	                   G_DBUS_CALL_FLAGS_NONE, -1,
+	                   NULL,
+	                   set_visible_cb, NULL);
+
+	/* Wait for the connection to be removed */
+	start = time (NULL);
+	do {
+		now = time (NULL);
+		g_main_context_iteration (NULL, FALSE);
+	} while ((!visible_changed || !connection_removed) && (now - start < 5));
+	g_assert (visible_changed == TRUE);
+	g_assert (connection_removed == TRUE);
+
+	g_signal_handlers_disconnect_by_func (remote, G_CALLBACK (visible_changed_cb), &visible_changed);
+	g_signal_handlers_disconnect_by_func (client, G_CALLBACK (connection_removed_cb), &connection_removed);
+
+	/* Ensure NMClient no longer has the connection */
+	conns = nm_client_get_connections (client);
+	for (i = 0; i < conns->len; i++) {
+		NMConnection *candidate = NM_CONNECTION (conns->pdata[i]);
+
+		g_assert ((gpointer) remote != (gpointer) candidate);
+		g_assert (strcmp (path, nm_connection_get_path (candidate)) != 0);
+	}
+
+	/* And ensure the invisible connection no longer has any settings */
+	g_assert (remote);
+	nm_connection_for_each_setting_value (NM_CONNECTION (remote),
+	                                      invis_has_settings_cb,
+	                                      &has_settings);
+	g_assert (has_settings == FALSE);
+
+	g_free (path);
+	g_object_unref (proxy);
+}
+
+/*******************************************************************/
+
+static void
+vis_new_connection_cb (NMClient *foo,
+                       NMRemoteConnection *connection,
+                       NMRemoteConnection **new)
+{
+	*new = connection;
+}
+
+static void
+test_make_visible (void)
+{
+	time_t start, now;
+	const GPtrArray *conns;
+	int i;
+	GDBusProxy *proxy;
+	gboolean found = FALSE;
+	char *path;
+	NMRemoteConnection *new = NULL;
+
+	g_assert (remote != NULL);
+
+	/* Wait for the new-connection signal when the connection is visible again */
+	g_signal_connect (client, NM_CLIENT_CONNECTION_ADDED,
+	                  G_CALLBACK (vis_new_connection_cb), &new);
+
+	path = g_strdup (nm_connection_get_path (NM_CONNECTION (remote)));
+	proxy = g_dbus_proxy_new_sync (bus,
+	                               G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
+	                               NULL,
+	                               NM_DBUS_SERVICE,
+	                               path,
+	                               NM_DBUS_INTERFACE_SETTINGS_CONNECTION,
+	                               NULL,
+	                               NULL);
+	g_assert (proxy != NULL);
+
+	/* Bypass the NMClient object so we can test it independently */
+	g_dbus_proxy_call (proxy,
+	                   "SetVisible",
+	                   g_variant_new ("(b)", TRUE),
+	                   G_DBUS_CALL_FLAGS_NONE, -1,
+	                   NULL,
+	                   set_visible_cb, NULL);
+
+	/* Wait for the settings service to announce the connection again */
+	start = time (NULL);
+	do {
+		now = time (NULL);
+		g_main_context_iteration (NULL, FALSE);
+	} while ((new == NULL) && (now - start < 5));
+
+	/* Ensure the new connection is the same as the one we made visible again */
+	g_assert (new);
+	g_assert (new == remote);
+
+	g_signal_handlers_disconnect_by_func (client, G_CALLBACK (vis_new_connection_cb), &new);
+
+	/* Ensure NMClient has the connection */
+	conns = nm_client_get_connections (client);
+	for (i = 0; i < conns->len; i++) {
+		NMConnection *candidate = NM_CONNECTION (conns->pdata[i]);
+
+		if ((gpointer) remote == (gpointer) candidate) {
+			g_assert_cmpstr (path, ==, nm_connection_get_path (candidate));
+			g_assert_cmpstr (TEST_CON_ID, ==, nm_connection_get_id (candidate));
+			found = TRUE;
+			break;
+		}
+	}
+	g_assert (found == TRUE);
+
+	g_free (path);
+	g_object_unref (proxy);
+}
+
+/*******************************************************************/
+
+static void
+deleted_cb (GObject *proxy,
+            GAsyncResult *result,
+            gpointer user_data)
+{
+	GError *error = NULL;
+	GVariant *ret;
+
+	ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), result, &error);
+	g_assert_no_error (error);
+	g_variant_unref (ret);
+}
+
+static void
+removed_cb (NMClient *s, NMRemoteConnection *connection, gboolean *done)
+{
+	if (connection == remote)
+		*done = TRUE;
+}
+
+static void
+test_remove_connection (void)
+{
+	NMRemoteConnection *connection;
+	time_t start, now;
+	const GPtrArray *conns;
+	int i;
+	GDBusProxy *proxy;
+	gboolean done = FALSE;
+	char *path;
+
+	/* Find a connection to delete */
+	conns = nm_client_get_connections (client);
+	g_assert_cmpint (conns->len, >, 0);
+
+	connection = NM_REMOTE_CONNECTION (conns->pdata[0]);
+	g_assert (connection);
+	g_assert (remote == connection);
+	path = g_strdup (nm_connection_get_path (NM_CONNECTION (connection)));
+	g_signal_connect (client, "connection-removed", G_CALLBACK (removed_cb), &done);
+
+	proxy = g_dbus_proxy_new_sync (bus,
+	                               G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
+	                               NULL,
+	                               NM_DBUS_SERVICE,
+	                               path,
+	                               NM_DBUS_INTERFACE_SETTINGS_CONNECTION,
+	                               NULL,
+	                               NULL);
+	g_assert (proxy != NULL);
+
+	/* Bypass the NMClient object so we can test it independently */
+	g_dbus_proxy_call (proxy,
+	                   "Delete",
+	                   NULL,
+	                   G_DBUS_CALL_FLAGS_NONE, -1,
+	                   NULL,
+	                   deleted_cb, NULL);
+
+	start = time (NULL);
+	do {
+		now = time (NULL);
+		g_main_context_iteration (NULL, FALSE);
+	} while ((done == FALSE) && (now - start < 5));
+	g_assert (done == TRUE);
+
+	g_assert (!remote);
+
+	/* Ensure NMClient no longer has the connection */
+	conns = nm_client_get_connections (client);
+	for (i = 0; i < conns->len; i++) {
+		NMConnection *candidate = NM_CONNECTION (conns->pdata[i]);
+
+		g_assert ((gpointer) connection != (gpointer) candidate);
+		g_assert_cmpstr (path, ==, nm_connection_get_path (candidate));
+	}
+
+	g_free (path);
+	g_object_unref (proxy);
+}
+
+/*******************************************************************/
+
+#define TEST_ADD_REMOVE_ID "add-remove-test-connection"
+
+static void
+add_remove_cb (GObject *s,
+               GAsyncResult *result,
+               gpointer user_data)
+{
+	NMRemoteConnection *connection;
+	gboolean *done = user_data;
+	GError *error = NULL;
+
+	connection = nm_client_add_connection_finish (client, result, &error);
+	g_assert_error (error, NM_CLIENT_ERROR, NM_CLIENT_ERROR_OBJECT_CREATION_FAILED);
+	g_assert (connection == NULL);
+
+	*done = TRUE;
+}
+
+static void
+test_add_remove_connection (void)
+{
+	GVariant *ret;
+	GError *error = NULL;
+	NMConnection *connection;
+	time_t start, now;
+	gboolean done = FALSE;
+
+	/* This will cause the test server to immediately delete the connection
+	 * after creating it.
+	 */
+	ret = g_dbus_proxy_call_sync (sinfo->proxy,
+	                              "AutoRemoveNextConnection",
+	                              NULL,
+	                              G_DBUS_CALL_FLAGS_NONE, -1,
+	                              NULL,
+	                              &error);
+	g_assert_no_error (error);
+	g_variant_unref (ret);
+
+	connection = nmtst_create_minimal_connection (TEST_ADD_REMOVE_ID, NULL, NM_SETTING_WIRED_SETTING_NAME, NULL);
+	nm_client_add_connection_async (client,
+	                                connection,
+	                                TRUE,
+	                                NULL,
+	                                add_remove_cb,
+	                                &done);
+
+	start = time (NULL);
+	do {
+		now = time (NULL);
+		g_main_context_iteration (NULL, FALSE);
+	} while ((done == FALSE) && (now - start < 5));
+	g_assert (done == TRUE);
+
+	g_object_unref (connection);
+}
+
+/*******************************************************************/
+
+static void
+add_bad_cb (GObject *s,
+            GAsyncResult *result,
+            gpointer user_data)
+{
+	gboolean *done = user_data;
+	GError *error = NULL;
+
+	remote = nm_client_add_connection_finish (client, result, &error);
+	g_assert_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY);
+
+	*done = TRUE;
+}
+
+static void
+test_add_bad_connection (void)
+{
+	NMConnection *connection;
+	time_t start, now;
+	gboolean done = FALSE;
+
+	/* The test daemon doesn't support bond connections */
+	connection = nmtst_create_minimal_connection ("bad connection test", NULL, NM_SETTING_BOND_SETTING_NAME, NULL);
+
+	nm_client_add_connection_async (client,
+	                                connection,
+	                                TRUE,
+	                                NULL,
+	                                add_bad_cb,
+	                                &done);
+	g_object_unref (connection);
+
+	start = time (NULL);
+	do {
+		now = time (NULL);
+		g_main_context_iteration (NULL, FALSE);
+	} while ((done == FALSE) && (now - start < 5));
+	g_assert (done == TRUE);
+	g_assert (remote == NULL);
+}
+
+/*******************************************************************/
+
+static void
+save_hostname_cb (GObject *s,
+                  GAsyncResult *result,
+                  gpointer user_data)
+{
+	gboolean *done = user_data;
+	GError *error = NULL;
+
+	nm_client_save_hostname_finish (client, result, &error);
+	g_assert_no_error (error);
+
+	*done = TRUE;
+}
+
+static void
+test_save_hostname (void)
+{
+	time_t start, now;
+	gboolean done = FALSE;
+	GError *error = NULL;
+
+	/* test-networkmanager-service.py requires the hostname to contain a '.' */
+	nm_client_save_hostname (client, "foo", NULL, &error);
+	g_assert_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_HOSTNAME);
+	g_clear_error (&error);
+
+	nm_client_save_hostname_async (client, "example.com", NULL, save_hostname_cb, &done);
+
+	start = time (NULL);
+	do {
+		now = time (NULL);
+		g_main_context_iteration (NULL, FALSE);
+	} while ((done == FALSE) && (now - start < 5));
+	g_assert (done == TRUE);
+	g_assert (remote == NULL);
+}
+
+/*******************************************************************/
+
+int
+main (int argc, char **argv)
+{
+	int ret;
+	GError *error = NULL;
+
+	g_setenv ("LIBNM_USE_SESSION_BUS", "1", TRUE);
+
+#if !GLIB_CHECK_VERSION (2, 35, 0)
+	g_type_init ();
+#endif
+	
+	g_test_init (&argc, &argv, NULL);
+
+	bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
+	g_assert_no_error (error);
+
+	sinfo = nm_test_service_init ();
+
+	client = nm_client_new (NULL, &error);
+	g_assert_no_error (error);
+	g_assert (client != NULL);
+
+	/* FIXME: these tests assume that they get run in order, but g_test_run()
+	 * does not actually guarantee that!
+	 */
+	g_test_add_func ("/client/add_connection", test_add_connection);
+	g_test_add_func ("/client/make_invisible", test_make_invisible);
+	g_test_add_func ("/client/make_visible", test_make_visible);
+	g_test_add_func ("/client/remove_connection", test_remove_connection);
+	g_test_add_func ("/client/add_remove_connection", test_add_remove_connection);
+	g_test_add_func ("/client/add_bad_connection", test_add_bad_connection);
+	g_test_add_func ("/client/save_hostname", test_save_hostname);
+
+	ret = g_test_run ();
+
+	nm_test_service_cleanup (sinfo);
+	g_object_unref (client);
+	g_object_unref (bus);
+
+	return ret;
+}
+
diff --git a/libnm/tests/test-secret-agent.c b/libnm/tests/test-secret-agent.c
new file mode 100644
index 00000000..0424b74e
--- /dev/null
+++ b/libnm/tests/test-secret-agent.c
@@ -0,0 +1,655 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright 2010 - 2014 Red Hat, Inc.
+ *
+ */
+
+#include "config.h"
+
+#include <glib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <signal.h>
+
+#include <NetworkManager.h>
+#include <nm-secret-agent-old.h>
+#include "nm-glib-compat.h"
+#include "nm-test-utils.h"
+
+#include "common.h"
+
+/*******************************************************************/
+
+enum {
+	SECRET_REQUESTED,
+
+	LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+typedef NMSecretAgentOld TestSecretAgent;
+typedef NMSecretAgentOldClass TestSecretAgentClass;
+
+GType test_secret_agent_get_type (void);
+G_DEFINE_TYPE (TestSecretAgent, test_secret_agent, NM_TYPE_SECRET_AGENT_OLD)
+
+static void
+test_secret_agent_init (TestSecretAgent *agent)
+{
+}
+
+static void
+test_secret_agent_get_secrets (NMSecretAgentOld                 *agent,
+                               NMConnection                     *connection,
+                               const char                       *connection_path,
+                               const char                       *setting_name,
+                               const char                      **hints,
+                               NMSecretAgentGetSecretsFlags      flags,
+                               NMSecretAgentOldGetSecretsFunc    callback,
+                               gpointer                          callback_data)
+{
+	NMSettingWirelessSecurity *s_wsec;
+	GVariant *secrets = NULL;
+	GVariantBuilder secrets_builder, setting_builder;
+	char *secret = NULL;
+	GError *error = NULL;
+
+	g_assert_cmpstr (setting_name, ==, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
+
+	s_wsec = nm_connection_get_setting_wireless_security (connection);
+	g_assert (s_wsec);
+	g_assert_cmpstr (nm_setting_wireless_security_get_key_mgmt (s_wsec), ==, "wpa-psk");
+	g_assert_cmpstr (nm_setting_wireless_security_get_psk (s_wsec), ==, NULL);
+
+	g_signal_emit (agent, signals[SECRET_REQUESTED], 0,
+	               connection,
+	               connection_path,
+	               NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+	               NM_SETTING_WIRELESS_SECURITY_PSK,
+	               &secret);
+
+	if (!secret) {
+		error = g_error_new (NM_SECRET_AGENT_ERROR, NM_SECRET_AGENT_ERROR_NO_SECRETS,
+		                     "No secrets");
+		goto done;
+	}
+
+	if (!strcmp (secret, "CANCEL")) {
+		error = g_error_new (NM_SECRET_AGENT_ERROR, NM_SECRET_AGENT_ERROR_USER_CANCELED,
+		                     "User canceled");
+		goto done;
+	}
+
+	g_variant_builder_init (&setting_builder, NM_VARIANT_TYPE_SETTING);
+	g_variant_builder_add (&setting_builder, "{sv}",
+	                       NM_SETTING_WIRELESS_SECURITY_PSK,
+	                       g_variant_new_string (secret));
+
+	g_variant_builder_init (&secrets_builder, NM_VARIANT_TYPE_CONNECTION);
+	g_variant_builder_add (&secrets_builder, "{sa{sv}}",
+	                       setting_name,
+	                       &setting_builder);
+	secrets = g_variant_ref_sink (g_variant_builder_end (&secrets_builder));
+
+done:
+	callback (agent, connection, secrets, error, callback_data);
+	g_clear_error (&error);
+	g_clear_pointer (&secrets, g_variant_unref);
+	g_free (secret);
+}
+
+static void
+test_secret_agent_cancel_get_secrets (NMSecretAgentOld *agent,
+                                      const gchar      *connection_path,
+                                      const gchar      *setting_name)
+{
+	g_assert_not_reached ();
+}
+
+static void
+test_secret_agent_save_secrets (NMSecretAgentOld                *agent,
+                                NMConnection                    *connection,
+                                const gchar                     *connection_path,
+                                NMSecretAgentOldSaveSecretsFunc  callback,
+                                gpointer                         callback_data)
+{
+	g_assert_not_reached ();
+}
+
+static void
+test_secret_agent_delete_secrets (NMSecretAgentOld                  *agent,
+                                  NMConnection                      *connection,
+                                  const gchar                       *connection_path,
+                                  NMSecretAgentOldDeleteSecretsFunc  callback,
+                                  gpointer                           callback_data)
+{
+	g_assert_not_reached ();
+}
+
+static void
+test_secret_agent_class_init (TestSecretAgentClass *klass)
+{
+	GObjectClass *object_class = G_OBJECT_CLASS (klass);
+	NMSecretAgentOldClass *agent_class = NM_SECRET_AGENT_OLD_CLASS (klass);
+
+	agent_class->get_secrets = test_secret_agent_get_secrets;
+	agent_class->cancel_get_secrets = test_secret_agent_cancel_get_secrets;
+	agent_class->save_secrets = test_secret_agent_save_secrets;
+	agent_class->delete_secrets = test_secret_agent_delete_secrets;
+
+	signals[SECRET_REQUESTED] =
+		g_signal_new ("secret-requested",
+		              G_OBJECT_CLASS_TYPE (object_class),
+		              G_SIGNAL_RUN_LAST,
+		              0, NULL, NULL, NULL,
+		              G_TYPE_STRING, 4,
+		              NM_TYPE_CONNECTION,
+		              G_TYPE_STRING,
+		              G_TYPE_STRING,
+		              G_TYPE_STRING);
+
+}
+
+static NMSecretAgentOld *
+test_secret_agent_new (void)
+{
+	NMSecretAgentOld *agent;
+	GError *error = NULL;
+
+	agent = g_initable_new (test_secret_agent_get_type (), NULL, &error,
+	                        NM_SECRET_AGENT_OLD_IDENTIFIER, "test-secret-agent",
+	                        NM_SECRET_AGENT_OLD_AUTO_REGISTER, FALSE,
+	                        NULL);
+	g_assert_no_error (error);
+
+	return agent;
+}
+
+/*******************************************************************/
+
+typedef struct {
+	NMTestServiceInfo *sinfo;
+	NMClient *client;
+
+	NMSecretAgentOld *agent;
+	NMDevice *device;
+	NMConnection *connection;
+
+	GMainLoop *loop;
+	guint timeout_id;
+
+	char *ifname;
+	char *con_id;
+
+	int secrets_requested;
+} TestSecretAgentData;
+
+static gboolean
+timeout_assert (gpointer user_data)
+{
+	g_assert_not_reached ();
+}
+
+static void
+connection_added_cb (GObject *s,
+                     GAsyncResult *result,
+                     gpointer user_data)
+{
+	TestSecretAgentData *sadata = user_data;
+	NMRemoteConnection *connection;
+	GError *error = NULL;
+
+	connection = nm_client_add_connection_finish (sadata->client, result, &error);
+
+	g_assert_no_error (error);
+	g_assert_cmpstr (nm_connection_get_id (NM_CONNECTION (connection)), ==, sadata->con_id);
+
+	sadata->connection = NM_CONNECTION (connection);
+	g_main_loop_quit (sadata->loop);
+}
+
+static void
+register_cb (GObject *object, GAsyncResult *result, gpointer user_data)
+{
+	TestSecretAgentData *sadata = user_data;
+	GError *error = NULL;
+
+	nm_secret_agent_old_register_finish (sadata->agent, result, &error);
+	g_assert_no_error (error);
+	g_assert (nm_secret_agent_old_get_registered (sadata->agent));
+
+	g_main_loop_quit (sadata->loop);
+}
+
+#define TEST_CON_ID_PREFIX "test-secret-agent"
+
+static void
+test_setup (TestSecretAgentData *sadata, gconstpointer test_data)
+{
+	static int counter = 0;
+	const char *agent_notes = test_data;
+	NMConnection *connection;
+	NMSettingConnection *s_con;
+	NMSettingWireless *s_wireless;
+	GBytes *ssid;
+	NMSetting *s_wsec;
+	GError *error = NULL;
+
+	sadata->sinfo = nm_test_service_init ();
+	sadata->client = nm_client_new (NULL, &error);
+	g_assert_no_error (error);
+
+	sadata->loop = g_main_loop_new (NULL, FALSE);
+	sadata->timeout_id = g_timeout_add_seconds (5, timeout_assert, NULL);
+
+	sadata->ifname = g_strdup_printf ("wlan%d", counter);
+	sadata->con_id = g_strdup_printf ("%s-%d", TEST_CON_ID_PREFIX, counter);
+	counter++;
+
+	/* Create the device */
+	sadata->device = nm_test_service_add_device (sadata->sinfo, sadata->client,
+	                                             "AddWifiDevice", sadata->ifname);
+
+	/* Create the connection */
+	connection = nmtst_create_minimal_connection (sadata->con_id, NULL, NM_SETTING_WIRELESS_SETTING_NAME, &s_con);
+	g_object_set (s_con,
+	              NM_SETTING_CONNECTION_INTERFACE_NAME, sadata->ifname,
+	              NULL);
+
+	s_wireless = nm_connection_get_setting_wireless (connection);
+	ssid = g_bytes_new ("foo", 3);
+	g_object_set (s_wireless,
+	              NM_SETTING_WIRELESS_SSID, ssid,
+	              NULL);
+	g_bytes_unref (ssid);
+
+	s_wsec = g_object_new (NM_TYPE_SETTING_WIRELESS_SECURITY,
+	                       NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-psk",
+	                       NULL);
+	nm_connection_add_setting (connection, s_wsec);
+
+	nm_client_add_connection_async (sadata->client,
+	                                connection,
+	                                TRUE,
+	                                NULL,
+	                                connection_added_cb,
+	                                sadata);
+	g_object_unref (connection);
+
+	g_main_loop_run (sadata->loop);
+	g_assert (sadata->connection);
+
+	if (agent_notes) {
+		sadata->agent = test_secret_agent_new ();
+
+		if (!strcmp (agent_notes, "sync")) {
+			nm_secret_agent_old_register (sadata->agent, NULL, &error);
+			g_assert_no_error (error);
+			g_assert (nm_secret_agent_old_get_registered (sadata->agent));
+		} else {
+			nm_secret_agent_old_register_async (sadata->agent, NULL,
+			                                register_cb, sadata);
+			g_main_loop_run (sadata->loop);
+		}
+	}
+}
+
+static void
+test_cleanup (TestSecretAgentData *sadata, gconstpointer test_data)
+{
+	GVariant *ret;
+	GError *error = NULL;
+
+	if (sadata->agent) {
+		if (nm_secret_agent_old_get_registered (sadata->agent)) {
+			nm_secret_agent_old_unregister (sadata->agent, NULL, &error);
+			g_assert_no_error (error);
+		}
+		g_object_unref (sadata->agent);
+	}
+
+	ret = g_dbus_proxy_call_sync (sadata->sinfo->proxy,
+	                              "RemoveDevice",
+	                              g_variant_new ("(s)", nm_object_get_path (NM_OBJECT (sadata->device))),
+	                              G_DBUS_CALL_FLAGS_NO_AUTO_START,
+	                              3000,
+	                              NULL,
+	                              &error);
+	g_assert_no_error (error);
+	g_variant_unref (ret);
+
+	g_object_unref (sadata->connection);
+	g_object_unref (sadata->client);
+
+	nm_test_service_cleanup (sadata->sinfo);
+
+	g_source_remove (sadata->timeout_id);
+	g_main_loop_unref (sadata->loop);
+
+	g_free (sadata->ifname);
+	g_free (sadata->con_id);
+}
+
+/*******************************************************************/
+
+static void
+connection_activated_none_cb (GObject *c,
+                              GAsyncResult *result,
+                              gpointer user_data)
+{
+	TestSecretAgentData *sadata = user_data;
+	NMActiveConnection *ac;
+	GError *error = NULL;
+
+	ac = nm_client_activate_connection_finish (sadata->client, result, &error);
+	g_assert_error (error, NM_AGENT_MANAGER_ERROR, NM_AGENT_MANAGER_ERROR_NO_SECRETS);
+
+	g_main_loop_quit (sadata->loop);
+}
+
+static void
+test_secret_agent_none (TestSecretAgentData *sadata, gconstpointer test_data)
+{
+	nm_client_activate_connection_async (sadata->client,
+	                                     sadata->connection,
+	                                     sadata->device,
+	                                     NULL,
+	                                     NULL,
+	                                     connection_activated_none_cb,
+	                                     sadata);
+	g_main_loop_run (sadata->loop);
+}
+
+/*******************************************************************/
+
+static char *
+secrets_requested_no_secrets_cb (TestSecretAgent *agent,
+                                 NMConnection *connection,
+                                 const char *connection_path,
+                                 const char *setting_name,
+                                 const char *secret_name,
+                                 gpointer user_data)
+{
+	TestSecretAgentData *sadata = user_data;
+
+	g_assert_cmpstr (connection_path, ==, nm_connection_get_path (sadata->connection));
+	sadata->secrets_requested++;
+
+	return NULL;
+}
+
+static void
+connection_activated_no_secrets_cb (GObject *c,
+                                    GAsyncResult *result,
+                                    gpointer user_data)
+{
+	TestSecretAgentData *sadata = user_data;
+	NMActiveConnection *ac;
+	GError *error = NULL;
+
+	ac = nm_client_activate_connection_finish (sadata->client, result, &error);
+	g_assert_error (error, NM_AGENT_MANAGER_ERROR, NM_AGENT_MANAGER_ERROR_NO_SECRETS);
+	g_main_loop_quit (sadata->loop);
+}
+
+static void
+test_secret_agent_no_secrets (TestSecretAgentData *sadata, gconstpointer test_data)
+{
+	g_signal_connect (sadata->agent, "secret-requested",
+	                  G_CALLBACK (secrets_requested_no_secrets_cb),
+	                  sadata);
+
+	nm_client_activate_connection_async (sadata->client,
+	                                     sadata->connection,
+	                                     sadata->device,
+	                                     NULL,
+	                                     NULL,
+	                                     connection_activated_no_secrets_cb,
+	                                     sadata);
+	g_main_loop_run (sadata->loop);
+
+	g_assert_cmpint (sadata->secrets_requested, ==, 1);
+}
+
+/*******************************************************************/
+
+static void
+connection_activated_cancel_cb (GObject *c,
+                                GAsyncResult *result,
+                                gpointer user_data)
+{
+	TestSecretAgentData *sadata = user_data;
+	NMActiveConnection *ac;
+	GError *error = NULL;
+
+	ac = nm_client_activate_connection_finish (sadata->client, result, &error);
+	g_assert_error (error, NM_AGENT_MANAGER_ERROR, NM_AGENT_MANAGER_ERROR_USER_CANCELED);
+	g_main_loop_quit (sadata->loop);
+}
+
+static char *
+secrets_requested_cancel_cb (TestSecretAgent *agent,
+                             NMConnection *connection,
+                             const char *connection_path,
+                             const char *setting_name,
+                             const char *secret_name,
+                             gpointer user_data)
+{
+	TestSecretAgentData *sadata = user_data;
+
+	g_assert_cmpstr (connection_path, ==, nm_connection_get_path (sadata->connection));
+	sadata->secrets_requested++;
+
+	return g_strdup ("CANCEL");
+}
+
+static void
+test_secret_agent_cancel (TestSecretAgentData *sadata, gconstpointer test_data)
+{
+	g_signal_connect (sadata->agent, "secret-requested",
+	                  G_CALLBACK (secrets_requested_cancel_cb),
+	                  sadata);
+
+	nm_client_activate_connection_async (sadata->client,
+	                                     sadata->connection,
+	                                     sadata->device,
+	                                     NULL,
+	                                     NULL,
+	                                     connection_activated_cancel_cb,
+	                                     sadata);
+	g_main_loop_run (sadata->loop);
+
+	g_assert_cmpint (sadata->secrets_requested, ==, 1);
+}
+
+/*******************************************************************/
+
+static void
+connection_activated_good_cb (GObject *c,
+                              GAsyncResult *result,
+                              gpointer user_data)
+{
+	TestSecretAgentData *sadata = user_data;
+	NMActiveConnection *ac;
+	GError *error = NULL;
+
+	ac = nm_client_activate_connection_finish (sadata->client, result, &error);
+	g_assert_no_error (error);
+
+	g_object_unref (ac);
+
+	g_main_loop_quit (sadata->loop);
+}
+
+static char *
+secrets_requested_good_cb (TestSecretAgent *agent,
+                           NMConnection *connection,
+                           const char *connection_path,
+                           const char *setting_name,
+                           const char *secret_name,
+                           gpointer user_data)
+{
+	TestSecretAgentData *sadata = user_data;
+
+	g_assert_cmpstr (connection_path, ==, nm_connection_get_path (sadata->connection));
+	sadata->secrets_requested++;
+
+	return g_strdup ("password");
+}
+
+static void
+test_secret_agent_good (TestSecretAgentData *sadata, gconstpointer test_data)
+{
+	g_signal_connect (sadata->agent, "secret-requested",
+	                  G_CALLBACK (secrets_requested_good_cb),
+	                  sadata);
+
+	nm_client_activate_connection_async (sadata->client,
+	                                     sadata->connection,
+	                                     sadata->device,
+	                                     NULL,
+	                                     NULL,
+	                                     connection_activated_good_cb,
+	                                     sadata);
+	g_main_loop_run (sadata->loop);
+
+	g_assert_cmpint (sadata->secrets_requested, ==, 1);
+}
+
+
+static void
+async_init_cb (GObject *object, GAsyncResult *result, gpointer user_data)
+{
+	GMainLoop *loop = user_data;
+	GError *error = NULL;
+	GObject *agent;
+
+	agent = g_async_initable_new_finish (G_ASYNC_INITABLE (object), result, &error);
+	g_assert_error (error, NM_SECRET_AGENT_ERROR, NM_SECRET_AGENT_ERROR_FAILED);
+	g_assert (agent == NULL);
+	g_clear_error (&error);
+
+	g_main_loop_quit (loop);
+}
+
+static void
+test_secret_agent_nm_not_running (void)
+{
+	NMSecretAgentOld *agent;
+	GMainLoop *loop;
+	GError *error = NULL;
+
+	agent = g_initable_new (test_secret_agent_get_type (), NULL, &error,
+	                        NM_SECRET_AGENT_OLD_IDENTIFIER, "test-secret-agent",
+	                        NULL);
+	g_assert_error (error, NM_SECRET_AGENT_ERROR, NM_SECRET_AGENT_ERROR_FAILED);
+	g_assert (agent == NULL);
+	g_clear_error (&error);
+
+	loop = g_main_loop_new (NULL, FALSE);
+	g_async_initable_new_async (test_secret_agent_get_type (),
+	                            G_PRIORITY_DEFAULT,
+	                            NULL, async_init_cb, loop,
+	                            NM_SECRET_AGENT_OLD_IDENTIFIER, "test-secret-agent",
+	                            NULL);
+	g_main_loop_run (loop);
+	g_main_loop_unref (loop);
+}
+
+
+static void
+registered_changed (GObject *object, GParamSpec *pspec, gpointer user_data)
+{
+	GMainLoop *loop = user_data;
+
+	g_main_loop_quit (loop);
+}
+
+static void
+test_secret_agent_auto_register (void)
+{
+	NMTestServiceInfo *sinfo;
+	NMSecretAgentOld *agent;
+	GMainLoop *loop;
+	GError *error = NULL;
+
+	sinfo = nm_test_service_init ();
+	loop = g_main_loop_new (NULL, FALSE);
+
+	agent = test_secret_agent_new ();
+	g_object_set (agent,
+	              NM_SECRET_AGENT_OLD_AUTO_REGISTER, TRUE,
+	              NULL);
+	g_signal_connect (agent, "notify::" NM_SECRET_AGENT_OLD_REGISTERED,
+	                  G_CALLBACK (registered_changed), loop);
+
+	g_assert (!nm_secret_agent_old_get_registered (agent));
+	nm_secret_agent_old_register (agent, NULL, &error);
+	g_assert_no_error (error);
+	g_assert (nm_secret_agent_old_get_registered (agent));
+
+	/* Shut down test service */
+	nm_test_service_cleanup (sinfo);
+	g_main_loop_run (loop);
+	g_assert (!nm_secret_agent_old_get_registered (agent));
+
+	/* Restart test service */
+	sinfo = nm_test_service_init ();
+	g_main_loop_run (loop);
+	g_assert (nm_secret_agent_old_get_registered (agent));
+
+	/* Shut down test service again */
+	nm_test_service_cleanup (sinfo);
+	g_main_loop_run (loop);
+	g_assert (!nm_secret_agent_old_get_registered (agent));
+
+	g_object_unref (agent);
+	g_main_loop_unref (loop);
+}
+
+/*******************************************************************/
+
+int
+main (int argc, char **argv)
+{
+	int ret;
+
+	g_setenv ("LIBNM_USE_SESSION_BUS", "1", TRUE);
+
+#if !GLIB_CHECK_VERSION (2, 35, 0)
+	g_type_init ();
+#endif
+
+	g_test_init (&argc, &argv, NULL);
+
+	g_test_add ("/libnm/secret-agent/none", TestSecretAgentData, NULL,
+	            test_setup, test_secret_agent_none, test_cleanup);
+	g_test_add ("/libnm/secret-agent/no-secrets", TestSecretAgentData, "sync",
+	            test_setup, test_secret_agent_no_secrets, test_cleanup);
+	g_test_add ("/libnm/secret-agent/cancel", TestSecretAgentData, "async",
+	            test_setup, test_secret_agent_cancel, test_cleanup);
+	g_test_add ("/libnm/secret-agent/good", TestSecretAgentData, "async",
+	            test_setup, test_secret_agent_good, test_cleanup);
+	g_test_add_func ("/libnm/secret-agent/nm-not-running", test_secret_agent_nm_not_running);
+	g_test_add_func ("/libnm/secret-agent/auto-register", test_secret_agent_auto_register);
+
+	ret = g_test_run ();
+
+	return ret;
+}
+