summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Laban <david.laban@collabora.co.uk>2009-11-24 16:56:56 +0000
committerDavid Laban <david.laban@collabora.co.uk>2009-12-02 18:02:35 +0000
commitdc2141ffcbe75b676794578b50b476e7e7c89704 (patch)
tree307e10bde0337ac0fbdf2311868a0cafd5f57961
parent0d39564bdd5ec4fe83dd6e92203dbe9f063c70a8 (diff)
downloadtelepathy-glib-dc2141ffcbe75b676794578b50b476e7e7c89704.tar.gz
Don't let MC5 activate itself during AM tests.
This sets up dbus to use a session.conf which doesn't include the standard services. This is the same trick that gabble's twisted tests use. I'm not really sure whether tests/dbus/dbus-1/session.conf.in is the best place to put the new file. If anyone thinks there is a better place for it, shout.
-rw-r--r--.gitignore1
-rw-r--r--tests/dbus/Makefile.am7
-rw-r--r--tests/dbus/account-manager.c33
-rw-r--r--tests/dbus/dbus-1/session.conf.in30
4 files changed, 70 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index f5e676da5..f14a25008 100644
--- a/.gitignore
+++ b/.gitignore
@@ -65,6 +65,7 @@ missing
stamp-h1
tags
/telepathy-glib-0.7.*
+tests/dbus/dbus-1/session.conf
tests/dbus/test-*
tests/test-*
tests/tools/actual.h
diff --git a/tests/dbus/Makefile.am b/tests/dbus/Makefile.am
index 7fc5d4bd9..026a78ab7 100644
--- a/tests/dbus/Makefile.am
+++ b/tests/dbus/Makefile.am
@@ -169,7 +169,8 @@ TESTS_ENVIRONMENT = \
XDG_DATA_HOME=@abs_builddir@ \
XDG_DATA_DIRS=@abs_srcdir@ \
G_DEBUG=fatal_warnings,fatal_criticals \
- sh $(top_srcdir)/tools/with-session-bus.sh --session --
+ sh $(top_srcdir)/tools/with-session-bus.sh \
+ --config-file=dbus-1/session.conf --
check-valgrind:
$(MAKE) check-TESTS \
@@ -186,6 +187,7 @@ VALGRIND_TESTS_ENVIRONMENT = \
$(VALGRIND_FLAGS)
BUILT_SOURCES = \
+ dbus-1/session.conf \
_gen/errors-check.h \
_gen/svc.h \
_gen/svc.c
@@ -203,6 +205,9 @@ EXTRA_DIST = \
telepathy/managers/test_manager_file_invalid.manager \
with-properties.xml
+dbus-1/%.conf: dbus-1/%.conf.in
+ sed -e "s|[@]abs_top_builddir[@]|@abs_top_builddir@|g" $< > $@
+
_gen/svc.c _gen/svc.h: with-properties.xml \
$(top_srcdir)/tools/glib-ginterface-gen.py \
Makefile.am
diff --git a/tests/dbus/account-manager.c b/tests/dbus/account-manager.c
index 2d131482a..79b8ffdb7 100644
--- a/tests/dbus/account-manager.c
+++ b/tests/dbus/account-manager.c
@@ -241,6 +241,7 @@ finish_prepare_action (GObject *source_object,
Test *test = (Test *) user_data;
gboolean is_prepared_reply;
TpAccountManager *am = TP_ACCOUNT_MANAGER (source_object);
+
g_assert (test->am == am);
test->prepared = tp_account_manager_prepare_finish (am, res, &test->error);
is_prepared_reply = tp_account_manager_is_prepared (test->am,
@@ -259,6 +260,36 @@ prepare_action (gpointer script_data,
tp_account_manager_prepare_async (test->am, NULL, finish_prepare_action, test);
}
+/* We really don't want to have MC being launched during this test */
+static void
+finish_assert_am_not_activatable_action (TpDBusDaemon *proxy,
+ const gchar * const *names,
+ const GError *error,
+ gpointer user_data,
+ GObject *weak_object)
+{
+ guint i;
+
+ g_assert (error == NULL);
+
+ for (i=0; names[i] != NULL; i++)
+ {
+ g_assert_cmpstr (names[i], !=, TP_ACCOUNT_MANAGER_BUS_NAME);
+ g_assert_cmpstr (names[i], !=, "org.freedesktop.Telepathy.MissionControl5");
+ }
+
+ script_continue (user_data);
+}
+
+static void
+assert_am_not_activatable_action (gpointer script_data,
+ gpointer user_data)
+{
+ Test *test = (Test *) script_data;
+
+ tp_dbus_daemon_list_activatable_names (test->dbus, 500,
+ finish_assert_am_not_activatable_action, test, NULL, NULL);
+}
static void
assert_ok_action (gpointer script_data,
@@ -321,6 +352,7 @@ finish_account_prepare_action (GObject *source_object,
{
Test *test = (Test *) user_data;
TpAccount *account = TP_ACCOUNT (source_object);
+
g_assert (test->account == account);
test->prepared = tp_account_prepare_finish (account, res, &test->error);
g_assert (test->prepared == tp_account_is_prepared (account, TP_ACCOUNT_FEATURE_CORE));
@@ -362,6 +394,7 @@ static void
test_prepare (Test *test,
gconstpointer data G_GNUC_UNUSED)
{
+ script_append_action (test, assert_am_not_activatable_action, NULL);
script_append_action (test, prepare_action, NULL);
script_append_action (test, noop_action, NULL);
}
diff --git a/tests/dbus/dbus-1/session.conf.in b/tests/dbus/dbus-1/session.conf.in
new file mode 100644
index 000000000..52fe18016
--- /dev/null
+++ b/tests/dbus/dbus-1/session.conf.in
@@ -0,0 +1,30 @@
+<!-- Copied from telepathy-gabble (which doubtless copied it from somewhere
+ else) and modified.
+ This configuration file controls the per-user-login-session message bus.
+ Add a session-local.conf and edit that rather than changing this
+ file directly. -->
+
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+ <!-- Our well-known bus type, don't change this -->
+ <type>session</type>
+
+ <listen>unix:tmpdir=/tmp</listen>
+
+ <servicedir>@abs_top_builddir@/tests/dbus/dbus-1/services/</servicedir>
+
+ <policy context="default">
+ <!-- Allow everything to be sent -->
+ <allow send_destination="*" eavesdrop="true"/>
+ <!-- Allow everything to be received -->
+ <allow eavesdrop="true"/>
+ <!-- Allow anyone to own anything -->
+ <allow own="*"/>
+ </policy>
+
+ <!-- This is included last so local configuration can override what's
+ in this standard file -->
+
+
+</busconfig>