fix geolocation unittests
authorArnaud Renevier <a.renevier@samsung.com>
Fri, 18 Sep 2015 22:12:50 +0000 (15:12 -0700)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
In the current tests, we rely on geolocation callbacks to be dispatched
before document load signal. But that's not necesseraly the case.
Instead, we will use timeouts.

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

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

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

index 355c94e..2591cfa 100755 (executable)
@@ -49,17 +49,6 @@ protected:
     owner->EventLoopStop(Failure);
   }
 
-  static void load_finished_fail_cb(utc_blink_cb_geolocation_valid* owner, Evas_Object*, void*)
-  {
-    ASSERT_TRUE(owner);
-    owner->EventLoopStop(Failure);
-  }
-
-  static void load_finished_success_cb(utc_blink_cb_geolocation_valid* owner, Evas_Object*, void*)
-  {
-    ASSERT_TRUE(owner);
-    owner->EventLoopStop(Success);
-  }
 };
 
 /**
@@ -69,7 +58,6 @@ TEST_F(utc_blink_cb_geolocation_valid, callback)
 {
   // Simply check if callback is fired, if load,finished comes first then something went wrong
   evas_object_smart_callback_auto gv(GetEwkWebView(), "geolocation,valid", ToSmartCallback(geolocation_valid_cb), this);
-  evas_object_smart_callback_auto lf(GetEwkWebView(), "load,finished", ToSmartCallback(load_finished_fail_cb), this);
 
   ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), GetResourceUrl(SAMPLE_HTML_FILE).c_str()));
   ASSERT_EQ(Success, EventLoopStart());
@@ -84,10 +72,9 @@ TEST_F(utc_blink_cb_geolocation_valid, callback_param_to_false)
 {
   evas_object_smart_callback_auto gp(GetEwkWebView(), "geolocation,permission,request", ToSmartCallback(request_geolocation_permisson_fail), this);
   evas_object_smart_callback_auto gv(GetEwkWebView(), "geolocation,valid", ToSmartCallback(geolocation_valid_deny_cb), this);
-  evas_object_smart_callback_auto lf(GetEwkWebView(), "load,finished", ToSmartCallback(load_finished_success_cb), this);
 
   ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), GetResourceUrl(SAMPLE_HTML_FILE).c_str()));
-  ASSERT_EQ(Success, EventLoopStart());
+  ASSERT_EQ(Timeout, EventLoopStart(5.0));
 }
 
 /**
@@ -99,8 +86,7 @@ TEST_F(utc_blink_cb_geolocation_valid, callback_param_to_true)
 {
   evas_object_smart_callback_auto gp(GetEwkWebView(), "geolocation,permission,request", ToSmartCallback(request_geolocation_permisson_success), this);
   evas_object_smart_callback_auto gv(GetEwkWebView(), "geolocation,valid", ToSmartCallback(geolocation_valid_allow_cb), this);
-  evas_object_smart_callback_auto lf(GetEwkWebView(), "load,finished", ToSmartCallback(load_finished_fail_cb), this);
 
   ASSERT_EQ(EINA_TRUE, ewk_view_url_set(GetEwkWebView(), GetResourceUrl(SAMPLE_HTML_FILE).c_str()));
-  ASSERT_EQ(Success, EventLoopStart());
+  ASSERT_EQ(Timeout, EventLoopStart(5.0));
 }