}
};
+void wait_for_state_change(mmi_handle h, mmi_state state)
+{
+ int timer = 0;
+ while (state != mmi_state_get_current_state(h) && timer < MAX_WAIT_TIME)
+ {
+ ecore_main_loop_iterate();
+ timer++;
+ }
+}
TEST_F(MMIFWMainTest, MMIFWMainInit)
{
TEST_F(MMIFWMainTest, MMIFWMainInstanceCreateDestroySuccess)
{
- int timer = 0;
int res = mmi_init();
const char *app_id = "org.tizen.mmi-system-ux-test";
mmi_handle h = mmi_instance_create(app_id);
EXPECT_NE(h, nullptr);
- while (timer != 100000)
- {
- ecore_main_loop_iterate();
- timer++;
- }
-
if(h){
mmi_instance_destroy(&h);
EXPECT_EQ(h, nullptr);
TEST_F(MMIFWMainTest, MMIFWMainInstanceCreateAndConnectSuccess)
{
- int timer = 0;
int res = mmi_init();
const char *app_id = "org.tizen.mmi-system-ux-test";
mmi_handle h = mmi_instance_create(app_id);
EXPECT_NE(h, nullptr);
- while (timer != 100000)
- {
- ecore_main_loop_iterate();
- timer++;
- }
+ wait_for_connect();
EXPECT_TRUE(mmi_ipc_is_connected());
TEST_F(MMIFWMainTest, MMIFWMainInstanceCreateFail)
{
- int timer = 0;
int res = mmi_init();
const char *app_id = NULL;
mmi_handle h = mmi_instance_create(app_id);
EXPECT_EQ(h, nullptr);
- while (timer != 100000)
- {
- ecore_main_loop_iterate();
- timer++;
- }
-
if(h){
mmi_instance_destroy(&h);
EXPECT_EQ(h, nullptr);
TEST_F(MMIFWMainTest, MMIFWMainEventAddSingleListener)
{
- int timer = 0;
int res = mmi_init();
const char *app_id = "org.tizen.mmi-system-ux-test";
mmi_handle h = mmi_instance_create(app_id);
EXPECT_NE(h, nullptr);
- while (timer != 100000)
- {
- ecore_main_loop_iterate();
- timer++;
- }
+ wait_for_connect();
EXPECT_TRUE(mmi_ipc_is_connected());
TEST_F(MMIFWMainTest, MMIFWMainEventAddSingleListenerFail)
{
- int timer = 0;
int res = mmi_init();
const char *app_id = "org.tizen.mmi-system-ux-test";
mmi_handle h = mmi_instance_create(app_id);
EXPECT_NE(h, nullptr);
- while (timer != 100000)
- {
- ecore_main_loop_iterate();
- timer++;
- }
+ wait_for_connect();
EXPECT_TRUE(mmi_ipc_is_connected());
TEST_F(MMIFWMainTest, MMIFWMainEventAddSingleListenerSecondFail)
{
- int timer = 0;
int res = mmi_init();
const char *app_id = "org.tizen.mmi-system-ux-test";
mmi_handle h = mmi_instance_create(app_id);
EXPECT_NE(h, nullptr);
- while (timer != 100000)
- {
- ecore_main_loop_iterate();
- timer++;
- }
+ wait_for_connect();
EXPECT_TRUE(mmi_ipc_is_connected());
TEST_F(MMIFWMainTest, MMIFWMainRequestSendGetFocus)
{
- int timer = 0;
int res = mmi_init();
const char *app_id = "org.tizen.mmi-system-ux-test";
mmi_handle h = mmi_instance_create(app_id);
EXPECT_NE(h, nullptr);
- while (timer != 100000)
- {
- ecore_main_loop_iterate();
- timer++;
- }
+ wait_for_connect();
EXPECT_TRUE(mmi_ipc_is_connected());
EXPECT_EQ(mmi_res, MMI_RESULT_SUCCESS);
}
- while (timer != 150000)
- {
- ecore_main_loop_iterate();
- timer++;
- }
-
if(h){
mmi_instance_destroy(&h);
EXPECT_EQ(h, nullptr);
TEST_F(MMIFWMainTest, MMIFWMainRequestSendSetGetState)
{
- int timer = 0;
int res = mmi_init();
const char *app_id = "org.tizen.mmi-system-ux-test";
mmi_handle h = mmi_instance_create(app_id);
EXPECT_NE(h, nullptr);
- while (timer != 100000)
- {
- ecore_main_loop_iterate();
- timer++;
- }
+ wait_for_connect();
EXPECT_TRUE(mmi_ipc_is_connected());
mmi_res = mmi_request_send_set_state(h, state);
EXPECT_EQ(mmi_res, MMI_RESULT_SUCCESS);
- while (timer != 150000)
- {
- ecore_main_loop_iterate();
- timer++;
- }
+ wait_for_state_change(h, MMI_STATE_INITIATION);
state = mmi_state_get_current_state(h);
EXPECT_EQ(state, MMI_STATE_INITIATION);
}
- while (timer != 150000)
- {
- ecore_main_loop_iterate();
- timer++;
- }
-
if(h){
mmi_instance_destroy(&h);
EXPECT_EQ(h, nullptr);
TEST_F(MMIFWMainTest, MMIFWMainEventRemoveAllListener)
{
- int timer = 0;
int res = mmi_init();
const char *app_id = "org.tizen.mmi-system-ux-test";
mmi_handle h = mmi_instance_create(app_id);
mmi_event_listener * handler = NULL;
mmi_event_listener * handler2 = NULL;
- EXPECT_NE(h, nullptr);
- EXPECT_EQ(handler, nullptr);
+ EXPECT_NE(h, nullptr);
+ EXPECT_EQ(handler, nullptr);
- while (timer != 100000)
- {
- ecore_main_loop_iterate();
- timer++;
- }
+ wait_for_connect();
EXPECT_TRUE(mmi_ipc_is_connected());