diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-11 13:45:28 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-11 13:45:28 +0200 |
commit | d6a599dbc9d824a462b2b206316e102bf8136446 (patch) | |
tree | ecb257a5e55b2239d74b90fdad62fccd661cf286 /Tools/WebKitTestRunner | |
parent | 3ccc3a85f09a83557b391aae380d3bf5f81a2911 (diff) | |
download | qtwebkit-d6a599dbc9d824a462b2b206316e102bf8136446.tar.gz |
Imported WebKit commit 8ff1f22783a32de82fee915abd55bd1b298f2644 (http://svn.webkit.org/repository/webkit/trunk@122325)
New snapshot that should work with the latest Qt build system changes
Diffstat (limited to 'Tools/WebKitTestRunner')
21 files changed, 607 insertions, 29 deletions
diff --git a/Tools/WebKitTestRunner/CMakeLists.txt b/Tools/WebKitTestRunner/CMakeLists.txt new file mode 100644 index 000000000..4cc050150 --- /dev/null +++ b/Tools/WebKitTestRunner/CMakeLists.txt @@ -0,0 +1,87 @@ +SET(WEBKIT_TESTRUNNER_DIR "${TOOLS_DIR}/WebKitTestRunner") +SET(WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR "${TOOLS_DIR}/WebKitTestRunner/InjectedBundle") + +FILE(MAKE_DIRECTORY ${DERIVED_SOURCES_DIR}/InjectedBundle) + +SET(WebKitTestRunner_SOURCES + ${WEBKIT_TESTRUNNER_DIR}/CyclicRedundancyCheck.cpp + ${WEBKIT_TESTRUNNER_DIR}/PixelDumpSupport.cpp + ${WEBKIT_TESTRUNNER_DIR}/TestController.cpp + ${WEBKIT_TESTRUNNER_DIR}/TestInvocation.cpp +) + +SET(WebKitTestRunner_LIBRARIES + ${JavaScriptCore_LIBRARY_NAME} + ${WebCore_LIBRARY_NAME} + ${WebCoreTestSupport_LIBRARY_NAME} + ${WebKit2_LIBRARY_NAME} +) + +SET(WebKitTestRunner_INCLUDE_DIRECTORIES + ${WEBKIT_TESTRUNNER_DIR} + ${WEBKIT_TESTRUNNER_DIR}/InjectedBundle + ${WEBKIT_TESTRUNNER_DIR}/InjectedBundle/Bindings + ${JAVASCRIPTCORE_DIR} + ${JAVASCRIPTCORE_DIR}/ForwardingHeaders + ${WEBCORE_DIR}/editing + ${WEBCORE_DIR}/platform + ${WEBCORE_DIR}/platform/graphics + ${WEBCORE_DIR}/platform/network + ${WEBCORE_DIR}/platform/text + ${WEBCORE_DIR}/testing/js + ${WEBKIT2_DIR}/Shared + ${WEBKIT2_DIR}/Shared/API/c + ${WEBKIT2_DIR}/UIProcess + ${WEBKIT2_DIR}/UIProcess/API/C/efl + ${WEBKIT2_DIR}/UIProcess/API/C/soup + ${WTF_DIR} + ${DERIVED_SOURCES_WEBCORE_DIR}/include + ${DERIVED_SOURCES_WEBKIT2_DIR}/include + ${DERIVED_SOURCES_DIR}/InjectedBundle + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR}/Source + ${LIBSOUP24_INCLUDE_DIRS} +) + +SET(WebKitTestRunnerInjectedBundle_SOURCES + ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/AccessibilityController.cpp + ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/AccessibilityTextMarker.cpp + ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/AccessibilityTextMarkerRange.cpp + ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/AccessibilityUIElement.cpp + ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/EventSendingController.cpp + ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/GCController.cpp + ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/InjectedBundle.cpp + ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/InjectedBundleMain.cpp + ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/InjectedBundlePage.cpp + ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/LayoutTestController.cpp + ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/TextInputController.cpp + + ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings/JSWrapper.cpp +) + +FILE(GLOB WebKitTestRunnerInjectedBundle_IDL_FILES "${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings/*.idl") + +GENERATE_BINDINGS(WebKitTestRunnerInjectedBundle_SOURCES + "${WebKitTestRunnerInjectedBundle_IDL_FILES}" + "${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings" + "--include=${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/Bindings" + "" + ${DERIVED_SOURCES_DIR}/InjectedBundle JS TestRunner + ) + +INCLUDE_IF_EXISTS(${WEBKIT_TESTRUNNER_DIR}/Platform${PORT}.cmake) + +INCLUDE_DIRECTORIES(${WebKitTestRunner_INCLUDE_DIRECTORIES}) + +ADD_LIBRARY(TestRunnerInjectedBundle SHARED ${WebKitTestRunnerInjectedBundle_SOURCES}) +TARGET_LINK_LIBRARIES(TestRunnerInjectedBundle ${WebKitTestRunner_LIBRARIES}) + +ADD_EXECUTABLE(WebKitTestRunner ${WebKitTestRunner_SOURCES}) +TARGET_LINK_LIBRARIES(WebKitTestRunner ${WebKitTestRunner_LIBRARIES}) + +IF (WebKitTestRunner_LINK_FLAGS) + ADD_TARGET_PROPERTIES(WebKitTestRunner LINK_FLAGS ${WebKitTestRunner_LINK_FLAGS}) +ENDIF () + +ADD_DEPENDENCIES(${WebKit2_LIBRARY_NAME} ${ForwardingHeadersForWebKitTestRunner_NAME}) +ADD_DEPENDENCIES(${WebKit2_LIBRARY_NAME} ${ForwardingNetworkHeadersForWebKitTestRunner_NAME}) diff --git a/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl b/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl index 7a2a488eb..240221287 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl +++ b/Tools/WebKitTestRunner/InjectedBundle/Bindings/LayoutTestController.idl @@ -44,7 +44,6 @@ module WTR { void dumpFullScreenCallbacks(); void dumpFrameLoadCallbacks(); void dumpProgressFinishedCallback(); - void dumpConfigurationForViewport(in int deviceDPI, in int deviceWidth, in int deviceHeight, in int availableWidth, in int availableHeight); // Special options. void keepWebHistory(); diff --git a/Tools/WebKitTestRunner/InjectedBundle/DerivedSources.pri b/Tools/WebKitTestRunner/InjectedBundle/DerivedSources.pri index 651ad22d4..07cdc6719 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/DerivedSources.pri +++ b/Tools/WebKitTestRunner/InjectedBundle/DerivedSources.pri @@ -11,8 +11,6 @@ sanitizedFile = $$toSanitizedPath($$_FILE_) equals(sanitizedFile, $$toSanitizedPath($$_PRO_FILE_)):TEMPLATE = derived -load(features) - IDL_BINDINGS += \ Bindings/AccessibilityController.idl \ Bindings/AccessibilityTextMarker.idl \ diff --git a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp index 31f97f28c..1ee9c38f9 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp @@ -523,11 +523,6 @@ void LayoutTestController::resetPageVisibility() WKBundleSetPageVisibilityState(InjectedBundle::shared().bundle(), InjectedBundle::shared().page()->page(), WebCore::PageVisibilityStateVisible, /* isInitialState */ true); } -void LayoutTestController::dumpConfigurationForViewport(int deviceDPI, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight) -{ - InjectedBundle::shared().stringBuilder()->append(toWTFString(adoptWK(WKBundlePageViewportConfigurationAsText(InjectedBundle::shared().page()->page(), deviceDPI, deviceWidth, deviceHeight, availableWidth, availableHeight)))); -} - typedef WTF::HashMap<unsigned, JSValueRef> CallbackMap; static CallbackMap& callbackMap() { diff --git a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h index 6aedacc43..a3e33eff3 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h +++ b/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.h @@ -43,6 +43,9 @@ typedef UINT_PTR PlatformTimerRef; typedef QTimer PlatformTimerRef; #elif PLATFORM(GTK) typedef unsigned int PlatformTimerRef; +#elif PLATFORM(EFL) +typedef struct _Ecore_Timer Ecore_Timer; +typedef Ecore_Timer* PlatformTimerRef; #endif namespace WTR { @@ -74,7 +77,6 @@ public: void dumpTitleChanges() { m_dumpTitleChanges = true; } void dumpFullScreenCallbacks() { m_dumpFullScreenCallbacks = true; } void dumpFrameLoadCallbacks() { setShouldDumpFrameLoadCallbacks(true); } - void dumpConfigurationForViewport(int deviceDPI, int deviceWidth, int deviceHeight, int availableWidth, int availableHeight); void dumpProgressFinishedCallback() { setShouldDumpProgressFinishedCallback(true); } void setShouldDumpFrameLoadCallbacks(bool value) { m_dumpFrameLoadCallbacks = value; } diff --git a/Tools/WebKitTestRunner/InjectedBundle/Target.pri b/Tools/WebKitTestRunner/InjectedBundle/Target.pri index 7d382ac97..1a117de89 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/Target.pri +++ b/Tools/WebKitTestRunner/InjectedBundle/Target.pri @@ -50,9 +50,7 @@ HEADERS += \ DESTDIR = $${ROOT_BUILD_DIR}/lib -QT += declarative widgets webkit - -load(features) +QT += widgets webkit WEBKIT += wtf javascriptcore webcore diff --git a/Tools/WebKitTestRunner/InjectedBundle/efl/ActivateFontsEfl.cpp b/Tools/WebKitTestRunner/InjectedBundle/efl/ActivateFontsEfl.cpp new file mode 100644 index 000000000..7785f7799 --- /dev/null +++ b/Tools/WebKitTestRunner/InjectedBundle/efl/ActivateFontsEfl.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "ActivateFonts.h" + +#include "FontManagement.h" + +namespace WTR { + +void activateFonts() +{ + addFontsToEnvironment(); +} + +} // namespace WTR diff --git a/Tools/WebKitTestRunner/InjectedBundle/efl/InjectedBundleEfl.cpp b/Tools/WebKitTestRunner/InjectedBundle/efl/InjectedBundleEfl.cpp new file mode 100644 index 000000000..961d043f7 --- /dev/null +++ b/Tools/WebKitTestRunner/InjectedBundle/efl/InjectedBundleEfl.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "InjectedBundle.h" + +#include <WebCore/NotImplemented.h> + +namespace WTR { + +void InjectedBundle::platformInitialize(WKTypeRef) +{ + notImplemented(); +} + +} // namespace WTR diff --git a/Tools/WebKitTestRunner/InjectedBundle/efl/LayoutTestControllerEfl.cpp b/Tools/WebKitTestRunner/InjectedBundle/efl/LayoutTestControllerEfl.cpp new file mode 100644 index 000000000..b1b6f844a --- /dev/null +++ b/Tools/WebKitTestRunner/InjectedBundle/efl/LayoutTestControllerEfl.cpp @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "LayoutTestController.h" + +#include "InjectedBundle.h" +#include <Ecore.h> + +namespace WTR { + +static Eina_Bool waitToDumpWatchdogTimerCallback(void*) +{ + InjectedBundle::shared().layoutTestController()->waitToDumpWatchdogTimerFired(); + return false; +} + +void LayoutTestController::platformInitialize() +{ + m_waitToDumpWatchdogTimer = 0; +} + +void LayoutTestController::invalidateWaitToDumpWatchdogTimer() +{ + if (!m_waitToDumpWatchdogTimer) + return; + + ecore_timer_del(m_waitToDumpWatchdogTimer); + m_waitToDumpWatchdogTimer = 0; +} + +void LayoutTestController::initializeWaitToDumpWatchdogTimerIfNeeded() +{ + if (m_waitToDumpWatchdogTimer) + return; + + m_waitToDumpWatchdogTimer = ecore_timer_loop_add(waitToDumpWatchdogTimerInterval, + waitToDumpWatchdogTimerCallback, 0); +} + +JSRetainPtr<JSStringRef> LayoutTestController::pathToLocalResource(JSStringRef url) +{ + return url; +} + +JSRetainPtr<JSStringRef> LayoutTestController::platformName() +{ + JSRetainPtr<JSStringRef> platformName(Adopt, JSStringCreateWithUTF8CString("efl")); + return platformName; +} + +} // namespace WTR diff --git a/Tools/WebKitTestRunner/InjectedBundle/gtk/ActivateFontsGtk.cpp b/Tools/WebKitTestRunner/InjectedBundle/gtk/ActivateFontsGtk.cpp index c97ca928f..c843591fa 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/gtk/ActivateFontsGtk.cpp +++ b/Tools/WebKitTestRunner/InjectedBundle/gtk/ActivateFontsGtk.cpp @@ -66,6 +66,32 @@ static CString getTopLevelPath() return absoluteTopLevelPath.get(); } +CString getOutputDir() +{ + const char* webkitOutputDir = g_getenv("WEBKITOUTPUTDIR"); + if (webkitOutputDir) + return webkitOutputDir; + + CString topLevelPath = getTopLevelPath(); + GOwnPtr<char> outputDir(g_build_filename(topLevelPath.data(), "WebKitBuild", NULL)); + return outputDir.get(); +} + +static CString getFontsPath() +{ + CString webkitOutputDir = getOutputDir(); + GOwnPtr<char> fontsPath(g_build_filename(webkitOutputDir.data(), "Dependencies", "Root", "webkitgtk-test-fonts", NULL)); + if (g_file_test(fontsPath.get(), static_cast<GFileTest>(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) + return fontsPath.get(); + + // Try alternative fonts path. + fontsPath.set(g_build_filename(webkitOutputDir.data(), "webkitgtk-test-fonts", NULL)); + if (g_file_test(fontsPath.get(), static_cast<GFileTest>(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) + return fontsPath.get(); + + return CString(); +} + void inititializeFontConfigSetting() { FcInit(); @@ -86,18 +112,16 @@ void inititializeFontConfigSetting() if (!FcConfigParseAndLoad(config, reinterpret_cast<FcChar8*>(fontConfigFilename.get()), true)) g_error("Couldn't load font configuration file from: %s", fontConfigFilename.get()); - CString topLevelPath = getTopLevelPath(); - GOwnPtr<char> fontsPath(g_build_filename(topLevelPath.data(), "WebKitBuild", "Dependencies", - "Root", "webkitgtk-test-fonts", NULL)); - if (!g_file_test(fontsPath.get(), static_cast<GFileTest>(G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))) - g_error("Could not locate test fonts at %s. Is WEBKIT_TOP_LEVEL set?", fontsPath.get()); + CString fontsPath = getFontsPath(); + if (fontsPath.isNull()) + g_error("Could not locate test fonts at %s. Is WEBKIT_TOP_LEVEL set?", fontsPath.data()); GOwnPtr<GError> error; - GOwnPtr<GDir> fontsDirectory(g_dir_open(fontsPath.get(), 0, &error.outPtr())); + GOwnPtr<GDir> fontsDirectory(g_dir_open(fontsPath.data(), 0, &error.outPtr())); while (const char* directoryEntry = g_dir_read_name(fontsDirectory.get())) { if (!g_str_has_suffix(directoryEntry, ".ttf") && !g_str_has_suffix(directoryEntry, ".otf")) continue; - GOwnPtr<gchar> fontPath(g_build_filename(fontsPath.get(), directoryEntry, NULL)); + GOwnPtr<gchar> fontPath(g_build_filename(fontsPath.data(), directoryEntry, NULL)); if (!FcConfigAppFontAddFile(config, reinterpret_cast<const FcChar8*>(fontPath.get()))) g_error("Could not load font at %s!", fontPath.get()); } diff --git a/Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm b/Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm index e5499b80a..419064fdb 100644 --- a/Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm +++ b/Tools/WebKitTestRunner/InjectedBundle/mac/InjectedBundleMac.mm @@ -27,6 +27,11 @@ #import <Foundation/Foundation.h> +@interface NSURLRequest (PrivateThingsWeShouldntReallyUse) ++(void)setAllowsAnyHTTPSCertificate:(BOOL)allow forHost:(NSString *)host; +@end + + namespace WTR { void InjectedBundle::platformInitialize(WKTypeRef) @@ -44,7 +49,10 @@ void InjectedBundle::platformInitialize(WKTypeRef) [NSArray arrayWithObject:@"en"], @"AppleLanguages", nil]; - [[NSUserDefaults standardUserDefaults] setVolatileDomain:dict forName:NSArgumentDomain]; + [[NSUserDefaults standardUserDefaults] setVolatileDomain:dict forName:NSArgumentDomain]; + + [NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:@"localhost"]; + [NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:@"127.0.0.1"]; } } // namespace WTR diff --git a/Tools/WebKitTestRunner/PlatformEfl.cmake b/Tools/WebKitTestRunner/PlatformEfl.cmake new file mode 100644 index 000000000..e43febd1a --- /dev/null +++ b/Tools/WebKitTestRunner/PlatformEfl.cmake @@ -0,0 +1,59 @@ +LIST(APPEND WebKitTestRunner_LINK_FLAGS + ${ECORE_X_LDFLAGS} + ${EDJE_LDFLAGS} + ${EFLDEPS_LDFLAGS} + ${EVAS_LDFLAGS} + ${LIBSOUP24_LDFLAGS} +) + +ADD_CUSTOM_TARGET(forwarding-headersEflForWebKitTestRunner + COMMAND ${PERL_EXECUTABLE} ${WEBKIT2_DIR}/Scripts/generate-forwarding-headers.pl ${WEBKIT_TESTRUNNER_DIR} ${DERIVED_SOURCES_WEBKIT2_DIR}/include efl +) +SET(ForwardingHeadersForWebKitTestRunner_NAME forwarding-headersEflForWebKitTestRunner) + +ADD_CUSTOM_TARGET(forwarding-headersSoupForWebKitTestRunner + COMMAND ${PERL_EXECUTABLE} ${WEBKIT2_DIR}/Scripts/generate-forwarding-headers.pl ${WEBKIT_TESTRUNNER_DIR} ${DERIVED_SOURCES_WEBKIT2_DIR}/include soup +) +SET(ForwardingNetworkHeadersForWebKitTestRunner_NAME forwarding-headersSoupForWebKitTestRunner) + +LIST(APPEND WebKitTestRunner_SOURCES + ${WEBKIT_TESTRUNNER_DIR}/cairo/TestInvocationCairo.cpp + + ${WEBKIT_TESTRUNNER_DIR}/efl/PlatformWebViewEfl.cpp + ${WEBKIT_TESTRUNNER_DIR}/efl/TestControllerEfl.cpp + ${WEBKIT_TESTRUNNER_DIR}/efl/main.cpp +) + +LIST(APPEND WebKitTestRunner_INCLUDE_DIRECTORIES + ${TOOLS_DIR}/DumpRenderTree/efl/ + "${WTF_DIR}/wtf/gobject" + + ${CAIRO_INCLUDE_DIRS} + ${ECORE_X_INCLUDE_DIRS} + ${EFLDEPS_INCLUDE_DIRS} + ${EVAS_INCLUDE_DIRS} + ${Glib_INCLUDE_DIRS} +) + +LIST(APPEND WebKitTestRunner_LIBRARIES + ${CAIRO_LIBRARIES} + ${ECORE_X_LIBRARIES} + ${EDJE_LIBRARIES} + ${EFLDEPS_LIBRARIES} + ${Glib_LIBRARIES} + ${WTF_LIBRARY_NAME} +) + +LIST(APPEND WebKitTestRunnerInjectedBundle_SOURCES + ${TOOLS_DIR}/DumpRenderTree/efl/FontManagement.cpp + + ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/efl/ActivateFontsEfl.cpp + ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/efl/InjectedBundleEfl.cpp + ${WEBKIT_TESTRUNNER_INJECTEDBUNDLE_DIR}/efl/LayoutTestControllerEfl.cpp +) + +# FIXME: DOWNLOADED_FONTS_DIR should not hardcode the directory +# structure. See <https://bugs.webkit.org/show_bug.cgi?id=81475>. +ADD_DEFINITIONS(-DFONTS_CONF_DIR="${TOOLS_DIR}/DumpRenderTree/gtk/fonts" + -DDOWNLOADED_FONTS_DIR="${CMAKE_SOURCE_DIR}/WebKitBuild/Dependencies/Source/webkitgtk-test-fonts-0.0.3" + -DDATA_DIR="${THEME_BINARY_DIR}") diff --git a/Tools/WebKitTestRunner/PlatformWebView.h b/Tools/WebKitTestRunner/PlatformWebView.h index 0e8c6b5b2..a8cf0d66c 100644 --- a/Tools/WebKitTestRunner/PlatformWebView.h +++ b/Tools/WebKitTestRunner/PlatformWebView.h @@ -51,6 +51,11 @@ typedef HWND PlatformWindow; typedef struct _GtkWidget GtkWidget; typedef WKViewRef PlatformWKView; typedef GtkWidget* PlatformWindow; +#elif PLATFORM(EFL) +typedef struct _Evas_Object Evas_Object; +typedef struct _Ecore_Evas Ecore_Evas; +typedef Evas_Object* PlatformWKView; +typedef Ecore_Evas* PlatformWindow; #endif namespace WTR { diff --git a/Tools/WebKitTestRunner/Target.pri b/Tools/WebKitTestRunner/Target.pri index b9e7a8bdd..b3b5c2c33 100644 --- a/Tools/WebKitTestRunner/Target.pri +++ b/Tools/WebKitTestRunner/Target.pri @@ -25,9 +25,7 @@ SOURCES += \ DESTDIR = $${ROOT_BUILD_DIR}/bin -QT = core gui widgets network declarative testlib quick quick-private webkit - -load(features) +QT = core gui widgets network testlib quick quick-private webkit WEBKIT += wtf javascriptcore webkit2 diff --git a/Tools/WebKitTestRunner/TestController.cpp b/Tools/WebKitTestRunner/TestController.cpp index fd6885793..3c10ac170 100644 --- a/Tools/WebKitTestRunner/TestController.cpp +++ b/Tools/WebKitTestRunner/TestController.cpp @@ -42,7 +42,7 @@ #include <WebKit2/WKPagePrivateMac.h> #endif -#if PLATFORM(MAC) || PLATFORM(QT) || PLATFORM(GTK) +#if PLATFORM(MAC) || PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL) #include "EventSenderProxy.h" #endif @@ -319,7 +319,8 @@ void TestController::initialize(int argc, const char* argv[]) kWKContextInjectedBundleClientCurrentVersion, this, didReceiveMessageFromInjectedBundle, - didReceiveSynchronousMessageFromInjectedBundle + didReceiveSynchronousMessageFromInjectedBundle, + 0 // getInjectedBundleInitializationUserData }; WKContextSetInjectedBundleClient(m_context.get(), &injectedBundleClient); diff --git a/Tools/WebKitTestRunner/config.h b/Tools/WebKitTestRunner/config.h index 23a3ad7b0..11577cd60 100644 --- a/Tools/WebKitTestRunner/config.h +++ b/Tools/WebKitTestRunner/config.h @@ -25,12 +25,18 @@ #ifndef WebKitTestRunner_config_h #define WebKitTestRunner_config_h +#if defined (BUILDING_WITH_CMAKE) +#include "cmakeconfig.h" +#endif + #include <wtf/Platform.h> #include <wtf/ExportMacros.h> #if USE(JSC) #include <runtime/JSExportMacros.h> #endif +#include <WebKit2/WebKit2.h> + #if PLATFORM(WIN) #define WTF_USE_CF 1 #if defined(WIN_CAIRO) diff --git a/Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp b/Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp new file mode 100644 index 000000000..f17820d91 --- /dev/null +++ b/Tools/WebKitTestRunner/efl/PlatformWebViewEfl.cpp @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "PlatformWebView.h" + +#include "WebKit2/WKAPICast.h" +#include <Ecore_Evas.h> + +using namespace WebKit; + +namespace WTR { + +static bool useX11Window = false; + +static Ecore_Evas* initEcoreEvas() +{ + Ecore_Evas* ecoreEvas = useX11Window ? ecore_evas_new(0, 0, 0, 800, 600, 0) : ecore_evas_buffer_new(800, 600); + if (!ecoreEvas) + return 0; + + ecore_evas_title_set(ecoreEvas, "EFL WebKitTestRunner"); + ecore_evas_show(ecoreEvas); + + return ecoreEvas; +} + +PlatformWebView::PlatformWebView(WKContextRef context, WKPageGroupRef pageGroup) +{ + m_window = initEcoreEvas(); + Evas* evas = ecore_evas_get(m_window); + m_view = toImpl(WKViewCreate(evas, context, pageGroup)); + m_windowIsKey = false; +} + +PlatformWebView::~PlatformWebView() +{ + evas_object_del(m_view); + ecore_evas_free(m_window); +} + +void PlatformWebView::resizeTo(unsigned width, unsigned height) +{ + evas_object_resize(m_view, width, height); +} + +WKPageRef PlatformWebView::page() +{ + return WKViewGetPage(toAPI(m_view)); +} + +void PlatformWebView::focus() +{ +} + +WKRect PlatformWebView::windowFrame() +{ + return WKRectMake(0, 0, 0, 0); +} + +void PlatformWebView::setWindowFrame(WKRect frame) +{ + evas_object_move(m_view, frame.origin.x, frame.origin.y); + resizeTo(frame.size.width, frame.size.height); +} + +void PlatformWebView::addChromeInputField() +{ +} + +void PlatformWebView::removeChromeInputField() +{ +} + +void PlatformWebView::makeWebViewFirstResponder() +{ +} + +WKRetainPtr<WKImageRef> PlatformWebView::windowSnapshotImage() +{ + // FIXME: implement to capture pixels in the UI process, + // which may be necessary to capture things like 3D transforms. + return 0; +} + +} // namespace WTR + diff --git a/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp b/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp new file mode 100644 index 000000000..9dc2dfc77 --- /dev/null +++ b/Tools/WebKitTestRunner/efl/TestControllerEfl.cpp @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" +#include "TestController.h" + +#include <Ecore.h> +#include <stdio.h> +#include <stdlib.h> +#include <wtf/Platform.h> +#include <wtf/text/WTFString.h> + +namespace WTR { + +static Ecore_Timer* timer = 0; + +static Eina_Bool timerFired(void*) +{ + timer = 0; + ecore_main_loop_quit(); + return ECORE_CALLBACK_CANCEL; +} + +void TestController::notifyDone() +{ + if (!timer) + return; + + ecore_timer_del(timer); + timer = 0; + ecore_main_loop_quit(); +} + +void TestController::platformInitialize() +{ +} + +void TestController::platformRunUntil(bool&, double timeout) +{ + timer = ecore_timer_loop_add(timeout, timerFired, 0); + ecore_main_loop_begin(); +} + +static const char* getEnvironmentVariableOrExit(const char* variableName) +{ + const char* value = getenv(variableName); + if (!value) { + fprintf(stderr, "%s environment variable not found\n", variableName); + exit(0); + } + + return value; +} + +void TestController::initializeInjectedBundlePath() +{ + const char* bundlePath = getEnvironmentVariableOrExit("TEST_RUNNER_INJECTED_BUNDLE_FILENAME"); + m_injectedBundlePath = WKStringCreateWithUTF8CString(bundlePath); +} + +void TestController::initializeTestPluginDirectory() +{ + const char* pluginPath = getEnvironmentVariableOrExit("TEST_RUNNER_PLUGIN_PATH"); + m_testPluginDirectory = WKStringCreateWithUTF8CString(pluginPath); +} + +void TestController::platformInitializeContext() +{ +} + +void TestController::runModal(PlatformWebView*) +{ + // FIXME: Need to implement this to test showModalDialog. +} + +const char* TestController::platformLibraryPathForTesting() +{ + return 0; +} + +} // namespace WTR diff --git a/Tools/WebKitTestRunner/efl/main.cpp b/Tools/WebKitTestRunner/efl/main.cpp new file mode 100644 index 000000000..42e0af286 --- /dev/null +++ b/Tools/WebKitTestRunner/efl/main.cpp @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2012 Samsung Electronics + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public License + * along with this program; see the file COPYING.LIB. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "config.h" + +#include "TestController.h" +#include <Ecore.h> +#include <Ecore_Evas.h> +#include <Edje.h> +#include <glib-object.h> +#include <glib.h> + +#ifdef HAVE_ECORE_X +#include <Ecore_X.h> +#endif + +int main(int argc, char** argv) +{ + g_type_init(); + + if (!ecore_evas_init()) + return 1; + + if (!edje_init()) { + ecore_evas_shutdown(); + return 1; + } + +#ifdef HAVE_ECORE_X + if (!ecore_x_init(0)) { + ecore_evas_shutdown(); + edje_shutdown(); + return 1; + } +#endif + + // Prefer the not installed web and plugin processes. + WTR::TestController controller(argc, const_cast<const char**>(argv)); + +#ifdef HAVE_ECORE_X + ecore_x_shutdown(); +#endif + + edje_shutdown(); + ecore_evas_shutdown(); + + return 0; +} + diff --git a/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm b/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm index d8b5bf7b4..c9bcc3d2a 100644 --- a/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm +++ b/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm @@ -72,15 +72,16 @@ [super setFrame:NSMakeRect(currentFrame.origin.x, currentFrame.origin.y, windowFrame.size.width, windowFrame.size.height) display:displayViews]; } -- (NSRect)frame +- (NSRect)frameRespectingFakeOrigin { - NSRect currentFrame = [super frame]; + NSRect currentFrame = [self frame]; if (_shouldUseFakeOrigin) return NSMakeRect(_fakeOrigin.x, _fakeOrigin.y, currentFrame.size.width, currentFrame.size.height); return currentFrame; } + @end namespace WTR { @@ -126,7 +127,7 @@ void PlatformWebView::focus() WKRect PlatformWebView::windowFrame() { - NSRect frame = [m_window frame]; + NSRect frame = [m_window frameRespectingFakeOrigin]; WKRect wkFrame; wkFrame.origin.x = frame.origin.x; diff --git a/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp b/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp index 0211df5d3..b26e20515 100644 --- a/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp +++ b/Tools/WebKitTestRunner/qt/PlatformWebViewQt.cpp @@ -34,7 +34,7 @@ #include <QEventLoop> #include <QQmlProperty> #include <QtQuick/QQuickView> -#include <qwindowsysteminterface_qpa.h> +#include <qpa/qwindowsysteminterface.h> namespace WTR { |