Title: [131715] trunk/Source/WebKit
Revision
131715
Author
[email protected]
Date
2012-10-18 01:25:48 -0700 (Thu, 18 Oct 2012)

Log Message

[EFL] Add unit test for ewk_frame_source_get.
https://bugs.webkit.org/show_bug.cgi?id=95984

Patch by Kangil Han <[email protected]> on 2012-10-18
Reviewed by Gyuyoung Kim.

Source/WebKit:

Add test_ewk_frame.cpp for unit test.

* PlatformEfl.cmake:

Source/WebKit/efl:

Add three unit test cases to verify ewk_frame_source_get function.
Additionally, insert code to check if uri exists in order to return error since view itself has blank html.

* ewk/ewk_frame.cpp:
(ewk_frame_source_get):
* tests/test_ewk_frame.cpp: Added.
(initBuffer):
(TEST_F):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (131714 => 131715)


--- trunk/Source/WebKit/ChangeLog	2012-10-18 08:13:54 UTC (rev 131714)
+++ trunk/Source/WebKit/ChangeLog	2012-10-18 08:25:48 UTC (rev 131715)
@@ -1,3 +1,14 @@
+2012-10-18  Kangil Han  <[email protected]>
+
+        [EFL] Add unit test for ewk_frame_source_get.
+        https://bugs.webkit.org/show_bug.cgi?id=95984
+
+        Reviewed by Gyuyoung Kim.
+
+        Add test_ewk_frame.cpp for unit test.
+
+        * PlatformEfl.cmake:
+
 2012-10-15  David Kilzer  <[email protected]>
 
         Move framework and library linking into WebKit.xcconfig

Modified: trunk/Source/WebKit/PlatformEfl.cmake (131714 => 131715)


--- trunk/Source/WebKit/PlatformEfl.cmake	2012-10-18 08:13:54 UTC (rev 131714)
+++ trunk/Source/WebKit/PlatformEfl.cmake	2012-10-18 08:25:48 UTC (rev 131715)
@@ -242,6 +242,7 @@
 SET(WEBKIT_EFL_TEST_DIR "${WEBKIT_DIR}/efl/tests/")
 
 SET(EWKUnitTests_BINARIES
+    test_ewk_frame
     test_ewk_view
 )
 

Modified: trunk/Source/WebKit/efl/ChangeLog (131714 => 131715)


--- trunk/Source/WebKit/efl/ChangeLog	2012-10-18 08:13:54 UTC (rev 131714)
+++ trunk/Source/WebKit/efl/ChangeLog	2012-10-18 08:25:48 UTC (rev 131715)
@@ -1,3 +1,19 @@
+2012-10-18  Kangil Han  <[email protected]>
+
+        [EFL] Add unit test for ewk_frame_source_get.
+        https://bugs.webkit.org/show_bug.cgi?id=95984
+
+        Reviewed by Gyuyoung Kim.
+
+        Add three unit test cases to verify ewk_frame_source_get function.
+        Additionally, insert code to check if uri exists in order to return error since view itself has blank html.
+
+        * ewk/ewk_frame.cpp:
+        (ewk_frame_source_get):
+        * tests/test_ewk_frame.cpp: Added.
+        (initBuffer):
+        (TEST_F):
+
 2012-10-17  Byungwoo Lee  <[email protected]>
 
         Fix build warnings : -Wunused-parameter, -Wunused-variable

Modified: trunk/Source/WebKit/efl/ewk/ewk_frame.cpp (131714 => 131715)


--- trunk/Source/WebKit/efl/ewk/ewk_frame.cpp	2012-10-18 08:13:54 UTC (rev 131714)
+++ trunk/Source/WebKit/efl/ewk/ewk_frame.cpp	2012-10-18 08:25:48 UTC (rev 131715)
@@ -1641,6 +1641,9 @@
     StringBuilder builder;
     *frameSource = 0; // Saves 0 to pointer until it's not allocated.
 
+    if (!ewk_frame_uri_get(ewkFrame))
+        return -1;
+
     if (!smartData->frame->document()->isHTMLDocument()) {
         // FIXME: Support others documents.
         WARN("Only HTML documents are supported");

Added: trunk/Source/WebKit/efl/tests/test_ewk_frame.cpp (0 => 131715)


--- trunk/Source/WebKit/efl/tests/test_ewk_frame.cpp	                        (rev 0)
+++ trunk/Source/WebKit/efl/tests/test_ewk_frame.cpp	2012-10-18 08:25:48 UTC (rev 131715)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1.  Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ * 2.  Red istributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND ITS CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
+ * HOLDERS OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "UnitTestUtils/EWKTestBase.h"
+#include "UnitTestUtils/EWKTestConfig.h"
+#include <EWebKit.h>
+
+using namespace EWKUnitTests;
+
+static void initBuffer(char** buffer)
+{
+    free(*buffer);
+    *buffer = 0;
+}
+
+/**
+ * @brief Unit test for ewk_frame_source_get.
+ */
+TEST_F(EWKTestBase, ewk_frame_source_get)
+{
+    char* buffer = 0;
+    ssize_t failed = -1; 
+
+    // Checking if function works properly without loading url.
+    ssize_t read = ewk_frame_source_get(ewk_view_frame_main_get(webView()), &buffer);
+    ASSERT_EQ(read, failed);
+    initBuffer(&buffer);
+
+    // Checking if function works properly when loading non-existing url.
+    loadUrl("http://www.abcdefg^^.com");
+    read = ewk_frame_source_get(ewk_view_frame_main_get(webView()), &buffer);
+    ASSERT_EQ(read, failed);
+    initBuffer(&buffer);
+
+    // Checking if function works properly when finishing load url.
+    loadUrl();
+    read = ewk_frame_source_get(ewk_view_frame_main_get(webView()), &buffer);
+    ASSERT_GT(read, 0);
+    initBuffer(&buffer);
+}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to