Title: [130843] trunk/Source/WebKit2
Revision
130843
Author
commit-qu...@webkit.org
Date
2012-10-09 21:49:52 -0700 (Tue, 09 Oct 2012)

Log Message

[EFL][WK2] Change parameter and return type of loadUrlSync().
https://bugs.webkit.org/show_bug.cgi?id=97920

Patch by Byungwoo Lee <bw80....@samsung.com> on 2012-10-09
Reviewed by Gyuyoung Kim.

loadUrlSync() uses waitUntilLoadFinished() internally, and it has
a parameter and return value for timeout.
To set and check timeout, loadUrlSync() should have those.

A parameter for timeout interval is added to loadUrlSync() and it
returns the result of waitUntilLoadFinished() for checking timeout.

And I added codes to check the result of all the LoadUrlSync()
function calls with ASSERT_TRUE() macro.

* UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp:
(EWK2UnitTest::EWK2UnitTestBase::loadUrlSync):
* UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h:
(EWK2UnitTestBase):
* UIProcess/API/efl/tests/test_ewk2_back_forward_list.cpp:
(TEST_F):
* UIProcess/API/efl/tests/test_ewk2_context.cpp:
(TEST_F):
* UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp:
(TEST_F):
* UIProcess/API/efl/tests/test_ewk2_intents.cpp:
(TEST_F):
* UIProcess/API/efl/tests/test_ewk2_view.cpp:
(TEST_F):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (130842 => 130843)


--- trunk/Source/WebKit2/ChangeLog	2012-10-10 04:48:17 UTC (rev 130842)
+++ trunk/Source/WebKit2/ChangeLog	2012-10-10 04:49:52 UTC (rev 130843)
@@ -1,5 +1,37 @@
 2012-10-09  Byungwoo Lee  <bw80....@samsung.com>
 
+        [EFL][WK2] Change parameter and return type of loadUrlSync().
+        https://bugs.webkit.org/show_bug.cgi?id=97920
+
+        Reviewed by Gyuyoung Kim.
+
+        loadUrlSync() uses waitUntilLoadFinished() internally, and it has
+        a parameter and return value for timeout.
+        To set and check timeout, loadUrlSync() should have those.
+
+        A parameter for timeout interval is added to loadUrlSync() and it
+        returns the result of waitUntilLoadFinished() for checking timeout.
+
+        And I added codes to check the result of all the LoadUrlSync()
+        function calls with ASSERT_TRUE() macro.
+
+        * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp:
+        (EWK2UnitTest::EWK2UnitTestBase::loadUrlSync):
+        * UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h:
+        (EWK2UnitTestBase):
+        * UIProcess/API/efl/tests/test_ewk2_back_forward_list.cpp:
+        (TEST_F):
+        * UIProcess/API/efl/tests/test_ewk2_context.cpp:
+        (TEST_F):
+        * UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp:
+        (TEST_F):
+        * UIProcess/API/efl/tests/test_ewk2_intents.cpp:
+        (TEST_F):
+        * UIProcess/API/efl/tests/test_ewk2_view.cpp:
+        (TEST_F):
+
+2012-10-09  Byungwoo Lee  <bw80....@samsung.com>
+
         [EFL][WK2] Move timeout callback to the CallbackDataTimer class.
         https://bugs.webkit.org/show_bug.cgi?id=97861
 

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


--- trunk/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp	2012-10-10 04:48:17 UTC (rev 130842)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.cpp	2012-10-10 04:49:52 UTC (rev 130843)
@@ -71,10 +71,10 @@
     ewk_shutdown();
 }
 
