#include "../../utc_negative_unitest.h"
-#define HOSTNAME "yandex.ru"
+#define HOSTNAME "127.0.0.1"
#define PORT 8080
static Eina_Bool startup_status = EINA_FALSE;
static Ecore_Con_Server *srv = NULL;
+Eina_Bool _quit_timer_cb(void* data)
+{
+ ecore_main_loop_quit();
+ return ECORE_CALLBACK_CANCEL;
+}
+
/**
* @addtogroup ecore_con
* @{
static void
setup(void)
{
+ startup_status = EINA_FALSE;
printf(" ============ Startup ============ \n");
if (ecore_con_init() > 0)
{
- srv = ecore_con_server_connect(ECORE_CON_REMOTE_TCP, HOSTNAME, PORT, NULL);
- if (srv != NULL)
+ srv = ecore_con_server_add(ECORE_CON_REMOTE_TCP, HOSTNAME, PORT, NULL);
+ if (srv)
{
- startup_status = EINA_TRUE;
+ if (ecore_con_server_connect(ECORE_CON_REMOTE_TCP, HOSTNAME, PORT, NULL) == NULL)
+ {
+ ecore_con_server_del(srv);
+ }
+ else
+ {
+ startup_status = EINA_TRUE;
+ }
}
}
}
ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (startup was been executed unsuccessfully)..", __FILE__, __LINE__);
}
+ if (ecore_timer_add(0.5, _quit_timer_cb, NULL) == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (timer cannot be created for testing)..", __FILE__, __LINE__);
+ }
+
+ ecore_main_loop_begin();
+
/*TODO: write a method that can check if pending data is flush*/
ecore_con_server_flush(srv);
+ ecore_con_server_del(srv);
+
printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
}
END_TEST
ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (startup was been executed unsuccessfully)..", __FILE__, __LINE__);
}
+ if (ecore_timer_add(0.5, _quit_timer_cb, NULL) == NULL)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (timer cannot be created for testing)..", __FILE__, __LINE__);
+ }
+ ecore_main_loop_begin();
UNITEST_FUNC_NEG(ecore_con_server_flush, srv);
+ ecore_con_server_del(srv);
printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
}
END_TEST