1 // Copyright 2014 Samsung Electronics. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "utc_blink_ewk_base.h"
7 class utc_blink_cb_editorclient_ime_closed : public utc_blink_ewk_base
12 const char* default_context_id = ecore_imf_context_default_id_get();
13 ASSERT_TRUE(default_context_id) << "This TC can't be run without default imf context - it will fail anyway";
16 void LoadFinished(Evas_Object*)
18 EventLoopStop(utc_blink_ewk_base::Success);
21 static void editorclient_ime_closed_cb(utc_blink_cb_editorclient_ime_closed* owner, Evas_Object*, void*)
24 owner->EventLoopStop(utc_blink_ewk_base::Success);
29 * @brief Test "editorclient,ime,closed" callback
31 TEST_F(utc_blink_cb_editorclient_ime_closed, callback)
33 char htmlBuffer[] = "<html>"
36 "<input id=\"e\" type=\"text\"/><br/>"
37 "<a id=\"focus\" onclick=\"document.getElementById('e').focus();\">Focus</a><br/>"
38 "<a id=\"unfocus\" onclick=\"document.getElementById('e').blur();\">Unfocus</a><br/>"
43 ASSERT_EQ(EINA_TRUE, ewk_view_html_string_load(GetEwkWebView(), htmlBuffer, NULL, NULL));
44 // This TC will timeout on desktop as there is no input method context
45 ASSERT_EQ(utc_blink_ewk_base::Success, EventLoopStart());
47 // We need to focus on window
48 elm_object_focus_set(GetEwkWebView(), EINA_TRUE);
51 evas_object_smart_callback_auto ime(GetEwkWebView(), "editorclient,ime,opened", ToSmartCallback(editorclient_ime_closed_cb), this);
52 // This script execute should produce user gesture and should show software keyboard on mobile
53 ASSERT_EQ(EINA_TRUE, ewk_view_script_execute(GetEwkWebView(), "document.getElementById('focus').click();", NULL, NULL));
55 ASSERT_EQ(utc_blink_ewk_base::Success, EventLoopStart()) << "editorclient,ime,opened smart callback timeout";
59 evas_object_smart_callback_auto ime(GetEwkWebView(), "editorclient,ime,closed", ToSmartCallback(editorclient_ime_closed_cb), this);
60 // This script execute should produce user gesture and should show software keyboard on mobile
61 ASSERT_EQ(EINA_TRUE, ewk_view_script_execute(GetEwkWebView(), "document.getElementById('unfocus').click();", NULL, NULL));
63 ASSERT_EQ(utc_blink_ewk_base::Success, EventLoopStart()) << "editorclient,ime,opened smart callback timeout";