-void EWK2UnitTestBase::loadUrlSync(const char* url)
+bool EWK2UnitTestBase::loadUrlSync(const char* url, double timeoutSeconds)
 {
     ewk_view_url_set(m_webView, url);
-    waitUntilLoadFinished();
+    return waitUntilLoadFinished(timeoutSeconds);
 }
 
 class CallbackDataTimer {

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


--- trunk/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h	2012-10-10 04:48:17 UTC (rev 130842)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestBase.h	2012-10-10 04:49:52 UTC (rev 130843)
@@ -40,9 +40,9 @@
     virtual void SetUp();
     virtual void TearDown();
 
-    void loadUrlSync(const char* url);
+    static const double defaultTimeoutSeconds = 10.0;
 
-    static const double defaultTimeoutSeconds = 10.0;
+    bool loadUrlSync(const char* url, double timeoutSeconds = defaultTimeoutSeconds);
     bool waitUntilLoadFinished(double timeoutSeconds = defaultTimeoutSeconds);
     bool waitUntilTitleChangedTo(const char* expectedTitle, double timeoutSeconds = defaultTimeoutSeconds);
     bool waitUntilURLChangedTo(const char* expectedURL, double timeoutSeconds = defaultTimeoutSeconds);

Modified: trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_back_forward_list.cpp (130842 => 130843)


--- trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_back_forward_list.cpp	2012-10-10 04:48:17 UTC (rev 130842)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_back_forward_list.cpp	2012-10-10 04:49:52 UTC (rev 130843)
@@ -89,7 +89,7 @@
 TEST_F(EWK2UnitTestBase, ewk_back_forward_list_current_item_get)
 {
     const char* url = ""
-    loadUrlSync(url);
+    ASSERT_TRUE(loadUrlSync(url));
     Ewk_Back_Forward_List* backForwardList = ewk_view_back_forward_list_get(webView());
     ASSERT_TRUE(backForwardList);
 
@@ -106,10 +106,10 @@
     httpServer->run(serverCallbackNavigation);
 
     WKEinaSharedString url1 = urlFromTitle(httpServer.get(), title1);
-    loadUrlSync(url1);
+    ASSERT_TRUE(loadUrlSync(url1));
     ASSERT_STREQ(title1, ewk_view_title_get(webView()));
 
-    loadUrlSync(urlFromTitle(httpServer.get(), title2));
+    ASSERT_TRUE(loadUrlSync(urlFromTitle(httpServer.get(), title2)));
     ASSERT_STREQ(title2, ewk_view_title_get(webView()));
 
     Ewk_Back_Forward_List* backForwardList = ewk_view_back_forward_list_get(webView());
@@ -127,11 +127,11 @@
     OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer);
     httpServer->run(serverCallbackNavigation);
 
-    loadUrlSync(urlFromTitle(httpServer.get(), title1));
+    ASSERT_TRUE(loadUrlSync(urlFromTitle(httpServer.get(), title1)));
     ASSERT_STREQ(title1, ewk_view_title_get(webView()));
 
     WKEinaSharedString url2 = urlFromTitle(httpServer.get(), title2);
-    loadUrlSync(url2);
+    ASSERT_TRUE(loadUrlSync(url2));
     ASSERT_STREQ(title2, ewk_view_title_get(webView()));
 
     // Go back to Page1.
@@ -154,10 +154,10 @@
     httpServer->run(serverCallbackNavigation);
 
     WKEinaSharedString url1 = urlFromTitle(httpServer.get(), title1);
-    loadUrlSync(url1);
+    ASSERT_TRUE(loadUrlSync(url1));
     ASSERT_STREQ(title1, ewk_view_title_get(webView()));
 
-    loadUrlSync(urlFromTitle(httpServer.get(), title2));
+    ASSERT_TRUE(loadUrlSync(urlFromTitle(httpServer.get(), title2)));
     ASSERT_STREQ(title2, ewk_view_title_get(webView()));
 
     Ewk_Back_Forward_List* backForwardList = ewk_view_back_forward_list_get(webView());
@@ -178,10 +178,10 @@
     OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer);
     httpServer->run(serverCallbackNavigation);
 
-    loadUrlSync(urlFromTitle(httpServer.get(), title1));
+    ASSERT_TRUE(loadUrlSync(urlFromTitle(httpServer.get(), title1)));
     ASSERT_STREQ(title1, ewk_view_title_get(webView()));
 
