#include "../../utc_negative_unitest.h"
-#define HOSTNAME "yandex.ru"
+//#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;
+static Ecore_Con_Server *svr = NULL;
+
+Eina_Bool _quit_timer_cb(void *data)
+{
+ ecore_main_loop_quit();
+ return ECORE_CALLBACK_CANCEL;
+}
/**
* @addtogroup ecore_con
printf(" ============ Startup ============ \n");
if (ecore_con_init() > 0)
{
- srv = ecore_con_server_connect(ECORE_CON_REMOTE_TCP, "127.0.0.1", PORT, NULL);
- if (srv != NULL)
- {
- startup_status = EINA_TRUE;
- }
+ svr = ecore_con_server_connect(ECORE_CON_REMOTE_TCP, HOSTNAME, PORT, NULL);
+ if (svr != NULL)
+ startup_status = EINA_TRUE;
}
}
{
ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed (startup was been executed unsuccessfully)..", __FILE__, __LINE__);
}
-
- const char *ip = NULL;
Eina_Bool ok = EINA_FALSE;
- ip = ecore_con_server_ip_get(srv);
+ 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();
+
+ const char *ip = NULL;
+ ip = ecore_con_server_ip_get(svr);
if (ip != NULL)
{
printf("IP is %s\n", ip);
{
ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
}
+
+ if (svr) ecore_con_server_del(svr);
+ svr = NULL;
+
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 (UNITEST_FUNC_NEG_RET(NULL, ecore_con_server_ip_get, srv) == TEST_FAIL)
+ if (UNITEST_FUNC_NEG_RET(NULL, ecore_con_server_ip_get, svr) == TEST_FAIL)
{
ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
}
+
+ if (svr) ecore_con_server_del(svr);
+ svr = NULL;
+
printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
}
END_TEST