#include "mmi.h"
#include "mmi-tests.h"
#include "mmi-ipc.h"
+#include "mmi-client.h"
#include <Ecore.h>
#include <rpc-port-internal.h>
mmi_deinitialize();
}
+
+static void voice_touch_callback(int input_event_type, const char *result_out, void *user_data)
+{
+}
+
+TEST_F(MMIIpcTest, MMIFWIpcRegisterSuccess)
+{
+ int res = mmi_initialize();
+ mmi_input_event_type_e input_event_type = MMI_INPUT_EVENT_TYPE_VOICE_TOUCH;
+
+ EXPECT_EQ(res, MMI_ERROR_NONE);
+
+ res = mmi_ipc_register_input_event_result_cb(input_event_type, (rpc_port_proxy_mmi_result_cb_cb)voice_touch_callback);
+ EXPECT_EQ(res, MMI_ERROR_NONE);
+
+ mmi_deinitialize();
+}
+
+TEST_F(MMIIpcTest, MMIFWIpcRegisterFailNoEvent)
+{
+ int res = mmi_initialize();
+ mmi_input_event_type_e input_event_type = MMI_INPUT_EVENT_TYPE_NONE;
+
+ EXPECT_EQ(res, MMI_ERROR_NONE);
+
+ res = mmi_ipc_register_input_event_result_cb(MMI_INPUT_EVENT_TYPE_NONE, (rpc_port_proxy_mmi_result_cb_cb)voice_touch_callback);
+ EXPECT_EQ(res, MMI_ERROR_INVALID_PARAMETER);
+
+ mmi_deinitialize();
+}
+
+TEST_F(MMIIpcTest, MMIFWIpcRegisterFailNoCallback)
+{
+ int res = mmi_initialize();
+ mmi_input_event_type_e input_event_type = MMI_INPUT_EVENT_TYPE_VOICE_TOUCH;
+
+ EXPECT_EQ(res, MMI_ERROR_NONE);
+
+ res = mmi_ipc_register_input_event_result_cb(input_event_type, NULL);
+ EXPECT_EQ(res, MMI_ERROR_INVALID_PARAMETER);
+
+ mmi_deinitialize();
+}
+
+TEST_F(MMIIpcTest, MMIFWIpcRegisterFailNoClient)
+{
+ int res = mmi_initialize();
+ mmi_input_event_type_e input_event_type = MMI_INPUT_EVENT_TYPE_VOICE_TOUCH;
+
+ EXPECT_EQ(res, MMI_ERROR_NONE);
+
+ mmi_client_destroy();
+
+ res = mmi_ipc_register_input_event_result_cb(input_event_type, (rpc_port_proxy_mmi_result_cb_cb)voice_touch_callback);
+ EXPECT_EQ(res, MMI_ERROR_OPERATION_FAILED);
+
+ mmi_deinitialize();
+}
+
+TEST_F(MMIIpcTest, MMIFWIpcRegisterFailNoRpcHandle)
+{
+ int res = mmi_initialize();
+ mmi_input_event_type_e input_event_type = MMI_INPUT_EVENT_TYPE_VOICE_TOUCH;
+
+ EXPECT_EQ(res, MMI_ERROR_NONE);
+
+ mmi_ipc_deinitialize();
+
+ mmi_handle mmi_client = mmi_client_get();
+ mmi_client->rpc_h = NULL;
+
+ res = mmi_ipc_register_input_event_result_cb(input_event_type, (rpc_port_proxy_mmi_result_cb_cb)voice_touch_callback);
+ EXPECT_EQ(res, MMI_ERROR_OPERATION_FAILED);
+
+ mmi_deinitialize();
+}
+
+TEST_F(MMIIpcTest, MMIFWIpcActivateSuccess)
+{
+ int res = mmi_initialize();
+ mmi_input_event_type_e input_event_type = MMI_INPUT_EVENT_TYPE_VOICE_TOUCH;
+
+ EXPECT_EQ(res, MMI_ERROR_NONE);
+
+ res = mmi_ipc_register_input_event_result_cb(input_event_type, (rpc_port_proxy_mmi_result_cb_cb)voice_touch_callback);
+ EXPECT_EQ(res, MMI_ERROR_NONE);
+
+ res = mmi_ipc_activate_input_event(input_event_type);
+ EXPECT_EQ(res, MMI_ERROR_NONE);
+
+ mmi_deinitialize();
+}
+
+TEST_F(MMIIpcTest, MMIFWIpcActivateFailNoEvent)
+{
+ int res = mmi_initialize();
+ mmi_input_event_type_e input_event_type = MMI_INPUT_EVENT_TYPE_VOICE_TOUCH;
+
+ EXPECT_EQ(res, MMI_ERROR_NONE);
+
+ res = mmi_ipc_register_input_event_result_cb(input_event_type, (rpc_port_proxy_mmi_result_cb_cb)voice_touch_callback);
+ EXPECT_EQ(res, MMI_ERROR_NONE);
+
+ res = mmi_ipc_activate_input_event(MMI_INPUT_EVENT_TYPE_NONE);
+ EXPECT_EQ(res, MMI_ERROR_INVALID_PARAMETER);
+
+ mmi_deinitialize();
+}
+
+TEST_F(MMIIpcTest, MMIFWIpcActivateFailNoRpcHandle)
+{
+ int res = mmi_initialize();
+ mmi_input_event_type_e input_event_type = MMI_INPUT_EVENT_TYPE_VOICE_TOUCH;
+
+ EXPECT_EQ(res, MMI_ERROR_NONE);
+
+ res = mmi_ipc_register_input_event_result_cb(input_event_type, (rpc_port_proxy_mmi_result_cb_cb)voice_touch_callback);
+ EXPECT_EQ(res, MMI_ERROR_NONE);
+
+ mmi_ipc_deinitialize();
+
+ mmi_handle mmi_client = mmi_client_get();
+ mmi_client->rpc_h = NULL;
+
+ res = mmi_ipc_activate_input_event(input_event_type);
+ EXPECT_EQ(res, MMI_ERROR_OPERATION_FAILED);
+
+ mmi_deinitialize();
+}
+
+TEST_F(MMIIpcTest, MMIFWIpcActivateFailAlreadyDone)
+{
+ int res = mmi_initialize();
+ mmi_input_event_type_e input_event_type = MMI_INPUT_EVENT_TYPE_VOICE_TOUCH;
+
+ EXPECT_EQ(res, MMI_ERROR_NONE);
+
+ res = mmi_ipc_register_input_event_result_cb(input_event_type, (rpc_port_proxy_mmi_result_cb_cb)voice_touch_callback);
+ EXPECT_EQ(res, MMI_ERROR_NONE);
+
+ res = mmi_ipc_activate_input_event(input_event_type);
+ EXPECT_EQ(res, MMI_ERROR_NONE);
+
+ res = mmi_ipc_activate_input_event(input_event_type);
+ EXPECT_EQ(res, MMI_ERROR_OPERATION_FAILED);
+
+ mmi_deinitialize();
+}