-    loadUrlSync(urlFromTitle(httpServer.get(), title2));
+    ASSERT_TRUE(loadUrlSync(urlFromTitle(httpServer.get(), title2)));
     ASSERT_STREQ(title2, ewk_view_title_get(webView()));
 
     Ewk_Back_Forward_List* backForwardList = ewk_view_back_forward_list_get(webView());
@@ -196,14 +196,14 @@
     httpServer->run(serverCallbackNavigation);
 
     WKEinaSharedString url1 = urlFromTitle(httpServer.get(), title1);
-    loadUrlSync(url1);
+    ASSERT_TRUE(loadUrlSync(url1));
     ASSERT_STREQ(title1, ewk_view_title_get(webView()));
 
     WKEinaSharedString url2 = urlFromTitle(httpServer.get(), title2);
-    loadUrlSync(url2);
+    ASSERT_TRUE(loadUrlSync(url2));
     ASSERT_STREQ(title2, ewk_view_title_get(webView()));
 
-    loadUrlSync(urlFromTitle(httpServer.get(), title3));
+    ASSERT_TRUE(loadUrlSync(urlFromTitle(httpServer.get(), title3)));
     ASSERT_STREQ(title3, ewk_view_title_get(webView()));
 
     Ewk_Back_Forward_List* backForwardList = ewk_view_back_forward_list_get(webView());
@@ -232,15 +232,15 @@
     OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer);
     httpServer->run(serverCallbackNavigation);
 
-    loadUrlSync(urlFromTitle(httpServer.get(), title1));
+    ASSERT_TRUE(loadUrlSync(urlFromTitle(httpServer.get(), title1)));
     ASSERT_STREQ(title1, ewk_view_title_get(webView()));
 
     WKEinaSharedString url2 = urlFromTitle(httpServer.get(), title2);
-    loadUrlSync(url2);
+    ASSERT_TRUE(loadUrlSync(url2));
     ASSERT_STREQ(title2, ewk_view_title_get(webView()));
 
     WKEinaSharedString url3 = urlFromTitle(httpServer.get(), title3);
-    loadUrlSync(url3);
+    ASSERT_TRUE(loadUrlSync(url3));
     ASSERT_STREQ(title3, ewk_view_title_get(webView()));
 
     // Go back to Page1.

Modified: trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp (130842 => 130843)


--- trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp	2012-10-10 04:48:17 UTC (rev 130842)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp	2012-10-10 04:49:52 UTC (rev 130843)
@@ -67,7 +67,7 @@
 TEST_F(EWK2UnitTestBase, ewk_context_url_scheme_register)
 {
     ewk_context_url_scheme_register(ewk_view_context_get(webView()), "fooscheme", schemeRequestCallback, 0);
-    loadUrlSync("fooscheme:MyPath");
+    ASSERT_TRUE(loadUrlSync("fooscheme:MyPath"));
     ASSERT_STREQ("Foo", ewk_view_title_get(webView()));
 }
 

Modified: trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp (130842 => 130843)


--- trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp	2012-10-10 04:48:17 UTC (rev 130842)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp	2012-10-10 04:49:52 UTC (rev 130843)
@@ -131,7 +131,7 @@
 
     // Default policy is EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY.
     ASSERT_EQ(EWK_COOKIE_ACCEPT_POLICY_NO_THIRD_PARTY, getAcceptPolicy(cookieManager));
-    loadUrlSync(httpServer->getURLForPath("/index.html").data());
+    ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/index.html").data()));
 
     Eina_List* hostnames = getHostnamesWithCookies(cookieManager);
     ASSERT_EQ(1, eina_list_count(hostnames));
@@ -142,7 +142,7 @@
     // Change policy to EWK_COOKIE_ACCEPT_POLICY_ALWAYS
     ewk_cookie_manager_accept_policy_set(cookieManager, EWK_COOKIE_ACCEPT_POLICY_ALWAYS);
     ASSERT_EQ(EWK_COOKIE_ACCEPT_POLICY_ALWAYS, getAcceptPolicy(cookieManager));
