diff options
author | Ryan Lortie <desrt@desrt.ca> | 2012-07-05 23:58:03 -0400 |
---|---|---|
committer | Ryan Lortie <desrt@desrt.ca> | 2012-07-06 00:19:45 -0400 |
commit | 8cb144b1e24e8a562dc286e25bf4f52203588db0 (patch) | |
tree | 672bb5f7e202de9dcc8b51516031cbe9a4479993 /tests | |
parent | e60fa3a5ddcde7cb1dcf12f56368c8c88c333304 (diff) | |
download | dconf-8cb144b1e24e8a562dc286e25bf4f52203588db0.tar.gz |
tests/: add a stub D-Bus backend for testing
Also add some macros in the Makefile to make LDFLAGS lines for future
tests easier.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/.gitignore | 2 | ||||
-rw-r--r-- | tests/Makefile.am | 21 | ||||
-rw-r--r-- | tests/dconf-dbus-stub.c | 52 |
3 files changed, 75 insertions, 0 deletions
diff --git a/tests/.gitignore b/tests/.gitignore index 2ad0a97..2298217 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -1,3 +1,5 @@ +libdconf-dbus-stub.a + dbus1 gdbus-filter gdbus-thread diff --git a/tests/Makefile.am b/tests/Makefile.am index 960d72c..6de67b5 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -3,6 +3,7 @@ include $(top_srcdir)/Makefile.gtester AM_CFLAGS = -std=c89 -Wall -Wmissing-prototypes -Wwrite-strings -DSRCDIR=\"$(abs_srcdir)\" INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/engine -I$(top_srcdir)/client $(gio_CFLAGS) -I$(top_srcdir)/dbus-1 $(dbus_CFLAGS) -I$(top_srcdir)/gvdb +noinst_LIBRARIES = libdconf-dbus-stub.a noinst_PROGRAMS = $(TEST_PROGS) gsettings dbus1 gsettings_LDADD = $(gio_LIBS) @@ -12,6 +13,26 @@ TEST_PROGS += paths paths_LDADD = ../common/libdconf-common.a $(gio_LIBS) paths_SOURCES = paths.c +engine_LIBS = \ + ../engine/libdconf-engine.a \ + ../common/libdconf-common.a + +engine_with_stub_LIBS = \ + $(engine_LIBS) \ + libdconf-dbus-stub.a + +client_LIBS = \ + ../client/libdconf-client.a \ + $(engine_LIBS) \ + ../gdbus/libdconf-gdbus.a + +stub_client_LIBS = \ + ../client/libdconf-client.a \ + $(engine_with_stub_LIBS) + +libdconf_dbus_stub_a_SOURCES = \ + dconf-dbus-stub.c + TEST_PROGS += gvdb gvdb_LDADD = $(glib_LIBS) gvdb_SOURCES = \ diff --git a/tests/dconf-dbus-stub.c b/tests/dconf-dbus-stub.c new file mode 100644 index 0000000..7e34f98 --- /dev/null +++ b/tests/dconf-dbus-stub.c @@ -0,0 +1,52 @@ +/* + * Copyright © 2012 Canonical Limited + * + * 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 licence, 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., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Ryan Lortie <desrt@desrt.ca> + */ + +#include "dconf-engine.h" + +GQueue outstanding_call_handles; + +gboolean +dconf_engine_dbus_call_async_func (GBusType bus_type, + const gchar *bus_name, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + DConfEngineCallHandle *handle, + GError **error) +{ + g_queue_push_tail (&outstanding_call_handles, handle); + + return TRUE; +} + +GVariant * +dconf_engine_dbus_call_sync_func (GBusType bus_type, + const gchar *bus_name, + const gchar *object_path, + const gchar *interface_name, + const gchar *method_name, + GVariant *parameters, + const GVariantType *reply_type, + GError **error) +{ + g_assert_not_reached (); +} |