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"
6 #include "utc_blink_ewk_context_menu.h"
8 class utc_blink_cb_contextmenu_willshow: public utc_blink_ewk_base
11 utc_blink_cb_contextmenu_willshow()
17 void LoadFinished(Evas_Object* webview) override {
18 feed_mouse_click(3, 50, 50, GetEwkEvas());
21 void PostSetUp() override {
22 evas_object_smart_callback_add(GetEwkWebView(), "contextmenu,willshow", ToSmartCallback(contextmenu_willshow_cb), this);
25 void PreTearDown() override {
26 evas_object_smart_callback_del(GetEwkWebView(), "contextmenu,willshow", ToSmartCallback(contextmenu_willshow_cb));
29 static void contextmenu_willshow_cb(utc_blink_cb_contextmenu_willshow* owner, Evas_Object* webview, Evas_Point* position)
34 owner->pos.x = position->x;
35 owner->pos.y = position->y;
38 // callback has come, so we stop with success
39 owner->EventLoopStop(Success);
46 TEST_F(utc_blink_cb_contextmenu_willshow, callback)
48 // selecting text inside text area should invoke context menu
50 const char htmlBuff[] = "<html>"
52 "<textarea>Test context menu</textarea>"
56 ASSERT_EQ(EINA_TRUE, ewk_view_html_string_load(GetEwkWebView(), htmlBuff, NULL, NULL));
58 // Wait for context menu callback
59 ASSERT_EQ(Success, EventLoopStart());
60 // It's hard to calculate position of context menu that will appear so we check only if value was modified