Title: [152766] trunk/Source/WebKit2
Revision
152766
Author
[email protected]
Date
2013-07-17 00:18:31 -0700 (Wed, 17 Jul 2013)

Log Message

[EFL][WK2] EWK2FaviconDatabaseTest should be defined by inheriting from EWK2UnitTestBase.
https://bugs.webkit.org/show_bug.cgi?id=118772

Patch by Dong-Gwan Kim <[email protected]> on 2013-07-17
Reviewed by Christophe Dumez.

It should be defined as relevant test class specific to each test file for more readability.
It could be helpful to remove unnecessary static methods.

* UIProcess/API/efl/tests/test_ewk2_favicon_database.cpp:
(EWK2FaviconDatabaseTest::serverCallback):
(EWK2FaviconDatabaseTest::requestFaviconData):
(TEST_F):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (152765 => 152766)


--- trunk/Source/WebKit2/ChangeLog	2013-07-17 07:16:42 UTC (rev 152765)
+++ trunk/Source/WebKit2/ChangeLog	2013-07-17 07:18:31 UTC (rev 152766)
@@ -1,5 +1,20 @@
 2013-07-17  Dong-Gwan Kim  <[email protected]>
 
+        [EFL][WK2] EWK2FaviconDatabaseTest should be defined by inheriting from EWK2UnitTestBase.
+        https://bugs.webkit.org/show_bug.cgi?id=118772
+
+        Reviewed by Christophe Dumez.
+
+        It should be defined as relevant test class specific to each test file for more readability.
+        It could be helpful to remove unnecessary static methods.
+
+        * UIProcess/API/efl/tests/test_ewk2_favicon_database.cpp:
+        (EWK2FaviconDatabaseTest::serverCallback):
+        (EWK2FaviconDatabaseTest::requestFaviconData):
+        (TEST_F):
+
+2013-07-17  Dong-Gwan Kim  <[email protected]>
+
         [EFL][WK2] EWK2EinaSharedStringTest should be defined by inheriting from EWK2UnitTestBase.
         https://bugs.webkit.org/show_bug.cgi?id=118771
 

Modified: trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_favicon_database.cpp (152765 => 152766)


--- trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_favicon_database.cpp	2013-07-17 07:16:42 UTC (rev 152765)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_favicon_database.cpp	2013-07-17 07:18:31 UTC (rev 152766)
@@ -35,66 +35,69 @@
 
 extern EWK2UnitTestEnvironment* environment;
 
-static void serverCallback(SoupServer* httpServer, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer)
-{
-    if (message->method != SOUP_METHOD_GET) {
-        soup_message_set_status(message, SOUP_STATUS_NOT_IMPLEMENTED);
+class EWK2FaviconDatabaseTest : public EWK2UnitTestBase {
+public:
+    struct IconRequestData {
+        Evas_Object* view;
+        Evas_Object* icon;
+    };
+
+    static void serverCallback(SoupServer* httpServer, SoupMessage* message, const char* path, GHashTable*, SoupClientContext*, gpointer)
+    {
+        if (message->method != SOUP_METHOD_GET) {
+            soup_message_set_status(message, SOUP_STATUS_NOT_IMPLEMENTED);
         return;
-    }
-
-    if (!strcmp(path, "/favicon.ico")) {
-        CString faviconPath = environment->pathForResource("blank.ico");
-        Eina_File* f = eina_file_open(faviconPath.data(), false);
-        if (!f) {
-            soup_message_set_status(message, SOUP_STATUS_NOT_FOUND);
-            soup_message_body_complete(message->response_body);
-            return;
         }
 
-        size_t fileSize = eina_file_size_get(f);
+        if (!strcmp(path, "/favicon.ico")) {
+            CString faviconPath = environment->pathForResource("blank.ico");
+            Eina_File* f = eina_file_open(faviconPath.data(), false);
+            if (!f) {
+                soup_message_set_status(message, SOUP_STATUS_NOT_FOUND);
+                soup_message_body_complete(message->response_body);
+                return;
+            }
 
-        void* contents = eina_file_map_all(f, EINA_FILE_POPULATE);
-        if (!contents) {
-            soup_message_set_status(message, SOUP_STATUS_NOT_FOUND);
+            size_t fileSize = eina_file_size_get(f);
+
+            void* contents = eina_file_map_all(f, EINA_FILE_POPULATE);
+            if (!contents) {
+                soup_message_set_status(message, SOUP_STATUS_NOT_FOUND);
+                soup_message_body_complete(message->response_body);
+                return;
+            }
+
+            soup_message_body_append(message->response_body, SOUP_MEMORY_COPY, contents, fileSize);
+            soup_message_set_status(message, SOUP_STATUS_OK);
             soup_message_body_complete(message->response_body);
+
+            eina_file_map_free(f, contents);
+            eina_file_close(f);
             return;
         }
 
-        soup_message_body_append(message->response_body, SOUP_MEMORY_COPY, contents, fileSize);
+        const char contents[] = "<html><body>favicon test</body></html>";
         soup_message_set_status(message, SOUP_STATUS_OK);
+        soup_message_body_append(message->response_body, SOUP_MEMORY_COPY, contents, strlen(contents));
         soup_message_body_complete(message->response_body);
-
-        eina_file_map_free(f, contents);
-        eina_file_close(f);
-        return;
     }
 
-    const char contents[] = "<html><body>favicon test</body></html>";
-    soup_message_set_status(message, SOUP_STATUS_OK);
-    soup_message_body_append(message->response_body, SOUP_MEMORY_COPY, contents, strlen(contents));
-    soup_message_body_complete(message->response_body);
-}
+    static void requestFaviconData(void* userData, Evas_Object*, void* eventInfo)
+    {
+        IconRequestData* data = ""
 
-struct IconRequestData {
-    Evas_Object* view;
-    Evas_Object* icon;
+        // Check the API retrieving a valid favicon from icon database.
+        Ewk_Context* context = ewk_view_context_get(data->view);
+        Ewk_Favicon_Database* faviconDatabase = ewk_context_favicon_database_get(context);
+        ASSERT_TRUE(faviconDatabase);
+
+        Evas* evas = evas_object_evas_get(data->view);
+        data->icon = ewk_favicon_database_icon_get(faviconDatabase, ewk_view_url_get(data->view), evas);
+    }
 };
 
-static void requestFaviconData(void* userData, Evas_Object*, void* eventInfo)
+TEST_F(EWK2FaviconDatabaseTest, ewk_favicon_database_async_icon_get)
 {
-    IconRequestData* data = ""
-
-    // Check the API retrieving a valid favicon from icon database.
-    Ewk_Context* context = ewk_view_context_get(data->view);
-    Ewk_Favicon_Database* faviconDatabase = ewk_context_favicon_database_get(context);
-    ASSERT_TRUE(faviconDatabase);
-
-    Evas* evas = evas_object_evas_get(data->view);
-    data->icon = ewk_favicon_database_icon_get(faviconDatabase, ewk_view_url_get(data->view), evas);
-}
-
-TEST_F(EWK2UnitTestBase, ewk_favicon_database_async_icon_get)
-{
     OwnPtr<EWK2UnitTestServer> httpServer = adoptPtr(new EWK2UnitTestServer);
     httpServer->run(serverCallback);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to