summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2018-04-09 13:37:03 +0200
committerStefan Schmidt <stefan@osg.samsung.com>2018-04-10 11:28:01 +0200
commit5e806ee41ff3c3384fa63644e0dddce6105aa756 (patch)
tree0f3b814846bf2f46921730aa104eff465a168a7e
parentb4da776b3b6b0e44c153b159ef8b23554555084b (diff)
tests: move ecore promise tests into efl_app_suite
Summary: ref T6815 Depends on D5902 Reviewers: stefan_schmidt Subscribers: cedric Maniphest Tasks: T6815 Differential Revision: https://phab.enlightenment.org/D5903
-rw-r--r--src/Makefile_Ecore.am2
-rw-r--r--src/tests/ecore/ecore_suite.c1
-rw-r--r--src/tests/ecore/ecore_suite.h1
-rw-r--r--src/tests/ecore/efl_app_suite.c1
-rw-r--r--src/tests/ecore/efl_app_suite.h1
-rw-r--r--src/tests/ecore/efl_app_test_promise.c (renamed from src/tests/ecore/ecore_test_promise.c)31
6 files changed, 19 insertions, 18 deletions
diff --git a/src/Makefile_Ecore.am b/src/Makefile_Ecore.am
index 2c6221dfca..bcd33f853c 100644
--- a/src/Makefile_Ecore.am
+++ b/src/Makefile_Ecore.am
@@ -284,7 +284,6 @@ tests/ecore/ecore_test_animator.c \
284tests/ecore/ecore_test_ecore_thread_eina_thread_queue.c \ 284tests/ecore/ecore_test_ecore_thread_eina_thread_queue.c \
285tests/ecore/ecore_test_ecore_input.c \ 285tests/ecore/ecore_test_ecore_input.c \
286tests/ecore/ecore_test_ecore_file.c \ 286tests/ecore/ecore_test_ecore_file.c \
287tests/ecore/ecore_test_promise.c \
288tests/ecore/ecore_test_job.c \ 287tests/ecore/ecore_test_job.c \
289tests/ecore/ecore_test_args.c \ 288tests/ecore/ecore_test_args.c \
290tests/ecore/ecore_suite.h 289tests/ecore/ecore_suite.h
@@ -334,6 +333,7 @@ tests_ecore_efl_app_suite_SOURCES = \
334tests/ecore/efl_app_test_loop.c \ 333tests/ecore/efl_app_test_loop.c \
335tests/ecore/efl_app_test_loop_fd.c \ 334tests/ecore/efl_app_test_loop_fd.c \
336tests/ecore/efl_app_test_loop_timer.c \ 335tests/ecore/efl_app_test_loop_timer.c \
336tests/ecore/efl_app_test_promise.c \
337tests/ecore/efl_app_suite.c \ 337tests/ecore/efl_app_suite.c \
338tests/ecore/efl_app_suite.h 338tests/ecore/efl_app_suite.h
339 339
diff --git a/src/tests/ecore/ecore_suite.c b/src/tests/ecore/ecore_suite.c
index 04314e1922..21fb572817 100644
--- a/src/tests/ecore/ecore_suite.c
+++ b/src/tests/ecore/ecore_suite.c
@@ -31,7 +31,6 @@ static const Efl_Test_Case etc[] = {
31 { "Ecore_File", ecore_test_ecore_file }, 31 { "Ecore_File", ecore_test_ecore_file },
32 { "Ecore_Job", ecore_test_ecore_job }, 32 { "Ecore_Job", ecore_test_ecore_job },
33 { "Ecore_Args", ecore_test_ecore_args }, 33 { "Ecore_Args", ecore_test_ecore_args },
34 { "Ecore_Promise", ecore_test_ecore_promise },
35 { NULL, NULL } 34 { NULL, NULL }
36}; 35};
37 36
diff --git a/src/tests/ecore/ecore_suite.h b/src/tests/ecore/ecore_suite.h
index 5917a43a0c..56b7dc36e9 100644
--- a/src/tests/ecore/ecore_suite.h
+++ b/src/tests/ecore/ecore_suite.h
@@ -19,6 +19,5 @@ void ecore_test_ecore_input(TCase *tc);
19void ecore_test_ecore_file(TCase *tc); 19void ecore_test_ecore_file(TCase *tc);
20void ecore_test_ecore_job(TCase *tc); 20void ecore_test_ecore_job(TCase *tc);
21void ecore_test_ecore_args(TCase *tc); 21void ecore_test_ecore_args(TCase *tc);
22void ecore_test_ecore_promise(TCase *tc);
23 22
24#endif /* _ECORE_SUITE_H */ 23#endif /* _ECORE_SUITE_H */
diff --git a/src/tests/ecore/efl_app_suite.c b/src/tests/ecore/efl_app_suite.c
index c92aa3ab7f..38e5f5b292 100644
--- a/src/tests/ecore/efl_app_suite.c
+++ b/src/tests/ecore/efl_app_suite.c
@@ -50,6 +50,7 @@ static const Efl_Test_Case etc[] = {
50 { "Loop", efl_app_test_efl_loop }, 50 { "Loop", efl_app_test_efl_loop },
51 { "Loop_Timer", efl_app_test_efl_loop_timer }, 51 { "Loop_Timer", efl_app_test_efl_loop_timer },
52 { "Loop_FD", efl_app_test_efl_loop_fd }, 52 { "Loop_FD", efl_app_test_efl_loop_fd },
53 { "Promise", efl_app_test_promise },
53 { NULL, NULL } 54 { NULL, NULL }
54}; 55};
55 56
diff --git a/src/tests/ecore/efl_app_suite.h b/src/tests/ecore/efl_app_suite.h
index b4fce48303..abbd254dfc 100644
--- a/src/tests/ecore/efl_app_suite.h
+++ b/src/tests/ecore/efl_app_suite.h
@@ -7,5 +7,6 @@ void efl_app_test_efl_app(TCase *tc);
7void efl_app_test_efl_loop(TCase *tc); 7void efl_app_test_efl_loop(TCase *tc);
8void efl_app_test_efl_loop_fd(TCase *tc); 8void efl_app_test_efl_loop_fd(TCase *tc);
9void efl_app_test_efl_loop_timer(TCase *tc); 9void efl_app_test_efl_loop_timer(TCase *tc);
10void efl_app_test_promise(TCase *tc);
10 11
11#endif /* _EFL_APP_SUITE_H */ 12#endif /* _EFL_APP_SUITE_H */
diff --git a/src/tests/ecore/ecore_test_promise.c b/src/tests/ecore/efl_app_test_promise.c
index 1dfa4a6877..e719e5318c 100644
--- a/src/tests/ecore/ecore_test_promise.c
+++ b/src/tests/ecore/efl_app_test_promise.c
@@ -2,14 +2,13 @@
2# include <config.h> 2# include <config.h>
3#endif 3#endif
4 4
5#include <Ecore.h> 5#include <stdio.h>
6#include <Eina.h> 6#include <unistd.h>
7#include <stdlib.h> 7#define EFL_NOLEGACY_API_SUPPORT
8#include <errno.h> 8#include <Efl_Core.h>
9#include <time.h> 9#include <Efl_Net.h>
10#include <stdarg.h> 10#include "efl_app_suite.h"
11#include <Eo.h> 11#include "../efl_check.h"
12#include "ecore_suite.h"
13 12
14#define CHAIN_SIZE (3) 13#define CHAIN_SIZE (3)
15#define DEFAULT_ERROR (EFBIG) 14#define DEFAULT_ERROR (EFBIG)
@@ -33,7 +32,7 @@
33 32
34typedef struct _PromiseCtx { 33typedef struct _PromiseCtx {
35 Eina_Promise *p; 34 Eina_Promise *p;
36 Ecore_Timer *t; 35 Efl_Object *t;
37 Eina_Bool fail; 36 Eina_Bool fail;
38 Eina_Value *value; 37 Eina_Value *value;
39} PromiseCtx; 38} PromiseCtx;
@@ -122,7 +121,7 @@ static void
122_cancel(void *data, const Eina_Promise *dead_ptr EINA_UNUSED) 121_cancel(void *data, const Eina_Promise *dead_ptr EINA_UNUSED)
123{ 122{
124 PromiseCtx *ctx = data; 123 PromiseCtx *ctx = data;
125 if (ctx->t) ecore_timer_del(ctx->t); 124 if (ctx->t) efl_del(ctx->t);
126 ctx->t = NULL; 125 ctx->t = NULL;
127 eina_value_free(ctx->value); 126 eina_value_free(ctx->value);
128 free(ctx); 127 free(ctx);
@@ -135,8 +134,8 @@ _promise_cancel_test(void *data, const Eina_Promise *dead_ptr EINA_UNUSED)
135 *cancel_called = EINA_TRUE; 134 *cancel_called = EINA_TRUE;
136} 135}
137 136
138static Eina_Bool 137static void
139_simple_timeout(void *data) 138_simple_timeout(void *data, const Efl_Event *ev EINA_UNUSED)
140{ 139{
141 PromiseCtx *ctx = data; 140 PromiseCtx *ctx = data;
142 141
@@ -149,8 +148,8 @@ _simple_timeout(void *data)
149 eina_promise_resolve(ctx->p, v); 148 eina_promise_resolve(ctx->p, v);
150 eina_value_free(ctx->value); 149 eina_value_free(ctx->value);
151 } 150 }
151 efl_del(ctx->t);
152 free(ctx); 152 free(ctx);
153 return EINA_FALSE;
154} 153}
155 154
156static Eina_Future_Scheduler * 155static Eina_Future_Scheduler *
@@ -177,7 +176,9 @@ _future_get(PromiseCtx *ctx, double timeout)
177 176
178 f = eina_future_new(ctx->p); 177 f = eina_future_new(ctx->p);
179 fail_if(!f); 178 fail_if(!f);
180 ctx->t = ecore_timer_add(timeout, _simple_timeout, ctx); 179 ctx->t = efl_add(EFL_LOOP_TIMER_CLASS, efl_main_loop_get(),
180 efl_event_callback_add(efl_added, EFL_LOOP_TIMER_EVENT_TICK, _simple_timeout, ctx),
181 efl_loop_timer_interval_set(efl_added, timeout));
181 fail_if(!ctx->t); 182 fail_if(!ctx->t);
182 return f; 183 return f;
183} 184}
@@ -1330,7 +1331,7 @@ promise_shutdown(void)
1330 ecore_init(); 1331 ecore_init();
1331} 1332}
1332 1333
1333void ecore_test_ecore_promise(TCase *tc) 1334void efl_app_test_promise(TCase *tc)
1334{ 1335{
1335 tcase_add_checked_fixture(tc, promise_init, promise_shutdown); 1336 tcase_add_checked_fixture(tc, promise_init, promise_shutdown);
1336 tcase_add_test(tc, efl_test_timeout); 1337 tcase_add_test(tc, efl_test_timeout);