Title: [123199] trunk/Source/WebKit2
Revision
123199
Author
[email protected]
Date
2012-07-20 03:17:05 -0700 (Fri, 20 Jul 2012)

Log Message

[EFL][WK2] Use "load,finished" signal in EWK2UnitTestBase::loadUrlSync() instead of "load,progress"
https://bugs.webkit.org/show_bug.cgi?id=91721

Patch by Christophe Dumez <[email protected]> on 2012-07-20
Reviewed by Kenneth Rohde Christiansen.

The purpose of EWK2UnitTestBase::loadUrlSync() is to load
a URL in the view and wait synchronously for the load to finish.
The current implementation uses the "load,progress" signal to
detect when the load is finished, which is inefficient because
it gets emitted several times.

It is better to wait for the "load,finished" signal which gets
emitted only once when the load is complete.

* UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp:
(EWK2UnitTest::onLoadFinished):
(EWK2UnitTest::EWK2UnitTestBase::EWK2UnitTestBase):
(EWK2UnitTest::EWK2UnitTestBase::loadUrlSync):
* UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h:
(EWK2UnitTestBase):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (123198 => 123199)


--- trunk/Source/WebKit2/ChangeLog	2012-07-20 09:41:35 UTC (rev 123198)
+++ trunk/Source/WebKit2/ChangeLog	2012-07-20 10:17:05 UTC (rev 123199)
@@ -1,3 +1,26 @@
+2012-07-20  Christophe Dumez  <[email protected]>
+
+        [EFL][WK2] Use "load,finished" signal in EWK2UnitTestBase::loadUrlSync() instead of "load,progress"
+        https://bugs.webkit.org/show_bug.cgi?id=91721
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        The purpose of EWK2UnitTestBase::loadUrlSync() is to load
+        a URL in the view and wait synchronously for the load to finish.
+        The current implementation uses the "load,progress" signal to
+        detect when the load is finished, which is inefficient because
+        it gets emitted several times.
+
+        It is better to wait for the "load,finished" signal which gets
+        emitted only once when the load is complete.
+
+        * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp:
+        (EWK2UnitTest::onLoadFinished):
+        (EWK2UnitTest::EWK2UnitTestBase::EWK2UnitTestBase):
+        (EWK2UnitTest::EWK2UnitTestBase::loadUrlSync):
+        * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h:
+        (EWK2UnitTestBase):
+
 2012-07-19  MORITA Hajime  <[email protected]>
 
         [Refactoring] Replace Node's Document pointer with a TreeScope pointer

Modified: trunk/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp (123198 => 123199)


--- trunk/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp	2012-07-20 09:41:35 UTC (rev 123198)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp	2012-07-20 10:17:05 UTC (rev 123199)
@@ -29,19 +29,17 @@
 
 namespace EWK2UnitTest {
 
-static void onLoadProgress(void* userData, Evas_Object* webView, void* eventInfo)
+static void onLoadFinished(void* userData, Evas_Object* webView, void* eventInfo)
 {
     UNUSED_PARAM(webView);
+    UNUSED_PARAM(eventInfo);
 
-    EWK2UnitTestBase* test = static_cast<EWK2UnitTestBase*>(userData);
-    double progress = *static_cast<double*>(eventInfo);
-
-    test->setLoadProgress(progress);
+    bool* loadFinished = static_cast<bool*>(userData);
+    *loadFinished = true;
 }
 
 EWK2UnitTestBase::EWK2UnitTestBase()
-    : m_loadProgress(0)
-    , m_ecoreEvas(0)
+    : m_ecoreEvas(0)
     , m_webView(0)
 {
 }
@@ -78,15 +76,15 @@
 
 void EWK2UnitTestBase::loadUrlSync(const char* url)
 {
-    m_loadProgress = 0;
+    bool loadFinished = false;
 
-    evas_object_smart_callback_add(m_webView, "load,progress", onLoadProgress, this);
+    evas_object_smart_callback_add(m_webView, "load,finished", onLoadFinished, &loadFinished);
     ewk_view_uri_set(m_webView, url);
 
-    while (m_loadProgress != 1)
+    while (!loadFinished)
         ecore_main_loop_iterate();
 
-    evas_object_smart_callback_del(m_webView, "load,progress", onLoadProgress);
+    evas_object_smart_callback_del(m_webView, "load,finished", onLoadFinished);
 }
 
 } // namespace EWK2UnitTest

Modified: trunk/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h (123198 => 123199)


--- trunk/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h	2012-07-20 09:41:35 UTC (rev 123198)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h	2012-07-20 10:17:05 UTC (rev 123199)
@@ -28,7 +28,6 @@
 
 class EWK2UnitTestBase : public ::testing::Test {
 public:
-    void setLoadProgress(float progress) { m_loadProgress = progress; }
     Evas_Object* webView() { return m_webView; }
 
 protected:
@@ -42,8 +41,6 @@
 private:
     Evas_Object* m_webView;
     Ecore_Evas* m_ecoreEvas;
-
-    float m_loadProgress;
 };
 
 } // namespace EWK2UnitTest
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to