-    loadUrlSync(httpServer->getURLForPath("/index.html").data());
+    ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/index.html").data()));
 
     hostnames = getHostnamesWithCookies(cookieManager);
     ASSERT_EQ(2, eina_list_count(hostnames));
@@ -155,7 +155,7 @@
     // Change policy to EWK_COOKIE_ACCEPT_POLICY_NEVER
     ewk_cookie_manager_accept_policy_set(cookieManager, EWK_COOKIE_ACCEPT_POLICY_NEVER);
     ASSERT_EQ(EWK_COOKIE_ACCEPT_POLICY_NEVER, getAcceptPolicy(cookieManager));
-    loadUrlSync(httpServer->getURLForPath("/index.html").data());
+    ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/index.html").data()));
     ASSERT_EQ(0, countHostnamesWithCookies(cookieManager));
 }
 
@@ -181,7 +181,7 @@
     ewk_cookie_manager_changes_watch(cookieManager, onCookiesChanged, &cookiesChanged);
 
     // Check for cookie changes notifications
-    loadUrlSync(httpServer->getURLForPath("/index.html").data());
+    ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/index.html").data()));
 
     while (!cookiesChanged)
         ecore_main_loop_iterate();
@@ -196,7 +196,7 @@
     // Stop watching for notifications
     ewk_cookie_manager_changes_watch(cookieManager, 0, 0);
     cookiesChanged = false;
-    loadUrlSync(httpServer->getURLForPath("/index.html").data());
+    ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/index.html").data()));
     ASSERT_EQ(2, countHostnamesWithCookies(cookieManager));
     ASSERT_FALSE(cookiesChanged);
 
@@ -210,7 +210,7 @@
     ASSERT_TRUE(mktemp(textStorage2));
 
     ewk_cookie_manager_persistent_storage_set(cookieManager, textStorage1, EWK_COOKIE_PERSISTENT_STORAGE_TEXT);
-    loadUrlSync(httpServer->getURLForPath("/index.html").data());
+    ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/index.html").data()));
     ASSERT_EQ(2, countHostnamesWithCookies(cookieManager));
 
     cookiesChanged = false;
@@ -239,7 +239,7 @@
     ewk_cookie_manager_accept_policy_set(cookieManager, EWK_COOKIE_ACCEPT_POLICY_ALWAYS);
     ASSERT_EQ(EWK_COOKIE_ACCEPT_POLICY_ALWAYS, getAcceptPolicy(cookieManager));
 
-    loadUrlSync(httpServer->getURLForPath("/index.html").data());
+    ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/index.html").data()));
     Eina_List* hostnames = getHostnamesWithCookies(cookieManager);
     ASSERT_EQ(2, eina_list_count(hostnames));
     freeHostNames(hostnames);
@@ -256,7 +256,7 @@
     ASSERT_EQ(0, countHostnamesWithCookies(cookieManager));
 
     // Get all cookies again
-    loadUrlSync(httpServer->getURLForPath("/index.html").data());
+    ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/index.html").data()));
     ASSERT_EQ(2, countHostnamesWithCookies(cookieManager));
 
     // Clear all cookies
@@ -285,14 +285,14 @@
     ewk_cookie_manager_persistent_storage_set(cookieManager, textStorage, EWK_COOKIE_PERSISTENT_STORAGE_TEXT);
     ASSERT_EQ(0, countHostnamesWithCookies(cookieManager));
 
-    loadUrlSync(httpServer->getURLForPath("/index.html").data());
+    ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/index.html").data()));
     ASSERT_EQ(2, countHostnamesWithCookies(cookieManager));
 
     // SQLite storage using a new file.
     ewk_cookie_manager_persistent_storage_set(cookieManager, sqliteStorage, EWK_COOKIE_PERSISTENT_STORAGE_SQLITE);
     ASSERT_EQ(0, countHostnamesWithCookies(cookieManager));
 
