aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am4
-rw-r--r--tests/Makefile.in80
-rw-r--r--tests/service-version-manager.c86
3 files changed, 142 insertions, 28 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9319087..c98bdbf 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -371,7 +371,7 @@ DISTCLEANFILES += service-version-tester service-version-bad.service service-ver
check_PROGRAMS += service-version-multiwatch-manager
-service_version_manager_SOURCES = \
+service_version_multiwatch_manager_SOURCES = \
service-version-values.h \
service-version-multiwatch-manager.c
@@ -386,7 +386,7 @@ service_version_multiwatch_manager_LDADD = \
check_PROGRAMS += service-version-multiwatch-manager-impolite
-service_version_manager_impolite_SOURCES = \
+service_version_multiwatch_manager_impolite_SOURCES = \
service-version-values.h \
service-version-multiwatch-manager-impolite.c
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 2ffbf4e..3bcacde 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -16,6 +16,23 @@
@SET_MAKE@
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -217,7 +234,8 @@ service_version_good_service_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(service_version_good_service_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
-am_service_version_manager_OBJECTS = service_version_manager-service-version-multiwatch-manager.$(OBJEXT)
+am_service_version_manager_OBJECTS = \
+ service_version_manager-service-version-manager.$(OBJEXT)
service_version_manager_OBJECTS = \
$(am_service_version_manager_OBJECTS)
service_version_manager_DEPENDENCIES = $(am__DEPENDENCIES_1) \
@@ -226,18 +244,18 @@ service_version_manager_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(service_version_manager_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
-service_version_multiwatch_manager_SOURCES = \
- service-version-multiwatch-manager.c
-service_version_multiwatch_manager_OBJECTS = service_version_multiwatch_manager-service-version-multiwatch-manager.$(OBJEXT)
+am_service_version_multiwatch_manager_OBJECTS = service_version_multiwatch_manager-service-version-multiwatch-manager.$(OBJEXT)
+service_version_multiwatch_manager_OBJECTS = \
+ $(am_service_version_multiwatch_manager_OBJECTS)
service_version_multiwatch_manager_DEPENDENCIES = \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
service_version_multiwatch_manager_LINK = $(LIBTOOL) $(AM_V_lt) \
--tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link \
$(CCLD) $(service_version_multiwatch_manager_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
-service_version_multiwatch_manager_impolite_SOURCES = \
- service-version-multiwatch-manager-impolite.c
-service_version_multiwatch_manager_impolite_OBJECTS = service_version_multiwatch_manager_impolite-service-version-multiwatch-manager-impolite.$(OBJEXT)
+am_service_version_multiwatch_manager_impolite_OBJECTS = service_version_multiwatch_manager_impolite-service-version-multiwatch-manager-impolite.$(OBJEXT)
+service_version_multiwatch_manager_impolite_OBJECTS = \
+ $(am_service_version_multiwatch_manager_impolite_OBJECTS)
service_version_multiwatch_manager_impolite_DEPENDENCIES = \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
service_version_multiwatch_manager_impolite_LINK = $(LIBTOOL) \
@@ -309,8 +327,8 @@ SOURCES = $(libdummy_indicator_blank_la_SOURCES) \
$(service_version_bad_service_SOURCES) \
$(service_version_good_service_SOURCES) \
$(service_version_manager_SOURCES) \
- service-version-multiwatch-manager.c \
- service-version-multiwatch-manager-impolite.c \
+ $(service_version_multiwatch_manager_SOURCES) \
+ $(service_version_multiwatch_manager_impolite_SOURCES) \
$(service_version_multiwatch_service_SOURCES) \
$(test_desktop_shortcuts_SOURCES) $(test_loader_SOURCES)
DIST_SOURCES = $(libdummy_indicator_blank_la_SOURCES) \
@@ -327,10 +345,15 @@ DIST_SOURCES = $(libdummy_indicator_blank_la_SOURCES) \
$(service_version_bad_service_SOURCES) \
$(service_version_good_service_SOURCES) \
$(service_version_manager_SOURCES) \
- service-version-multiwatch-manager.c \
- service-version-multiwatch-manager-impolite.c \
+ $(service_version_multiwatch_manager_SOURCES) \
+ $(service_version_multiwatch_manager_impolite_SOURCES) \
$(service_version_multiwatch_service_SOURCES) \
$(test_desktop_shortcuts_SOURCES) $(test_loader_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
ETAGS = etags
CTAGS = ctags
am__tty_colors = \
@@ -702,7 +725,7 @@ service_manager_connect_service_LDADD = \
service_version_manager_SOURCES = \
service-version-values.h \
- service-version-multiwatch-manager.c
+ service-version-manager.c
service_version_manager_CFLAGS = \
-Wall -Werror \
@@ -739,6 +762,10 @@ service_version_good_service_LDADD = \
-L$(top_builddir)/libindicator/.libs \
$(INDICATOR_LIB)
+service_version_multiwatch_manager_SOURCES = \
+ service-version-values.h \
+ service-version-multiwatch-manager.c
+
service_version_multiwatch_manager_CFLAGS = \
-Wall -Werror \
$(LIBINDICATOR_CFLAGS) -I$(top_srcdir)
@@ -748,7 +775,7 @@ service_version_multiwatch_manager_LDADD = \
-L$(top_builddir)/libindicator/.libs \
$(INDICATOR_LIB)
-service_version_manager_impolite_SOURCES = \
+service_version_multiwatch_manager_impolite_SOURCES = \
service-version-values.h \
service-version-multiwatch-manager-impolite.c
@@ -828,7 +855,6 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__aclocal_m4_deps):
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
@@ -836,6 +862,8 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES)
else :; fi; \
done; \
test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
@@ -937,7 +965,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/service_shutdown_timeout-service-shutdown-timeout.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/service_version_bad_service-service-version-bad-service.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/service_version_good_service-service-version-good-service.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/service_version_manager-service-version-multiwatch-manager.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/service_version_manager-service-version-manager.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/service_version_multiwatch_manager-service-version-multiwatch-manager.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/service_version_multiwatch_manager_impolite-service-version-multiwatch-manager-impolite.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/service_version_multiwatch_service-service-version-multiwatch-service.Po@am__quote@
@@ -1105,19 +1133,19 @@ service_version_good_service-service-version-good-service.obj: service-version-g
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(service_version_good_service_CFLAGS) $(CFLAGS) -c -o service_version_good_service-service-version-good-service.obj `if test -f 'service-version-good-service.c'; then $(CYGPATH_W) 'service-version-good-service.c'; else $(CYGPATH_W) '$(srcdir)/service-version-good-service.c'; fi`
-service_version_manager-service-version-multiwatch-manager.o: service-version-multiwatch-manager.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(service_version_manager_CFLAGS) $(CFLAGS) -MT service_version_manager-service-version-multiwatch-manager.o -MD -MP -MF $(DEPDIR)/service_version_manager-service-version-multiwatch-manager.Tpo -c -o service_version_manager-service-version-multiwatch-manager.o `test -f 'service-version-multiwatch-manager.c' || echo '$(srcdir)/'`service-version-multiwatch-manager.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/service_version_manager-service-version-multiwatch-manager.Tpo $(DEPDIR)/service_version_manager-service-version-multiwatch-manager.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='service-version-multiwatch-manager.c' object='service_version_manager-service-version-multiwatch-manager.o' libtool=no @AMDEPBACKSLASH@
+service_version_manager-service-version-manager.o: service-version-manager.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(service_version_manager_CFLAGS) $(CFLAGS) -MT service_version_manager-service-version-manager.o -MD -MP -MF $(DEPDIR)/service_version_manager-service-version-manager.Tpo -c -o service_version_manager-service-version-manager.o `test -f 'service-version-manager.c' || echo '$(srcdir)/'`service-version-manager.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/service_version_manager-service-version-manager.Tpo $(DEPDIR)/service_version_manager-service-version-manager.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='service-version-manager.c' object='service_version_manager-service-version-manager.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(service_version_manager_CFLAGS) $(CFLAGS) -c -o service_version_manager-service-version-multiwatch-manager.o `test -f 'service-version-multiwatch-manager.c' || echo '$(srcdir)/'`service-version-multiwatch-manager.c
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(service_version_manager_CFLAGS) $(CFLAGS) -c -o service_version_manager-service-version-manager.o `test -f 'service-version-manager.c' || echo '$(srcdir)/'`service-version-manager.c
-service_version_manager-service-version-multiwatch-manager.obj: service-version-multiwatch-manager.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(service_version_manager_CFLAGS) $(CFLAGS) -MT service_version_manager-service-version-multiwatch-manager.obj -MD -MP -MF $(DEPDIR)/service_version_manager-service-version-multiwatch-manager.Tpo -c -o service_version_manager-service-version-multiwatch-manager.obj `if test -f 'service-version-multiwatch-manager.c'; then $(CYGPATH_W) 'service-version-multiwatch-manager.c'; else $(CYGPATH_W) '$(srcdir)/service-version-multiwatch-manager.c'; fi`
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/service_version_manager-service-version-multiwatch-manager.Tpo $(DEPDIR)/service_version_manager-service-version-multiwatch-manager.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='service-version-multiwatch-manager.c' object='service_version_manager-service-version-multiwatch-manager.obj' libtool=no @AMDEPBACKSLASH@
+service_version_manager-service-version-manager.obj: service-version-manager.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(service_version_manager_CFLAGS) $(CFLAGS) -MT service_version_manager-service-version-manager.obj -MD -MP -MF $(DEPDIR)/service_version_manager-service-version-manager.Tpo -c -o service_version_manager-service-version-manager.obj `if test -f 'service-version-manager.c'; then $(CYGPATH_W) 'service-version-manager.c'; else $(CYGPATH_W) '$(srcdir)/service-version-manager.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/service_version_manager-service-version-manager.Tpo $(DEPDIR)/service_version_manager-service-version-manager.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='service-version-manager.c' object='service_version_manager-service-version-manager.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(service_version_manager_CFLAGS) $(CFLAGS) -c -o service_version_manager-service-version-multiwatch-manager.obj `if test -f 'service-version-multiwatch-manager.c'; then $(CYGPATH_W) 'service-version-multiwatch-manager.c'; else $(CYGPATH_W) '$(srcdir)/service-version-multiwatch-manager.c'; fi`
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(service_version_manager_CFLAGS) $(CFLAGS) -c -o service_version_manager-service-version-manager.obj `if test -f 'service-version-manager.c'; then $(CYGPATH_W) 'service-version-manager.c'; else $(CYGPATH_W) '$(srcdir)/service-version-manager.c'; fi`
service_version_multiwatch_manager-service-version-multiwatch-manager.o: service-version-multiwatch-manager.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(service_version_multiwatch_manager_CFLAGS) $(CFLAGS) -MT service_version_multiwatch_manager-service-version-multiwatch-manager.o -MD -MP -MF $(DEPDIR)/service_version_multiwatch_manager-service-version-multiwatch-manager.Tpo -c -o service_version_multiwatch_manager-service-version-multiwatch-manager.o `test -f 'service-version-multiwatch-manager.c' || echo '$(srcdir)/'`service-version-multiwatch-manager.c
diff --git a/tests/service-version-manager.c b/tests/service-version-manager.c
new file mode 100644
index 0000000..9e582f5
--- /dev/null
+++ b/tests/service-version-manager.c
@@ -0,0 +1,86 @@
+/*
+Test for libindicator
+
+Copyright 2009 Canonical Ltd.
+
+Authors:
+ Ted Gould <ted@canonical.com>
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+version 3.0 as published by the Free Software Foundation.
+
+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 General Public License version 3.0 for more details.
+
+You should have received a copy of the GNU General Public
+License along with this library. If not, see
+<http://www.gnu.org/licenses/>.
+*/
+
+
+#include <glib.h>
+#include "libindicator/indicator-service-manager.h"
+#include "service-version-values.h"
+
+static GMainLoop * mainloop = NULL;
+static gboolean con_good = FALSE;
+static gboolean con_bad = FALSE;
+
+gboolean
+timeout (gpointer data)
+{
+ g_debug("Timeout.");
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+void
+connection_bad (IndicatorServiceManager * sm, gboolean connected, gpointer user_data)
+{
+ if (!connected) return;
+ g_debug("Connection From Bad!");
+ con_bad = TRUE;
+ return;
+}
+
+void
+connection_good (IndicatorServiceManager * sm, gboolean connected, gpointer user_data)
+{
+ if (!connected) return;
+ g_debug("Connection From Good.");
+ con_good = TRUE;
+ return;
+}
+
+int
+main (int argc, char ** argv)
+{
+ g_type_init();
+ g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL);
+ g_print("Manager: DBUS_SESSION_BUS_ADDRESS = %s\n", g_getenv("DBUS_SESSION_BUS_ADDRESS"));
+
+ IndicatorServiceManager * goodis = indicator_service_manager_new_version("org.ayatana.version.good", SERVICE_VERSION_GOOD);
+ g_signal_connect(G_OBJECT(goodis), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection_good), NULL);
+
+ IndicatorServiceManager * badis = indicator_service_manager_new_version("org.ayatana.version.bad", SERVICE_VERSION_GOOD);
+ g_signal_connect(G_OBJECT(badis), INDICATOR_SERVICE_MANAGER_SIGNAL_CONNECTION_CHANGE, G_CALLBACK(connection_bad), NULL);
+
+ g_timeout_add_seconds(1, timeout, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ g_object_unref(goodis);
+ g_object_unref(badis);
+
+ g_debug("Quiting");
+ if (con_good && !con_bad) {
+ g_debug("Passed");
+ return 0;
+ }
+ g_debug("Failed");
+ return 1;
+}