fix contextmenu unittests
authorArnaud Renevier <a.renevier@samsung.com>
Fri, 18 Sep 2015 22:56:00 +0000 (15:56 -0700)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
In the unittestts, we try to emulate mouse click with calling .select on
textarea. But in the recent version of chromium, this won't work
anymore. Instead, we use evas_event_feed_mouse_* methods

Bug: http://web.sec.samsung.net/bugzilla/show_bug.cgi?id=13056

Reviewed by: a1.gomes, hh4813.kim, sns.park

Change-Id: Ie22c7bfdf4a7f1390d7dcff35e21648852518932
Signed-off-by: Arnaud Renevier <a.renevier@samsung.com>
tizen_src/ewk/unittest/utc_blink_cb_contextmenu_allowed.cpp
tizen_src/ewk/unittest/utc_blink_cb_contextmenu_willshow.cpp

index baca7d3..55cd3ee 100644 (file)
@@ -3,6 +3,7 @@
 // found in the LICENSE file.
 
 #include "utc_blink_ewk_base.h"
+#include "utc_blink_ewk_context_menu.h"
 
 class utc_blink_cb_contextmenu_allowed: public utc_blink_ewk_base
 {
@@ -12,13 +13,15 @@ protected:
   {
   }
 
-  void PostSetUp()
-  {
+  void LoadFinished(Evas_Object* webview) override {
+    feed_mouse_click(3, 50, 50, GetEwkEvas());
+  }
+
+  void PostSetUp() override {
     evas_object_smart_callback_add(GetEwkWebView(), "contextmenu,allowed", ToSmartCallback(contextmenu_allowed_cb), this);
   }
 
-  void PreTearDown()
-  {
+  void PreTearDown() override {
     evas_object_smart_callback_del(GetEwkWebView(), "contextmenu,allowed", ToSmartCallback(contextmenu_allowed_cb));
   }
 
@@ -43,8 +46,8 @@ TEST_F(utc_blink_cb_contextmenu_allowed, callback)
   // selecting text inside text area should invoke context menu
 
   const char htmlBuff[] = "<html>"
-                          "<body onload=\"document.getElementById('dd').select()\">"
-                          "<textarea id=\"dd\">Test fullscreen</textarea>"
+                          "<body>"
+                          "<textarea>Test context menu</textarea>"
                           "</body>"
                           "</html>";
 
index 0d50f7c..b9ecd60 100644 (file)
@@ -3,6 +3,7 @@
 // found in the LICENSE file.
 
 #include "utc_blink_ewk_base.h"
+#include "utc_blink_ewk_context_menu.h"
 
 class utc_blink_cb_contextmenu_willshow: public utc_blink_ewk_base
 {
@@ -13,13 +14,15 @@ protected:
     pos.y = -1;
   }
 
-  void PostSetUp()
-  {
+  void LoadFinished(Evas_Object* webview) override {
+    feed_mouse_click(3, 50, 50, GetEwkEvas());
+  }
+
+  void PostSetUp() override {
     evas_object_smart_callback_add(GetEwkWebView(), "contextmenu,willshow", ToSmartCallback(contextmenu_willshow_cb), this);
   }
 
-  void PreTearDown()
-  {
+  void PreTearDown() override {
     evas_object_smart_callback_del(GetEwkWebView(), "contextmenu,willshow", ToSmartCallback(contextmenu_willshow_cb));
   }
 
@@ -45,8 +48,8 @@ TEST_F(utc_blink_cb_contextmenu_willshow, callback)
   // selecting text inside text area should invoke context menu
 
   const char htmlBuff[] = "<html>"
-                          "<body onload=\"document.getElementById('dd').select()\">"
-                          "<textarea id=\"dd\">Test fullscreen</textarea>"
+                          "<body>"
+                          "<textarea>Test context menu</textarea>"
                           "</body>"
                           "</html>";