diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-01-17 11:44:15 +0100 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-05-12 12:30:41 +0200 |
commit | d173d87dac5cd36fe3c2af9e4b16d30cf3ee1b7e (patch) | |
tree | 0540632b9093173cceaf7064d3e597bc46ed0e82 | |
parent | d2bf687c5de58224992e9443dcdd1f9bf8ca959e (diff) |
test preparing a feature having a unpreparable dep
-rw-r--r-- | tests/dbus/proxy-preparation.c | 23 | ||||
-rw-r--r-- | tests/lib/my-conn-proxy.c | 14 | ||||
-rw-r--r-- | tests/lib/my-conn-proxy.h | 5 |
3 files changed, 42 insertions, 0 deletions
diff --git a/tests/dbus/proxy-preparation.c b/tests/dbus/proxy-preparation.c index 863e3348..1e920802 100644 --- a/tests/dbus/proxy-preparation.c +++ b/tests/dbus/proxy-preparation.c @@ -159,6 +159,27 @@ test_wrong_iface (Test *test, TP_TESTS_MY_CONN_PROXY_FEATURE_WRONG_IFACE)); } +static void +test_bad_dep (Test *test, + gconstpointer data G_GNUC_UNUSED) +{ + /* Feature can't be prepared because it depends on an unpreparable + * feature */ + GQuark features[] = { TP_TESTS_MY_CONN_PROXY_FEATURE_BAD_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_WRONG_IFACE)); + g_assert (!tp_proxy_is_prepared (test->my_conn, + TP_TESTS_MY_CONN_PROXY_FEATURE_BAD_DEP)); +} + int main (int argc, char **argv) @@ -178,6 +199,8 @@ main (int argc, test_depends, teardown); g_test_add ("/proxy-preparation/wrong-iface", Test, NULL, setup, test_wrong_iface, teardown); + g_test_add ("/proxy-preparation/bad-dep", Test, NULL, setup, + test_bad_dep, teardown); return g_test_run (); } diff --git a/tests/lib/my-conn-proxy.c b/tests/lib/my-conn-proxy.c index 157892fb..30618480 100644 --- a/tests/lib/my-conn-proxy.c +++ b/tests/lib/my-conn-proxy.c @@ -26,6 +26,7 @@ enum { FEAT_A, FEAT_B, FEAT_WRONG_IFACE, + FEAT_BAD_DEP, N_FEAT }; @@ -94,6 +95,7 @@ list_features (TpProxyClass *cls G_GNUC_UNUSED) static TpProxyFeature features[N_FEAT + 1] = { { 0 } }; static GQuark need_a[2] = {0, 0}; static GQuark need_channel_core[2] = {0, 0}; + static GQuark need_wrong_iface[2] = {0, 0}; if (G_LIKELY (features[0].name != 0)) return features; @@ -117,6 +119,12 @@ list_features (TpProxyClass *cls G_GNUC_UNUSED) need_channel_core[0] = TP_CHANNEL_FEATURE_CORE; features[FEAT_WRONG_IFACE].interfaces_needed = need_channel_core; + features[FEAT_BAD_DEP].name = TP_TESTS_MY_CONN_PROXY_FEATURE_BAD_DEP; + features[FEAT_BAD_DEP].prepare_async = cannot_be_prepared_async; + if (G_UNLIKELY (need_wrong_iface[0] == 0)) + need_wrong_iface[0] = TP_TESTS_MY_CONN_PROXY_FEATURE_WRONG_IFACE; + features[FEAT_BAD_DEP].depends_on = need_wrong_iface; + return features; } @@ -151,3 +159,9 @@ tp_tests_my_conn_proxy_get_feature_quark_wrong_iface (void) { return g_quark_from_static_string ("tp-my-conn-proxy-feature-wrong_iface"); } + +GQuark +tp_tests_my_conn_proxy_get_feature_quark_bad_dep (void) +{ + return g_quark_from_static_string ("tp-my-conn-proxy-feature-bad-dep"); +} diff --git a/tests/lib/my-conn-proxy.h b/tests/lib/my-conn-proxy.h index 71d8d90f..7c8f6fa3 100644 --- a/tests/lib/my-conn-proxy.h +++ b/tests/lib/my-conn-proxy.h @@ -68,6 +68,11 @@ GQuark tp_tests_my_conn_proxy_get_feature_quark_b (void) G_GNUC_CONST; (tp_tests_my_conn_proxy_get_feature_quark_wrong_iface ()) GQuark tp_tests_my_conn_proxy_get_feature_quark_wrong_iface (void) G_GNUC_CONST; +/* Depends on WRONG_IFACE */ +#define TP_TESTS_MY_CONN_PROXY_FEATURE_BAD_DEP \ + (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; + G_END_DECLS #endif /* #ifndef __TP_TESTS_MY_CONN_PROXY_H__ */ |