summaryrefslogtreecommitdiff
path: root/tests/lib
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-01-17 11:53:11 +0100
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-05-12 12:30:41 +0200
commit66d91c25f2e0484ba1e2ab575adf702a388b3607 (patch)
tree367c67f06dcb06eb38e936d7d9b06724561a133c /tests/lib
parentd173d87dac5cd36fe3c2af9e4b16d30cf3ee1b7e (diff)
test preparing a feature which fail
Diffstat (limited to 'tests/lib')
-rw-r--r--tests/lib/my-conn-proxy.c28
-rw-r--r--tests/lib/my-conn-proxy.h5
2 files changed, 33 insertions, 0 deletions
diff --git a/tests/lib/my-conn-proxy.c b/tests/lib/my-conn-proxy.c
index 30618480..dd0f5676 100644
--- a/tests/lib/my-conn-proxy.c
+++ b/tests/lib/my-conn-proxy.c
@@ -27,6 +27,7 @@ enum {
FEAT_B,
FEAT_WRONG_IFACE,
FEAT_BAD_DEP,
+ FEAT_FAIL,
N_FEAT
};
@@ -89,6 +90,24 @@ cannot_be_prepared_async (TpProxy *proxy,
g_assert_not_reached ();
}
+static void
+prepare_fail_async (TpProxy *proxy,
+ const TpProxyFeature *feature,
+ GAsyncReadyCallback callback,
+ gpointer user_data)
+{
+ GSimpleAsyncResult *result;
+
+ g_assert (tp_proxy_is_prepared (proxy, TP_TESTS_MY_CONN_PROXY_FEATURE_CORE));
+
+ result = g_simple_async_result_new_error ((GObject *) proxy, callback,
+ user_data, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
+ "No feature for you!");
+
+ g_simple_async_result_complete_in_idle (result);
+ g_object_unref (result);
+}
+
static const TpProxyFeature *
list_features (TpProxyClass *cls G_GNUC_UNUSED)
{
@@ -125,6 +144,9 @@ list_features (TpProxyClass *cls G_GNUC_UNUSED)
need_wrong_iface[0] = TP_TESTS_MY_CONN_PROXY_FEATURE_WRONG_IFACE;
features[FEAT_BAD_DEP].depends_on = need_wrong_iface;
+ features[FEAT_FAIL].name = TP_TESTS_MY_CONN_PROXY_FEATURE_FAIL;
+ features[FEAT_FAIL].prepare_async = prepare_fail_async;
+
return features;
}
@@ -165,3 +187,9 @@ tp_tests_my_conn_proxy_get_feature_quark_bad_dep (void)
{
return g_quark_from_static_string ("tp-my-conn-proxy-feature-bad-dep");
}
+
+GQuark
+tp_tests_my_conn_proxy_get_feature_quark_fail (void)
+{
+ return g_quark_from_static_string ("tp-my-conn-proxy-feature-fail");
+}
diff --git a/tests/lib/my-conn-proxy.h b/tests/lib/my-conn-proxy.h
index 7c8f6fa3..b8cd2ada 100644
--- a/tests/lib/my-conn-proxy.h
+++ b/tests/lib/my-conn-proxy.h
@@ -73,6 +73,11 @@ GQuark tp_tests_my_conn_proxy_get_feature_quark_wrong_iface (void) G_GNUC_CONST;
(tp_tests_my_conn_proxy_get_feature_quark_bad_dep ())
GQuark tp_tests_my_conn_proxy_get_feature_quark_bad_dep (void) G_GNUC_CONST;
+/* Fail during preparation */
+#define TP_TESTS_MY_CONN_PROXY_FEATURE_FAIL \
+ (tp_tests_my_conn_proxy_get_feature_quark_fail ())
+GQuark tp_tests_my_conn_proxy_get_feature_quark_fail (void) G_GNUC_CONST;
+
G_END_DECLS
#endif /* #ifndef __TP_TESTS_MY_CONN_PROXY_H__ */