-    loadUrlSync(httpServer->getURLForPath("/index.html").data());
+    ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/index.html").data()));
     ASSERT_EQ(2, countHostnamesWithCookies(cookieManager));
 
     // Text storage using an existing file.

Modified: trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp (130842 => 130843)


--- trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp	2012-10-10 04:48:17 UTC (rev 130842)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp	2012-10-10 04:49:52 UTC (rev 130843)
@@ -54,7 +54,7 @@
 {
     bool intentRegistered = false;
     evas_object_smart_callback_add(webView(), "intent,service,register", onIntentServiceRegistration, &intentRegistered);
-    loadUrlSync(environment->urlForResource("intent-service.html").data());
+    ASSERT_TRUE(loadUrlSync(environment->urlForResource("intent-service.html").data()));
     evas_object_smart_callback_del(webView(), "intent,service,register", onIntentServiceRegistration);
     ASSERT_TRUE(intentRegistered);
 }
@@ -103,7 +103,7 @@
 {
     unsigned intentReceivedCount = 0;
     evas_object_smart_callback_add(webView(), "intent,request,new", onIntentReceived, &intentReceivedCount);
-    loadUrlSync(environment->urlForResource("intent-request.html").data());
+    ASSERT_TRUE(loadUrlSync(environment->urlForResource("intent-request.html").data()));
 
     // A user gesture is required for the intent to start.
     mouseClick(5, 5);

Modified: trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp (130842 => 130843)


--- trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp	2012-10-10 04:48:17 UTC (rev 130842)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_view.cpp	2012-10-10 04:49:52 UTC (rev 130843)
@@ -46,7 +46,7 @@
 
 TEST_F(EWK2UnitTestBase, ewk_view_url_get)
 {
-    loadUrlSync(environment->defaultTestPageUrl());
+    ASSERT_TRUE(loadUrlSync(environment->defaultTestPageUrl()));
     EXPECT_STREQ(environment->defaultTestPageUrl(), ewk_view_url_get(webView()));
 
     int countLoadFinished = 2;
@@ -60,7 +60,7 @@
 
 TEST_F(EWK2UnitTestBase, ewk_view_device_pixel_ratio)
 {
-    loadUrlSync(environment->defaultTestPageUrl());
+    ASSERT_TRUE(loadUrlSync(environment->defaultTestPageUrl()));
 
     // Default pixel ratio is 1.0
     ASSERT_FLOAT_EQ(1, ewk_view_device_pixel_ratio_get(webView()));
@@ -106,13 +106,13 @@
     httpServer->run(serverCallbackNavigation);
 
     // Visit Page1
-    loadUrlSync(httpServer->getURLForPath("/Page1").data());
+    ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/Page1").data()));
     ASSERT_STREQ("Page1", ewk_view_title_get(webView()));
     ASSERT_FALSE(ewk_view_back_possible(webView()));
     ASSERT_FALSE(ewk_view_forward_possible(webView()));
 
     // Visit Page2
-    loadUrlSync(httpServer->getURLForPath("/Page2").data());
+    ASSERT_TRUE(loadUrlSync(httpServer->getURLForPath("/Page2").data()));
     ASSERT_STREQ("Page2", ewk_view_title_get(webView()));
     ASSERT_TRUE(ewk_view_back_possible(webView()));
     ASSERT_FALSE(ewk_view_forward_possible(webView()));
@@ -353,7 +353,7 @@
 {
     // Tests that same page navigation updates the page URL.
     String testUrl = environment->urlForResource("same_page_navigation.html").data();
-    loadUrlSync(testUrl.utf8().data());
+    ASSERT_TRUE(loadUrlSync(testUrl.utf8().data()));
     ASSERT_STREQ(testUrl.utf8().data(), ewk_view_url_get(webView()));
     mouseClick(50, 50);
     testUrl = testUrl + '#';
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to