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_opened : 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";
18 evas_object_smart_callback_add(GetEwkWebView(), "editorclient,ime,opened", ToSmartCallback(editorclient_ime_opened_cb), this);
23 evas_object_smart_callback_del(GetEwkWebView(), "editorclient,ime,opened", ToSmartCallback(editorclient_ime_opened_cb));
26 void LoadFinished(Evas_Object*)
28 EventLoopStop(utc_blink_ewk_base::Success);
31 static void editorclient_ime_opened_cb(utc_blink_cb_editorclient_ime_opened* owner, Evas_Object*, void*)
34 owner->EventLoopStop(utc_blink_ewk_base::Success);
39 * @brief Test "editorclient,ime,opened" callback
41 TEST_F(utc_blink_cb_editorclient_ime_opened, callback)
43 char htmlBuffer[] = "<html>"
46 "<input id=\"e\" type=\"text\"><a id=\"b\" onclick=\"document.getElementById('e').focus(); console.log('asdf');\">Button</a>"
51 ASSERT_EQ(EINA_TRUE, ewk_view_html_string_load(GetEwkWebView(), htmlBuffer, NULL, NULL));
52 // This TC will timeout on desktop as there is no input method context
53 ASSERT_EQ(utc_blink_ewk_base::Success, EventLoopStart());
55 // We need to focus on window
56 elm_object_focus_set(GetEwkWebView(), EINA_TRUE);
58 // This script execute should produce user gesture and should show software keyboard on mobile
59 ASSERT_EQ(EINA_TRUE, ewk_view_script_execute(GetEwkWebView(), "document.getElementById('b').click();", NULL, NULL));
61 ASSERT_EQ(utc_blink_ewk_base::Success, EventLoopStart()) << "editorclient,ime,opened smart callback timeout";