Diff
Modified: trunk/Source/WebKit2/ChangeLog (143196 => 143197)
--- trunk/Source/WebKit2/ChangeLog 2013-02-18 12:56:15 UTC (rev 143196)
+++ trunk/Source/WebKit2/ChangeLog 2013-02-18 13:00:00 UTC (rev 143197)
@@ -1,3 +1,13 @@
+2013-02-15 Allan Sandfeld Jensen <[email protected]>
+
+ [Qt][WK2] Support WK2 API tests
+ https://bugs.webkit.org/show_bug.cgi?id=109843
+
+ Reviewed by Jocelyn Turcotte.
+
+ * UIProcess/API/qt/qquickwebview_p.h:
+ (TestWebKitAPI):
+
2013-02-18 Andras Becsi <[email protected]>
[Qt][WK2] Changing WebView.contentY and WebView.contentX does not redraw content
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h (143196 => 143197)
--- trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h 2013-02-18 12:56:15 UTC (rev 143196)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h 2013-02-18 13:00:00 UTC (rev 143197)
@@ -48,6 +48,10 @@
class PlatformWebView;
}
+namespace TestWebKitAPI {
+class PlatformWebView;
+}
+
namespace WebKit {
struct QtRefCountedNetworkRequestData;
class PageViewportControllerClientQt;
@@ -224,6 +228,7 @@
friend class WebKit::QtWebPagePolicyClient;
friend class WebKit::QtWebPageUIClient;
friend class WTR::PlatformWebView;
+ friend class TestWebKitAPI::PlatformWebView;
friend class QQuickWebViewExperimental;
};
Modified: trunk/Tools/ChangeLog (143196 => 143197)
--- trunk/Tools/ChangeLog 2013-02-18 12:56:15 UTC (rev 143196)
+++ trunk/Tools/ChangeLog 2013-02-18 13:00:00 UTC (rev 143197)
@@ -1,3 +1,42 @@
+2013-02-15 Allan Sandfeld Jensen <[email protected]>
+
+ [Qt][WK2] Support WK2 API tests
+ https://bugs.webkit.org/show_bug.cgi?id=109843
+
+ Reviewed by Jocelyn Turcotte.
+
+ * TestWebKitAPI/DerivedSources.pri: Added.
+ * TestWebKitAPI/InjectedBundle.pri: Added.
+ * TestWebKitAPI/PlatformWebView.h:
+ * TestWebKitAPI/TestWebKitAPI.pri:
+ * TestWebKitAPI/TestWebKitAPI.pro:
+ * TestWebKitAPI/Tests/_javascript_Core/_javascript_Core.pro: Added.
+ * TestWebKitAPI/Tests/WTF/WTF.pro:
+ * TestWebKitAPI/Tests/WebKit2/WebKit2.pro: Added.
+ * TestWebKitAPI/qt/PlatformUtilitiesQt.cpp:
+ (TestWebKitAPI::Util::sleep):
+ (TestWebKitAPI::Util::createInjectedBundlePath):
+ (TestWebKitAPI::Util::createURLForResource):
+ (TestWebKitAPI::Util::isKeyDown):
+ (Util):
+ * TestWebKitAPI/qt/PlatformWebViewQt.cpp: Added.
+ (TestWebKitAPI):
+ (WrapperWindow):
+ (TestWebKitAPI::WrapperWindow::WrapperWindow):
+ (TestWebKitAPI::WrapperWindow::handleStatusChanged):
+ (TestWebKitAPI::PlatformWebView::PlatformWebView):
+ (TestWebKitAPI::PlatformWebView::~PlatformWebView):
+ (TestWebKitAPI::PlatformWebView::resizeTo):
+ (TestWebKitAPI::PlatformWebView::page):
+ (TestWebKitAPI::PlatformWebView::focus):
+ (TestWebKitAPI::PlatformWebView::simulateSpacebarKeyPress):
+ (TestWebKitAPI::PlatformWebView::simulateAltKeyPress):
+ (TestWebKitAPI::PlatformWebView::simulateMouseMove):
+ (TestWebKitAPI::PlatformWebView::simulateRightClick):
+ * TestWebKitAPI/qt/main.cpp:
+ (addQtWebProcessToPath):
+ (main):
+
2013-02-18 Christophe Dumez <[email protected]>
[EFL][WK2] Refactor Ewk_Favicon code and stop relying on internal C++ API
Added: trunk/Tools/TestWebKitAPI/DerivedSources.pri (0 => 143197)
--- trunk/Tools/TestWebKitAPI/DerivedSources.pri (rev 0)
+++ trunk/Tools/TestWebKitAPI/DerivedSources.pri 2013-02-18 13:00:00 UTC (rev 143197)
@@ -0,0 +1,12 @@
+# -------------------------------------------------------------------
+# Derived sources for TestWebKitAPI
+#
+# See 'Tools/qmake/README' for an overview of the build system
+# -------------------------------------------------------------------
+
+TEMPLATE = derived
+
+# Make sure forwarded headers needed by this project are present
+fwheader_generator.commands = perl $${ROOT_WEBKIT_DIR}/Source/WebKit2/Scripts/generate-forwarding-headers.pl $${ROOT_WEBKIT_DIR}/Tools/TestWebKitAPI $${ROOT_BUILD_DIR}/Source/include qt
+fwheader_generator.depends = $${ROOT_WEBKIT_DIR}/Source/WebKit2/Scripts/generate-forwarding-headers.pl
+GENERATORS += fwheader_generator
Added: trunk/Tools/TestWebKitAPI/InjectedBundle.pri (0 => 143197)
--- trunk/Tools/TestWebKitAPI/InjectedBundle.pri (rev 0)
+++ trunk/Tools/TestWebKitAPI/InjectedBundle.pri 2013-02-18 13:00:00 UTC (rev 143197)
@@ -0,0 +1,56 @@
+# -------------------------------------------------------------------
+# Project file for TestWebKitAPI's InjectedBundle
+#
+# See 'Tools/qmake/README' for an overview of the build system
+# -------------------------------------------------------------------
+
+TEMPLATE = lib
+TARGET = TestWebKitAPIInjectedBundle
+
+INCLUDEPATH += $$PWD
+INCLUDEPATH += $${ROOT_WEBKIT_DIR}/Source/ThirdParty/gtest/include
+
+SOURCES += \
+ $$PWD/InjectedBundleController.cpp \
+ $$PWD/InjectedBundleController.h \
+ $$PWD/InjectedBundleMain.cpp \
+ $$PWD/InjectedBundleTest.h \
+ $$PWD/PlatformUtilities.cpp \
+ $$PWD/PlatformUtilities.h \
+ $$PWD/qt/InjectedBundleControllerQt.cpp \
+ $$PWD/qt/PlatformUtilitiesQt.cpp \
+ $$PWD/Tests/WebKit2/CanHandleRequest_Bundle.cpp \
+ $$PWD/Tests/WebKit2/DocumentStartUserScriptAlertCrash_Bundle.cpp \
+ $$PWD/Tests/WebKit2/DOMWindowExtensionBasic_Bundle.cpp \
+ $$PWD/Tests/WebKit2/DOMWindowExtensionNoCache_Bundle.cpp \
+ $$PWD/Tests/WebKit2/GetInjectedBundleInitializationUserDataCallback_Bundle.cpp \
+ $$PWD/Tests/WebKit2/HitTestResultNodeHandle_Bundle.cpp \
+ $$PWD/Tests/WebKit2/InjectedBundleBasic_Bundle.cpp \
+ $$PWD/Tests/WebKit2/InjectedBundleFrameHitTest_Bundle.cpp \
+ $$PWD/Tests/WebKit2/InjectedBundleInitializationUserDataCallbackWins_Bundle.cpp \
+ $$PWD/Tests/WebKit2/LoadCanceledNoServerRedirectCallback_Bundle.cpp \
+ $$PWD/Tests/WebKit2/MouseMoveAfterCrash_Bundle.cpp \
+ $$PWD/Tests/WebKit2/NewFirstVisuallyNonEmptyLayout_Bundle.cpp \
+ $$PWD/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp \
+ $$PWD/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp \
+ $$PWD/Tests/WebKit2/NewFirstVisuallyNonEmptyLayoutFrames_Bundle.cpp \
+ $$PWD/Tests/WebKit2/ParentFrame_Bundle.cpp \
+ $$PWD/Tests/WebKit2/ResponsivenessTimerDoesntFireEarly_Bundle.cpp \
+ $$PWD/Tests/WebKit2/ShouldGoToBackForwardListItem_Bundle.cpp \
+ $$PWD/Tests/WebKit2/UserMessage_Bundle.cpp \
+ $$PWD/Tests/WebKit2/WillSendSubmitEvent_Bundle.cpp \
+ $$PWD/Tests/WebKit2/WKConnection_Bundle.cpp
+
+
+DESTDIR = $${ROOT_BUILD_DIR}/lib
+
+QT += core webkit
+
+WEBKIT += wtf _javascript_core webcore webkit2
+
+CONFIG += plugin rpath compiling_thirdparty_code
+
+LIBS += -L$${ROOT_BUILD_DIR}/Source/ThirdParty/gtest/$$activeBuildConfig() -lgtest
+
+DEFINES += APITEST_SOURCE_DIR=\\\"$$PWD\\\" \
+ ROOT_BUILD_DIR=\\\"$${ROOT_BUILD_DIR}\\\"
Modified: trunk/Tools/TestWebKitAPI/PlatformWebView.h (143196 => 143197)
--- trunk/Tools/TestWebKitAPI/PlatformWebView.h 2013-02-18 12:56:15 UTC (rev 143196)
+++ trunk/Tools/TestWebKitAPI/PlatformWebView.h 2013-02-18 13:00:00 UTC (rev 143197)
@@ -50,6 +50,13 @@
typedef struct _Ecore_Evas Ecore_Evas;
typedef WKViewRef PlatformWKView;
typedef Ecore_Evas* PlatformWindow;
+#elif PLATFORM(QT)
+QT_BEGIN_NAMESPACE
+class QQuickView;
+QT_END_NAMESPACE
+class QQuickWebView;
+typedef QQuickWebView* PlatformWKView;
+typedef QQuickView* PlatformWindow;
#endif
namespace TestWebKitAPI {
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.pri (143196 => 143197)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.pri 2013-02-18 12:56:15 UTC (rev 143196)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.pri 2013-02-18 13:00:00 UTC (rev 143197)
@@ -1,14 +1,22 @@
INCLUDEPATH += $$PWD $${ROOT_WEBKIT_DIR}/Source/ThirdParty/gtest/include
-WEBKIT += wtf _javascript_core
+WEBKIT += wtf _javascript_core webkit2
DEFINES += QT_NO_CAST_FROM_ASCII
-QT += core gui webkit
+QT += core core-private gui gui-private webkit quick quick-private
CONFIG += compiling_thirdparty_code
-SOURCES += $$PWD/*.cpp
-SOURCES += $$PWD/qt/*.cpp
+SOURCES += \
+ $$PWD/_javascript_Test.cpp \
+ $$PWD/PlatformUtilities.cpp \
+ $$PWD/TestsController.cpp \
+ $$PWD/qt/main.cpp \
+ $$PWD/qt/PlatformUtilitiesQt.cpp \
+ $$PWD/qt/PlatformWebViewQt.cpp
LIBS += -L$${ROOT_BUILD_DIR}/Source/ThirdParty/gtest/$$activeBuildConfig() -lgtest
+
+DEFINES += ROOT_BUILD_DIR=\\\"$${ROOT_BUILD_DIR}\\\"
+
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.pro (143196 => 143197)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.pro 2013-02-18 12:56:15 UTC (rev 143196)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.pro 2013-02-18 13:00:00 UTC (rev 143197)
@@ -1,3 +1,11 @@
TEMPLATE = subdirs
+CONFIG += ordered
-SUBDIRS += Tests/WTF
+derived_sources.file = DerivedSources.pri
+injected_bundle.file = InjectedBundle.pri
+tests.file = Tests.pri
+
+SUBDIRS += derived_sources injected_bundle tests
+
+addStrictSubdirOrderBetween(derived_sources, injected_bundle)
+addStrictSubdirOrderBetween(derived_sources, tests)
Added: trunk/Tools/TestWebKitAPI/Tests/_javascript_Core/_javascript_Core.pro (0 => 143197)
--- trunk/Tools/TestWebKitAPI/Tests/_javascript_Core/_javascript_Core.pro (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/_javascript_Core/_javascript_Core.pro 2013-02-18 13:00:00 UTC (rev 143197)
@@ -0,0 +1,8 @@
+TEMPLATE = app
+TARGET = tst_jsc
+
+SOURCES += *.cpp
+
+include(../../TestWebKitAPI.pri)
+
+DEFINES += APITEST_SOURCE_DIR=\\\"$$PWD\\\"
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/WTF.pro (143196 => 143197)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/WTF.pro 2013-02-18 12:56:15 UTC (rev 143196)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/WTF.pro 2013-02-18 13:00:00 UTC (rev 143197)
@@ -18,9 +18,12 @@
StringImpl.cpp \
StringOperators.cpp \
TemporaryChange.cpp \
+ Vector.cpp \
VectorBasic.cpp \
- Vector.cpp \
VectorReverse.cpp \
WTFString.cpp
include(../../TestWebKitAPI.pri)
+
+DEFINES += APITEST_SOURCE_DIR=\\\"$$PWD\\\"
+
Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2/WebKit2.pro (0 => 143197)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2/WebKit2.pro (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2/WebKit2.pro 2013-02-18 13:00:00 UTC (rev 143197)
@@ -0,0 +1,61 @@
+TEMPLATE = app
+TARGET = tst_webkit2
+
+SOURCES += \
+ AboutBlankLoad.cpp \
+ DocumentStartUserScriptAlertCrash.cpp \
+ DOMWindowExtensionBasic.cpp \
+ DOMWindowExtensionNoCache.cpp \
+ DocumentStartUserScriptAlertCrash.cpp \
+ EvaluateJavaScript.cpp \
+ FailedLoad.cpp \
+ Find.cpp \
+ FrameMIMETypeHTML.cpp \
+ FrameMIMETypePNG.cpp \
+ GetInjectedBundleInitializationUserDataCallback.cpp \
+ HitTestResultNodeHandle.cpp \
+ InjectedBundleBasic.cpp \
+ InjectedBundleFrameHitTest.cpp \
+ InjectedBundleInitializationUserDataCallbackWins.cpp \
+ LoadAlternateHTMLStringWithNonDirectoryURL.cpp \
+ LoadCanceledNoServerRedirectCallback.cpp \
+ MouseMoveAfterCrash.cpp \
+ ReloadPageAfterCrash.cpp \
+ PageLoadBasic.cpp \
+ PageLoadDidChangeLocationWithinPageForFrame.cpp \
+ PageVisibilityState.cpp \
+ ParentFrame.cpp \
+ PreventEmptyUserAgent.cpp \
+ PrivateBrowsingPushStateNoHistoryCallback.cpp \
+ ReloadPageAfterCrash.cpp \
+ ResponsivenessTimerDoesntFireEarly.cpp \
+ UserMessage.cpp \
+ WillSendSubmitEvent.cpp \
+ WKConnection.cpp \
+ WKString.cpp \
+ WKStringJSString.cpp \
+ WKURL.cpp
+
+FAILING_SOURCES = \
+ CanHandleRequest.cpp \
+
+FAILING_SOURCES += ShouldGoToBackForwardListItem.cpp # Only stalls in flickable mode.
+FAILING_SOURCES += SpacebarScrolling.cpp # Only fails in flickable mode.
+
+SOURCES += $$FAILING_SOURCES
+
+# Tests skipped because they crash, stall or do not compile.
+SKIPPED_SOURCES = \
+ CookieManager.cpp \
+ DownloadDecideDestinationCrash.cpp \
+ ForceRepaint.cpp \
+ NewFirstVisuallyNonEmptyLayout.cpp \
+ NewFirstVisuallyNonEmptyLayoutFails.cpp \
+ NewFirstVisuallyNonEmptyLayoutForImages.cpp \
+ NewFirstVisuallyNonEmptyLayoutFrames.cpp \
+ RestoreSessionStateContainingFormData.cpp \
+ WebCoreStatisticsWithNoWebProcess.cpp
+
+include(../../TestWebKitAPI.pri)
+
+DEFINES += APITEST_SOURCE_DIR=\\\"$$PWD\\\"
Added: trunk/Tools/TestWebKitAPI/Tests.pri (0 => 143197)
--- trunk/Tools/TestWebKitAPI/Tests.pri (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests.pri 2013-02-18 13:00:00 UTC (rev 143197)
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+
+SUBDIRS += Tests/WTF Tests/_javascript_Core Tests/WebKit2
Modified: trunk/Tools/TestWebKitAPI/qt/PlatformUtilitiesQt.cpp (143196 => 143197)
--- trunk/Tools/TestWebKitAPI/qt/PlatformUtilitiesQt.cpp 2013-02-18 12:56:15 UTC (rev 143196)
+++ trunk/Tools/TestWebKitAPI/qt/PlatformUtilitiesQt.cpp 2013-02-18 13:00:00 UTC (rev 143197)
@@ -21,10 +21,15 @@
#include "config.h"
#include "PlatformUtilities.h"
+#include <WebKit2/WKStringQt.h>
+#include <WebKit2/WKNativeEvent.h>
+#include <WebKit2/WKURLQt.h>
+
#include <QCoreApplication>
+#include <QDir>
+#include <QUrl>
+#include <QThread>
-#include <unistd.h>
-
namespace TestWebKitAPI {
namespace Util {
@@ -36,19 +41,22 @@
void sleep(double seconds)
{
- usleep(seconds * 1000000);
+ QThread::sleep(seconds);
}
WKStringRef createInjectedBundlePath()
{
- // ### FIXME.
- return WKStringCreateWithUTF8CString("");
+ QString path = QFileInfo(QStringLiteral(ROOT_BUILD_DIR "/lib/libTestWebKitAPIInjectedBundle")).absoluteFilePath();
+
+ return WKStringCreateWithQString(path);
}
WKURLRef createURLForResource(const char* resource, const char* extension)
{
- // ### FIXME.
- return WKURLCreateWithUTF8CString("");
+ QDir path(QStringLiteral(APITEST_SOURCE_DIR));
+ QString filename = QString::fromLocal8Bit(resource) + QStringLiteral(".") + QString::fromLocal8Bit(extension);
+
+ return WKURLCreateWithQUrl(QUrl::fromLocalFile(path.absoluteFilePath(filename)));
}
WKURLRef URLForNonExistentResource()
@@ -56,5 +64,10 @@
return WKURLCreateWithUTF8CString("file:///does-not-exist.html");
}
+bool isKeyDown(WKNativeEventPtr event)
+{
+ return event->type() == QEvent::KeyPress;
+}
+
} // namespace Util
} // namespace TestWebKitAPI
Added: trunk/Tools/TestWebKitAPI/qt/PlatformWebViewQt.cpp (0 => 143197)
--- trunk/Tools/TestWebKitAPI/qt/PlatformWebViewQt.cpp (rev 0)
+++ trunk/Tools/TestWebKitAPI/qt/PlatformWebViewQt.cpp 2013-02-18 13:00:00 UTC (rev 143197)
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 University of Szeged. All rights reserved.
+ * Copyright (C) 2013 Digia Plc. and/or its subsidiary(-ies).
+ *
+ * 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 THE COPYRIGHT HOLDERS AND 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
+ * OWNER OR 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 "PlatformWebView.h"
+#include "qquickwebpage_p.h"
+#include "qquickwebview_p.h"
+
+#include <WebKit2/WKRetainPtr.h>
+
+#include <QCoreApplication>
+#include <QEventLoop>
+#include <QQmlProperty>
+#include <QtQuick/QQuickView>
+#include <qpa/qwindowsysteminterface.h>
+
+namespace TestWebKitAPI {
+
+class WrapperWindow : public QQuickView {
+ Q_OBJECT
+public:
+ WrapperWindow(QQuickWebView* view)
+ : QQuickView(QUrl(QStringLiteral("data:text/plain,import QtQuick 2.0\nItem { objectName: 'root' }")))
+ , m_view(view)
+ {
+ connect(this, SIGNAL(statusChanged(QQuickView::Status)), SLOT(handleStatusChanged(QQuickView::Status)));
+ }
+
+private Q_SLOTS:
+ void handleStatusChanged(QQuickView::Status status)
+ {
+ if (status != QQuickView::Ready)
+ return;
+
+ setGeometry(0, 0, 800, 600);
+
+ setResizeMode(QQuickView::SizeRootObjectToView);
+ m_view->setParentItem(rootObject());
+ QQmlProperty::write(m_view, QStringLiteral("anchors.fill"), qVariantFromValue(rootObject()));
+
+ m_view->experimental()->setRenderToOffscreenBuffer(true);
+
+ QWindowSystemInterface::handleWindowActivated(this);
+ m_view->page()->setFocus(true);
+ }
+
+private:
+ QQuickWebView* m_view;
+};
+
+PlatformWebView::PlatformWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef)
+{
+ m_view = new QQuickWebView(contextRef, pageGroupRef);
+ m_view->setAllowAnyHTTPSCertificateForLocalHost(true);
+ m_view->componentComplete();
+
+ m_window = new WrapperWindow(m_view);
+}
+
+PlatformWebView::~PlatformWebView()
+{
+ delete m_window;
+}
+
+void PlatformWebView::resizeTo(unsigned width, unsigned height)
+{
+ // If we do not have a platform window we will never get the necessary
+ // resize event, so simulate it in that case to make sure the quickview is
+ // resized to what the api tests expects.
+ if (!m_window->handle()) {
+ QRect newGeometry(m_window->x(), m_window->y(), width, height);
+ QWindowSystemInterface::handleGeometryChange(m_window, newGeometry);
+ QWindowSystemInterface::flushWindowSystemEvents();
+ }
+
+ m_window->resize(width, height);
+}
+
+WKPageRef PlatformWebView::page() const
+{
+ return m_view->pageRef();
+}
+
+void PlatformWebView::focus()
+{
+ m_view->setFocus(true);
+}
+
+void PlatformWebView::simulateSpacebarKeyPress()
+{
+ QKeyEvent event(QEvent::KeyPress, Qt::Key_Space, Qt::NoModifier);
+ QCoreApplication::sendEvent(m_window, &event);
+ QKeyEvent event2(QEvent::KeyRelease, Qt::Key_Space, Qt::NoModifier);
+ QCoreApplication::sendEvent(m_window, &event2);
+}
+
+void PlatformWebView::simulateAltKeyPress()
+{
+ QKeyEvent event(QEvent::KeyPress, Qt::Key_Alt, Qt::NoModifier);
+ QCoreApplication::sendEvent(m_window, &event);
+ QKeyEvent event2(QEvent::KeyRelease, Qt::Key_Alt, Qt::NoModifier);
+ QCoreApplication::sendEvent(m_window, &event2);
+}
+
+void PlatformWebView::simulateMouseMove(unsigned x, unsigned y)
+{
+ QPointF mousePos(x, y);
+ QMouseEvent event(QEvent::MouseMove, mousePos, Qt::NoButton, Qt::NoButton, Qt::NoModifier);
+ QCoreApplication::sendEvent(m_window, &event);
+}
+
+void PlatformWebView::simulateRightClick(unsigned x, unsigned y)
+{
+ QPointF mousePos(x, y);
+ QMouseEvent event2(QEvent::MouseButtonPress, mousePos, Qt::RightButton, Qt::RightButton, Qt::NoModifier);
+ QCoreApplication::sendEvent(m_window, &event2);
+ QMouseEvent event3(QEvent::MouseButtonRelease, mousePos, Qt::RightButton, Qt::NoButton, Qt::NoModifier);
+ QCoreApplication::sendEvent(m_window, &event3);
+}
+
+} // namespace TestWebKitAPI
+
+#include "PlatformWebViewQt.moc"
Modified: trunk/Tools/TestWebKitAPI/qt/main.cpp (143196 => 143197)
--- trunk/Tools/TestWebKitAPI/qt/main.cpp 2013-02-18 12:56:15 UTC (rev 143196)
+++ trunk/Tools/TestWebKitAPI/qt/main.cpp 2013-02-18 13:00:00 UTC (rev 143197)
@@ -21,11 +21,50 @@
#include "config.h"
#include "TestsController.h"
+#include "qquickwebview_p.h"
#include <QGuiApplication>
+void addQtWebProcessToPath()
+{
+ // Since tests won't find ./QtWebProcess, add it to PATH (at the end to prevent surprises).
+ // ROOT_BUILD_DIR should be defined by qmake.
+ qputenv("PATH", qgetenv("PATH") + QByteArray(":" ROOT_BUILD_DIR "/bin"));
+}
+
+void messageHandler(QtMsgType type, const QMessageLogContext&, const QString& message)
+{
+ if (type == QtCriticalMsg) {
+ fprintf(stderr, "%s\n", qPrintable(message));
+ return;
+ }
+
+ // Do nothing
+}
+
int main(int argc, char** argv)
{
+ bool suppressQtDebugOutput = true; // Suppress debug output from Qt if not started with --verbose.
+ bool useDesktopBehavior = true; // Use traditional desktop behavior if not started with --flickable.
+
+ for (int i = 1; i < argc; ++i) {
+ if (!qstrcmp(argv[i], "--verbose"))
+ suppressQtDebugOutput = false;
+ else if (!qstrcmp(argv[i], "--flickable"))
+ useDesktopBehavior = false;
+ }
+
+ QQuickWebViewExperimental::setFlickableViewportEnabled(!useDesktopBehavior);
+
+ // Has to be done before QApplication is constructed in case
+ // QApplication itself produces debug output.
+ if (suppressQtDebugOutput) {
+ qInstallMessageHandler(messageHandler);
+ if (qgetenv("QT_WEBKIT_SUPPRESS_WEB_PROCESS_OUTPUT").isEmpty())
+ qputenv("QT_WEBKIT_SUPPRESS_WEB_PROCESS_OUTPUT", "1");
+ }
+
QGuiApplication app(argc, argv);
+ addQtWebProcessToPath();
return TestWebKitAPI::TestsController::shared().run(argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE;
}