ecore_con: Added test case to check if _ecore_con_init_count goes below zero.
Summary: _ecore_con_init_count should not go below zero. I've added a test case to test this and also the code to fix this. Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com> Reviewers: devilhorns Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D1603
This commit is contained in:
parent
f59ddff4e2
commit
be5b00cfd1
|
@ -245,6 +245,12 @@ ecore_con_shutdown(void)
|
|||
Eina_List *l, *l2;
|
||||
Ecore_Con_Server *obj;
|
||||
|
||||
/* _ecore_con_init_count should not go below zero. */
|
||||
if (_ecore_con_init_count < 1)
|
||||
{
|
||||
ERR("Ecore_Con Shutdown called without calling Ecore_Con Init.\n");
|
||||
return 0;
|
||||
}
|
||||
if (--_ecore_con_init_count != 0)
|
||||
return _ecore_con_init_count;
|
||||
|
||||
|
|
|
@ -302,9 +302,26 @@ START_TEST(ecore_test_ecore_con_dns)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(ecore_test_ecore_con_shutdown_bef_init)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = ecore_con_shutdown();
|
||||
fail_if(ret != 0);
|
||||
|
||||
ret = ecore_con_init();
|
||||
fail_if(ret != 1);
|
||||
|
||||
ret = ecore_con_shutdown();
|
||||
fail_if(ret != 0);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
||||
void ecore_test_ecore_con(TCase *tc)
|
||||
{
|
||||
tcase_add_test(tc, ecore_test_ecore_con_init);
|
||||
tcase_add_test(tc, ecore_test_ecore_con_server);
|
||||
tcase_add_test(tc, ecore_test_ecore_con_dns);
|
||||
tcase_add_test(tc, ecore_test_ecore_con_shutdown_bef_init);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue