summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-01-17 11:57:10 +0100
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-05-12 12:30:41 +0200
commit6d7f23df8ea606f36a731de58e9591b6be079b61 (patch)
tree93215e9ec4251edb5f224b5ee3c88389ff325b9d
parent66d91c25f2e0484ba1e2ab575adf702a388b3607 (diff)
test prearing a feature of which its dep fails
-rw-r--r--tests/dbus/proxy-preparation.c22
-rw-r--r--tests/lib/my-conn-proxy.c14
-rw-r--r--tests/lib/my-conn-proxy.h5
3 files changed, 41 insertions, 0 deletions
diff --git a/tests/dbus/proxy-preparation.c b/tests/dbus/proxy-preparation.c
index e099d866..c52a0c37 100644
--- a/tests/dbus/proxy-preparation.c
+++ b/tests/dbus/proxy-preparation.c
@@ -198,6 +198,26 @@ test_fail (Test *test,
TP_TESTS_MY_CONN_PROXY_FEATURE_FAIL));
}
+static void
+test_fail_dep (Test *test,
+ gconstpointer data G_GNUC_UNUSED)
+{
+ /* Feature can't be prepared because its deps can't be prepared */
+ GQuark features[] = { TP_TESTS_MY_CONN_PROXY_FEATURE_FAIL_DEP, 0 };
+
+ tp_proxy_prepare_async (test->my_conn, features, prepare_cb, test);
+
+ g_main_loop_run (test->mainloop);
+ g_assert_no_error (test->error);
+
+ g_assert (tp_proxy_is_prepared (test->my_conn,
+ TP_TESTS_MY_CONN_PROXY_FEATURE_CORE));
+ g_assert (!tp_proxy_is_prepared (test->my_conn,
+ TP_TESTS_MY_CONN_PROXY_FEATURE_FAIL));
+ g_assert (!tp_proxy_is_prepared (test->my_conn,
+ TP_TESTS_MY_CONN_PROXY_FEATURE_FAIL_DEP));
+}
+
int
main (int argc,
char **argv)
@@ -221,6 +241,8 @@ main (int argc,
test_bad_dep, teardown);
g_test_add ("/proxy-preparation/fail", Test, NULL, setup,
test_fail, teardown);
+ g_test_add ("/proxy-preparation/fail-dep", Test, NULL, setup,
+ test_fail_dep, teardown);
return g_test_run ();
}
diff --git a/tests/lib/my-conn-proxy.c b/tests/lib/my-conn-proxy.c
index dd0f5676..0a27c13b 100644
--- a/tests/lib/my-conn-proxy.c
+++ b/tests/lib/my-conn-proxy.c
@@ -28,6 +28,7 @@ enum {
FEAT_WRONG_IFACE,
FEAT_BAD_DEP,
FEAT_FAIL,
+ FEAT_FAIL_DEP,
N_FEAT
};
@@ -115,6 +116,7 @@ list_features (TpProxyClass *cls G_GNUC_UNUSED)
static GQuark need_a[2] = {0, 0};
static GQuark need_channel_core[2] = {0, 0};
static GQuark need_wrong_iface[2] = {0, 0};
+ static GQuark need_fail[2] = {0, 0};
if (G_LIKELY (features[0].name != 0))
return features;
@@ -147,6 +149,12 @@ list_features (TpProxyClass *cls G_GNUC_UNUSED)
features[FEAT_FAIL].name = TP_TESTS_MY_CONN_PROXY_FEATURE_FAIL;
features[FEAT_FAIL].prepare_async = prepare_fail_async;
+ features[FEAT_FAIL_DEP].name = TP_TESTS_MY_CONN_PROXY_FEATURE_FAIL_DEP;
+ features[FEAT_FAIL_DEP].prepare_async = cannot_be_prepared_async;
+ if (G_UNLIKELY (need_fail[0] == 0))
+ need_fail[0] = TP_TESTS_MY_CONN_PROXY_FEATURE_FAIL;
+ features[FEAT_FAIL_DEP].depends_on = need_fail;
+
return features;
}
@@ -193,3 +201,9 @@ tp_tests_my_conn_proxy_get_feature_quark_fail (void)
{
return g_quark_from_static_string ("tp-my-conn-proxy-feature-fail");
}
+
+GQuark
+tp_tests_my_conn_proxy_get_feature_quark_fail_dep (void)
+{
+ return g_quark_from_static_string ("tp-my-conn-proxy-feature-fail-dep");
+}
diff --git a/tests/lib/my-conn-proxy.h b/tests/lib/my-conn-proxy.h
index b8cd2ada..5861bd44 100644
--- a/tests/lib/my-conn-proxy.h
+++ b/tests/lib/my-conn-proxy.h
@@ -78,6 +78,11 @@ GQuark tp_tests_my_conn_proxy_get_feature_quark_bad_dep (void) G_GNUC_CONST;
(tp_tests_my_conn_proxy_get_feature_quark_fail ())
GQuark tp_tests_my_conn_proxy_get_feature_quark_fail (void) G_GNUC_CONST;
+/* Depends on FAIL */
+#define TP_TESTS_MY_CONN_PROXY_FEATURE_FAIL_DEP \
+ (tp_tests_my_conn_proxy_get_feature_quark_fail_dep ())
+GQuark tp_tests_my_conn_proxy_get_feature_quark_fail_dep (void) G_GNUC_CONST;
+
G_END_DECLS
#endif /* #ifndef __TP_TESTS_MY_CONN_PROXY_H__ */