Modified: trunk/Source/WebKit2/ChangeLog (123751 => 123752)
--- trunk/Source/WebKit2/ChangeLog 2012-07-26 16:00:16 UTC (rev 123751)
+++ trunk/Source/WebKit2/ChangeLog 2012-07-26 16:04:20 UTC (rev 123752)
@@ -1,5 +1,23 @@
2012-07-26 Christophe Dumez <christophe.du...@intel.com>
+ [EFL][WK2] Add unit tests for Ewk_Context
+ https://bugs.webkit.org/show_bug.cgi?id=92005
+
+ Reviewed by Antonio Gomes.
+
+ Add unit tests for WebKit2 Ewk_Context.
+
+ * PlatformEfl.cmake:
+ * UIProcess/API/efl/ewk_url_scheme_request.cpp:
+ (ewk_url_scheme_request_finish):
+ * UIProcess/API/efl/ewk_url_scheme_request.h: Mark content_data
+ argument as const.
+ * UIProcess/API/efl/tests/test_ewk2_context.cpp: Added.
+ (TEST_F):
+ (schemeRequestCallback):
+
+2012-07-26 Christophe Dumez <christophe.du...@intel.com>
+
[EFL][WK2] Add form client for Ewk_View
https://bugs.webkit.org/show_bug.cgi?id=92358
Modified: trunk/Source/WebKit2/PlatformEfl.cmake (123751 => 123752)
--- trunk/Source/WebKit2/PlatformEfl.cmake 2012-07-26 16:00:16 UTC (rev 123751)
+++ trunk/Source/WebKit2/PlatformEfl.cmake 2012-07-26 16:04:20 UTC (rev 123752)
@@ -246,6 +246,7 @@
# The "ewk" on the test name needs to be suffixed with "2", otherwise it
# will clash with tests from the WebKit 1 test suite.
SET(EWK2UnitTests_BINARIES
+ test_ewk2_context
test_ewk2_cookie_manager
test_ewk2_view
)
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.cpp (123751 => 123752)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.cpp 2012-07-26 16:00:16 UTC (rev 123751)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.cpp 2012-07-26 16:04:20 UTC (rev 123752)
@@ -115,7 +115,7 @@
return request->requestID;
}
-Eina_Bool ewk_url_scheme_request_finish(const Ewk_Url_Scheme_Request* request, void* contentData, unsigned int contentLength, const char* mimeType)
+Eina_Bool ewk_url_scheme_request_finish(const Ewk_Url_Scheme_Request* request, const void* contentData, unsigned int contentLength, const char* mimeType)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(request, false);
Modified: trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.h (123751 => 123752)
--- trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.h 2012-07-26 16:00:16 UTC (rev 123751)
+++ trunk/Source/WebKit2/UIProcess/API/efl/ewk_url_scheme_request.h 2012-07-26 16:04:20 UTC (rev 123752)
@@ -103,7 +103,7 @@
* @param content_length the length of the @a content_data.
* @param mime_type the content type of the stream or %c NULL if not known
*/
-EAPI Eina_Bool ewk_url_scheme_request_finish(const Ewk_Url_Scheme_Request *request, void *content_data, unsigned int content_length, const char *mime_type);
+EAPI Eina_Bool ewk_url_scheme_request_finish(const Ewk_Url_Scheme_Request *request, const void *content_data, unsigned int content_length, const char *mime_type);
#ifdef __cplusplus
}
Added: trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp (0 => 123752)
--- trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_context.cpp 2012-07-26 16:04:20 UTC (rev 123752)
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2012 Intel Corporation. All rights reserved.
+ *
+ * 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. Redistributions 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 APPLE INC. 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 APPLE INC. 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/EWK2UnitTestBase.h"
+#include "UnitTestUtils/EWK2UnitTestEnvironment.h"
+#include <EWebKit2.h>
+#include <gtest/gtest.h>
+
+using namespace EWK2UnitTest;
+
+extern EWK2UnitTestEnvironment* environment;
+
+static const char htmlReply[] = "<html><head><title>Foo</title></head><body>Bar</body></html>";
+
+TEST_F(EWK2UnitTestBase, ewk_context_default_get)
+{
+ Ewk_Context* defaultContext = ewk_context_default_get();
+ ASSERT_TRUE(defaultContext);
+ ASSERT_EQ(defaultContext, ewk_context_default_get());
+}
+
+TEST_F(EWK2UnitTestBase, ewk_context_cookie_manager_get)
+{
+ Ewk_Cookie_Manager* cookieManager = ewk_context_cookie_manager_get(ewk_context_default_get());
+ ASSERT_TRUE(cookieManager);
+ ASSERT_EQ(cookieManager, ewk_context_cookie_manager_get(ewk_context_default_get()));
+}
+
+static void schemeRequestCallback(Ewk_Url_Scheme_Request* request, void* userData)
+{
+ const char* scheme = ewk_url_scheme_request_scheme_get(request);
+ ASSERT_STREQ(scheme, "fooscheme");
+ const char* url = ""
+ ASSERT_STREQ(url, "fooscheme:MyPath");
+ const char* path = ewk_url_scheme_request_path_get(request);
+ ASSERT_STREQ(path, "MyPath");
+ ASSERT_TRUE(ewk_url_scheme_request_finish(request, htmlReply, strlen(htmlReply), "text/html"));
+}
+
+TEST_F(EWK2UnitTestBase, ewk_context_uri_scheme_register)
+{
+ ewk_context_uri_scheme_register(ewk_context_default_get(), "fooscheme", schemeRequestCallback, 0);
+ loadUrlSync("fooscheme:MyPath");
+ ASSERT_STREQ(ewk_view_title_get(webView()), "Foo");
+}