summaryrefslogtreecommitdiff
path: root/src/tests/ecore_con
diff options
context:
space:
mode:
authorCedric Bail <cedric@osg.samsung.com>2017-12-01 00:38:09 -0800
committerCedric Bail <cedric@osg.samsung.com>2017-12-01 00:38:43 -0800
commit7d229efda5ee09a72e2fc6d3172bbdd2b4f1f49c (patch)
treee631c25e06fb4c5d28ff197f33e89102378fea09 /src/tests/ecore_con
parent2e9e751638b44095f036aace86518f8b185fe29f (diff)
ecore_con: use eina_future based timeout for tests.
Diffstat (limited to 'src/tests/ecore_con')
-rw-r--r--src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c b/src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c
index 42f549b..d6768b3 100644
--- a/src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c
+++ b/src/tests/ecore_con/ecore_con_test_efl_net_ip_address.c
@@ -97,23 +97,31 @@ _eina_test_safety_print_cb(const Eina_Log_Domain *d, Eina_Log_Level level, const
97 } \ 97 } \
98 while (0) 98 while (0)
99 99
100static void 100static Eina_Value
101_timeout(void *data, const Efl_Event *event EINA_UNUSED) 101_timeout(void *data,
102 const Eina_Value t,
103 const Eina_Future *dead EINA_UNUSED)
102{ 104{
103 Eina_Bool *did = data; 105 Eina_Bool *did = data;
106
107 if (t.type == EINA_VALUE_TYPE_ERROR)
108 return t;
109
104 *did = EINA_TRUE; 110 *did = EINA_TRUE;
105 ck_abort_msg("timed out!"); 111 ck_abort_msg("timed out!");
112
113 return t;
106} 114}
107 115
108#define LOOP_WITH_TIMEOUT(t) \ 116#define LOOP_WITH_TIMEOUT(t) \
109 do \ 117 do \
110 { \ 118 { \
111 Eina_Bool _did_timeout = EINA_FALSE; \ 119 Eina_Bool _did_timeout = EINA_FALSE; \
112 Efl_Future *_timeout_future = efl_loop_timeout(ecore_main_loop_get(), t, &_did_timeout); \ 120 Eina_Future *_timeout_future = efl_loop_Eina_FutureXXX_timeout(ecore_main_loop_get(), t); \
113 efl_future_then(_timeout_future, _timeout, NULL, NULL, &_did_timeout); \ 121 eina_future_then(_timeout_future, _timeout, &_did_timeout); \
114 mark_point(); \ 122 mark_point(); \
115 ecore_main_loop_begin(); \ 123 ecore_main_loop_begin(); \
116 if (!_did_timeout) efl_future_cancel(_timeout_future); \ 124 if (!_did_timeout) eina_future_cancel(_timeout_future); \
117 else ck_abort_msg("Timed out!"); \ 125 else ck_abort_msg("Timed out!"); \
118 } \ 126 } \
119 while (0) 127 while (0)