diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2020-03-21 14:57:49 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2020-03-23 08:27:57 +0300 |
commit | 7b528379f143c791a42f73f9d70e432d796e440b (patch) | |
tree | a386ac2564ea377067f78df77a59a0db2a3515c6 /Source | |
parent | 3e4baaf2687007b28361c6a46e7225089b7583ee (diff) |
Import QtWebKit commit 98f3c1fc89c86fe9ca6db003eaaad739961e52e8
Change-Id: Iac9a0bdcda4e45bca85c31832b2c1710c194a44c
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source')
101 files changed, 14 insertions, 5624 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index a473dbf14..d7684b39c 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -24,14 +24,14 @@ if (USE_WOFF2 AND NOT WOFF2DEC_FOUND) add_subdirectory(ThirdParty/woff2) endif () -if (ENABLE_WEBKIT) - add_subdirectory(WebKit) -endif () - if (ENABLE_WEBKIT2) add_subdirectory(WebKit2) endif () +if (ENABLE_WEBKIT) + add_subdirectory(WebKit) +endif () + WEBKIT_INCLUDE_CONFIG_FILES_IF_EXISTS() # ----------------------------------------------------------------------------- diff --git a/Source/WebKit/PlatformQt.cmake b/Source/WebKit/PlatformQt.cmake index 9c44d43fc..65c1ff1c1 100644 --- a/Source/WebKit/PlatformQt.cmake +++ b/Source/WebKit/PlatformQt.cmake @@ -250,15 +250,15 @@ list(REMOVE_DUPLICATES WebKit_SYSTEM_INCLUDE_DIRECTORIES) if (ENABLE_WEBKIT2) if (APPLE) - set(WEBKIT2_LIBRARY -Wl,-force_load WebKit2) + set(WEBKIT2_LIBRARY -Wl,-force_load $<TARGET_FILE:WebKit2>) elseif (MSVC) - set(WEBKIT2_LIBRARY "-WHOLEARCHIVE:WebKit2${CMAKE_DEBUG_POSTFIX}") + set(WEBKIT2_LIBRARY "-WHOLEARCHIVE:$<TARGET_FILE:WebKit2>") elseif (UNIX OR MINGW) - set(WEBKIT2_LIBRARY -Wl,--whole-archive WebKit2 -Wl,--no-whole-archive) + set(WEBKIT2_LIBRARY -Wl,--whole-archive $<TARGET_FILE:WebKit2> -Wl,--no-whole-archive) else () message(WARNING "Unknown system, linking with WebKit2 may fail!") - set(WEBKIT2_LIBRARY WebKit2) endif () + set(WEBKIT2_LIBRARY ${WEBKIT2_LIBRARY} WebKit2) # For linking dependencies endif () list(APPEND WebKit_LIBRARIES @@ -516,6 +516,10 @@ if (KDE_INSTALL_USE_QT_SYS_PATHS) BIN_INSTALL_DIR "$$QT_MODULE_BIN_BASE" LIB_INSTALL_DIR "$$QT_MODULE_LIB_BASE" ) + set(WebKit_Private_PRI_ARGUMENTS + BIN_INSTALL_DIR "$$QT_MODULE_BIN_BASE" + LIB_INSTALL_DIR "$$QT_MODULE_LIB_BASE" + ) if (MACOS_BUILD_FRAMEWORKS) list(APPEND WebKit_PRI_ARGUMENTS INCLUDE_INSTALL_DIR "$$QT_MODULE_LIB_BASE/QtWebKit.framework/Headers" @@ -524,6 +528,7 @@ if (KDE_INSTALL_USE_QT_SYS_PATHS) list(APPEND WebKit_Private_PRI_ARGUMENTS INCLUDE_INSTALL_DIR "$$QT_MODULE_LIB_BASE/QtWebKit.framework/Headers/${PROJECT_VERSION}" INCLUDE_INSTALL_DIR2 "$$QT_MODULE_LIB_BASE/QtWebKit.framework/Headers/${PROJECT_VERSION}/QtWebKit" + MODULE_CONFIG "lib_bundle" ) else () list(APPEND WebKit_PRI_ARGUMENTS diff --git a/Source/WebKit2/PlatformQt.cmake b/Source/WebKit2/PlatformQt.cmake index a033f1cf1..e920902f4 100644 --- a/Source/WebKit2/PlatformQt.cmake +++ b/Source/WebKit2/PlatformQt.cmake @@ -329,10 +329,6 @@ set(WEBKIT2_EXTRA_DEPENDENCIES WEBKIT_CREATE_FORWARDING_HEADERS(QtWebKit/private DIRECTORIES UIProcess/API/qt) -if (ENABLE_API_TESTS) - add_subdirectory(UIProcess/API/qt/tests) -endif () - file(GLOB WebKit2_PRIVATE_HEADERS UIProcess/API/qt/*_p.h) install( FILES diff --git a/Source/WebKit2/UIProcess/API/qt/tests/CMakeLists.txt b/Source/WebKit2/UIProcess/API/qt/tests/CMakeLists.txt deleted file mode 100644 index 210342ef5..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/CMakeLists.txt +++ /dev/null @@ -1,101 +0,0 @@ -include_directories( - "${CMAKE_SOURCE_DIR}/Source" - "${FORWARDING_HEADERS_DIR}/QtWebKit" - "${WEBKIT_DIR}/qt/Api" -) - -include_directories(SYSTEM - ${Qt5Quick_INCLUDE_DIRS} - ${Qt5Quick_PRIVATE_INCLUDE_DIRS} - ${Qt5QuickTest_INCLUDE_DIRS} -) - -set(tst_qmltests_DEFINITIONS - IMPORT_DIR="${CMAKE_BINARY_DIR}/imports" - QWP_PATH="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" - TESTS_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}" -) - -set(tst_qmltests_DesktopBehavior_DEFINITIONS - ${tst_qmltests_DEFINITIONS} - - QUICK_TEST_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/qmltests/DesktopBehavior" - DISABLE_FLICKABLE_VIEWPORT=1 -) - -set(tst_qmltests_WebView_DEFINITIONS - ${tst_qmltests_DEFINITIONS} - - QUICK_TEST_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/qmltests/WebView" -) - -set(qmltests_QML_SOURCES - qmltests/DesktopBehavior/tst_linkHovered.qml - qmltests/DesktopBehavior/tst_loadHtml.qml - qmltests/DesktopBehavior/tst_navigationRequested.qml - - qmltests/WebView/tst_applicationScheme.qml - qmltests/WebView/tst_colorChooser.qml - qmltests/WebView/tst_doubleTapToZoom.qml - qmltests/WebView/tst_download.qml - qmltests/WebView/tst_evaluateJavaScript.qml - qmltests/WebView/tst_favIconLoad.qml - qmltests/WebView/tst_findText.qml - qmltests/WebView/tst_fitToView.qml - qmltests/WebView/tst_geopermission.qml - qmltests/WebView/tst_itemSelector.qml - qmltests/WebView/tst_javaScriptDialogs.qml - qmltests/WebView/tst_loadFail.qml - qmltests/WebView/tst_loadHtml.qml - qmltests/WebView/tst_loadProgress.qml - qmltests/WebView/tst_loadProgressSignal.qml - qmltests/WebView/tst_loadUrl.qml - qmltests/WebView/tst_messaging.qml - qmltests/WebView/tst_multiFileUpload.qml - qmltests/WebView/tst_navigationHistory.qml - qmltests/WebView/tst_notification.qml - qmltests/WebView/tst_origin.qml - qmltests/WebView/tst_preferences.qml - qmltests/WebView/tst_properties.qml - qmltests/WebView/tst_resize.qml - qmltests/WebView/tst_singleFileUpload.qml - qmltests/WebView/tst_titleChanged.qml - qmltests/WebView/tst_userScripts.qml - qmltests/WebView/tst_webchannel.qml - qmltests/WebView/tst_wheelEventHandling.qml - - qmltests/common/TestWebView.qml -) - -set(qmltests_SOURCES - bytearraytestdata.cpp - util.cpp - - qmltests/tst_qmltests.cpp - ${qmltests_QML_SOURCES} -) - -qt5_add_resources(qmltests_SOURCES qmltests/resources.qrc) - -set(qmltests_LIBRARIES - WebKit - ${Qt5Quick_LIBRARIES} - ${Qt5QuickTest_LIBRARIES} - ${Qt5Test_LIBRARIES} -) - -if (SHARED_CORE) - list(APPEND qmltests_LIBRARIES - WebKit2 - ) -endif () - -add_executable(tst_qmltests_WebView ${qmltests_SOURCES}) -target_compile_definitions(tst_qmltests_WebView PRIVATE ${tst_qmltests_WebView_DEFINITIONS}) -target_link_libraries(tst_qmltests_WebView ${qmltests_LIBRARIES}) -set_target_properties(tst_qmltests_WebView PROPERTIES AUTOMOC ON) - -add_executable(tst_qmltests_DesktopBehavior ${qmltests_SOURCES}) -target_compile_definitions(tst_qmltests_DesktopBehavior PRIVATE ${tst_qmltests_DesktopBehavior_DEFINITIONS}) -target_link_libraries(tst_qmltests_DesktopBehavior ${qmltests_LIBRARIES}) -set_target_properties(tst_qmltests_DesktopBehavior PROPERTIES AUTOMOC ON) diff --git a/Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.cpp b/Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.cpp deleted file mode 100644 index b81c07610..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) - * - * 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 "bytearraytestdata.h" - -ByteArrayTestData::ByteArrayTestData(QObject* parent) - : QObject(parent) -{ - QString text = QStringLiteral("<html><head><title>title with copyright %1</title></head><body>content</body></html>"); - text = text.arg(QChar::fromLatin1(169)); - - m_latin1Data = text.toLatin1(); - m_utf8Data = text.toUtf8(); - - Q_ASSERT(m_latin1Data != m_utf8Data); -} - -ByteArrayTestData::~ByteArrayTestData() -{ -} - -QVariant ByteArrayTestData::latin1Data() const -{ - return QVariant(m_latin1Data); -} - -QVariant ByteArrayTestData::utf8Data() const -{ - return QVariant(m_utf8Data); -} - -#include "moc_bytearraytestdata.cpp" diff --git a/Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.h b/Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.h deleted file mode 100644 index 95b005f3a..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) - * - * 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. - * - */ - -#ifndef bytearraytestdata_h -#define bytearraytestdata_h - -#if 0 -#pragma qt_no_master_include -#endif - -#include "qwebkitglobal.h" -#include <QByteArray> -#include <QObject> -#include <QtQuick/qquickitem.h> - -class ByteArrayTestData : public QObject { - Q_OBJECT - Q_PROPERTY(QVariant latin1Data READ latin1Data) - Q_PROPERTY(QVariant utf8Data READ utf8Data) - -public: - ByteArrayTestData(QObject* parent = 0); - virtual ~ByteArrayTestData(); - QVariant latin1Data() const; - QVariant utf8Data() const; - -private: - QByteArray m_latin1Data; - QByteArray m_utf8Data; -}; - -QML_DECLARE_TYPE(ByteArrayTestData) - -#endif // bytearraytestdata_h diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/basic_page.html b/Source/WebKit2/UIProcess/API/qt/tests/html/basic_page.html deleted file mode 100644 index 53726e4a6..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/html/basic_page.html +++ /dev/null @@ -1,6 +0,0 @@ -<html> -<head> -<title> Basic Page </title> -</head> -<h1>Basic page</h1> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/basic_page2.html b/Source/WebKit2/UIProcess/API/qt/tests/html/basic_page2.html deleted file mode 100644 index f8cff2969..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/html/basic_page2.html +++ /dev/null @@ -1 +0,0 @@ -<h1>Basic page 2</h1> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/bluesquare.html b/Source/WebKit2/UIProcess/API/qt/tests/html/bluesquare.html deleted file mode 100644 index f4b639621..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/html/bluesquare.html +++ /dev/null @@ -1,5 +0,0 @@ -<body style="margin:60px"> - <table style="border:10px solid blue; width:80px; height:80px"> - <tr><td> </td></tr> - </table> -</body> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/direct-image-compositing.html b/Source/WebKit2/UIProcess/API/qt/tests/html/direct-image-compositing.html deleted file mode 100644 index 2fd91418a..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/html/direct-image-compositing.html +++ /dev/null @@ -1,66 +0,0 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> - -<html lang="en"> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <title>Testing direct image layer optimisation</title> - <style type="text/css" media="screen"> - img { - float: left; - width: 150px; - height: 150px; - } - img { - -webkit-transform: rotate3d(0, 0, 1, 0); - } - .test { - float: left; - height: 200px; - width: 260px; - } - </style> -</head> -<body> - - <h1>Image optimisation in layers</h1> - - <p> - This test exercises direct compositing of images with hardware acceleration. The visual results - using ACCELERATED_COMPOSITING and regular TOT should be identical. Running this test manually with - the correct debug options will show which elements are directly composited. See - <a href="https://bugs.webkit.org/show_bug.cgi?id=23361">https://bugs.webkit.org/show_bug.cgi?id=23361</a> - </p> - - <div class="test"> - <img src="resources/simple_image.png"> - Basic image - no style - can be directly composited - </div> - - <div class="test"> - <img src="resources/simple_image.png" style="border: 5px solid blue;"> - 5px blue border - can NOT be directly composited - </div> - - <div class="test"> - <img src="resources/simple_image.png" style="margin: 5px 5px;"> - margin - can NOT be directly composited - </div> - - <div class="test"> - <img src="resources/simple_image.png" style="background-color: grey;"> - solid background - can be directly composited - </div> - - <div class="test"> - <img src="resources/simple_image.png" style="background: orange url(resources/simple_image.png) -50px -50px;"> - background image - can NOT be directly composited - </div> - - <div class="test"> - <img src="resources/simple_image.png" style="-webkit-transform: rotate3d(0, 0, 1, 10deg);"> - rotated but otherwise no style - can be directly composited - </div> - -</body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/inputmethod.html b/Source/WebKit2/UIProcess/API/qt/tests/html/inputmethod.html deleted file mode 100644 index dc9140f9d..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/html/inputmethod.html +++ /dev/null @@ -1,11 +0,0 @@ -<html> -<head> -<title>Basic Page For Input Method Testing</title> -</head> -<body> -<h1>Basic page</h1> -<input id="inputField" /> -<input id="emailInputField" type="email" /> -<div id="editableDiv" contenteditable></div> -</body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/redsquare.html b/Source/WebKit2/UIProcess/API/qt/tests/html/redsquare.html deleted file mode 100644 index f70d2918a..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/html/redsquare.html +++ /dev/null @@ -1,5 +0,0 @@ -<body style="margin:20px"> - <table style="border:10px solid red; width:160px; height:160px"> - <tr><td> </td></tr> - </table> -</body> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_noBackground1.png b/Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_noBackground1.png Binary files differdeleted file mode 100644 index c293f449e..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_noBackground1.png +++ /dev/null diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_noBackground3.png b/Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_noBackground3.png Binary files differdeleted file mode 100644 index 4fa53b135..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_noBackground3.png +++ /dev/null diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_paint.png b/Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_paint.png Binary files differdeleted file mode 100644 index 68743ac9e..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/html/resources/qwkview_paint.png +++ /dev/null diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/resources/simple_image.png b/Source/WebKit2/UIProcess/API/qt/tests/html/resources/simple_image.png Binary files differdeleted file mode 100644 index 4685399ca..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/html/resources/simple_image.png +++ /dev/null diff --git a/Source/WebKit2/UIProcess/API/qt/tests/html/scroll.html b/Source/WebKit2/UIProcess/API/qt/tests/html/scroll.html deleted file mode 100644 index 6b9b2d652..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/html/scroll.html +++ /dev/null @@ -1,29 +0,0 @@ -<!DOCTYPE html> -<html> -<meta name="viewport" content="width=200, height=500, user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1"/> -<script type="text/javascript"> -function pageScroll() { - window.scrollBy(0,50); // horizontal and vertical scroll increments -} -</script> -<style> - body { - background-color: blue; - margin: 50 50 50 50; - } - div { - font-color: white; - background-color: green; - width: 300px; - height: 1000px; - } -</style> - -<head> -<title>Scroll test </title> -</head> -<body onload="pageScroll()"> -<div> -</div> -</body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/inspectorserver.pro b/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/inspectorserver.pro deleted file mode 100644 index 4a8d86f80..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/inspectorserver.pro +++ /dev/null @@ -1,4 +0,0 @@ -include(../tests.pri) -SOURCES += $${TARGET}.cpp -QT += webkit-private -DEFINES += IMPORT_DIR=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}imports\\\"\" diff --git a/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/tst_inspectorserver.cpp b/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/tst_inspectorserver.cpp deleted file mode 100644 index 2ad673a4b..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/inspectorserver/tst_inspectorserver.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/* - Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) - - 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 library 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 library; 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 "../testwindow.h" -#include "../util.h" - -#include <QNetworkAccessManager> -#include <QNetworkReply> -#include <QNetworkRequest> -#include <QScopedPointer> -#include <QtQml/QQmlEngine> -#include <QtTest/QtTest> -#include <private/qquickwebview_p.h> -#include <private/qwebpreferences_p.h> - -#define INSPECTOR_SERVER_PORT "23654" -static const QUrl s_inspectorServerHttpBaseUrl("http://localhost:" INSPECTOR_SERVER_PORT); -static const QUrl s_inspectorServerWebSocketBaseUrl("ws://localhost:" INSPECTOR_SERVER_PORT); - -class tst_InspectorServer : public QObject { - Q_OBJECT -public: - tst_InspectorServer(); - -private Q_SLOTS: - void init(); - void cleanup(); - - void testPageList(); - void testRemoteDebuggingMessage(); - void openRemoteDebuggingSession(); -private: - void prepareWebViewComponent(); - inline QQuickWebView* newWebView(); - inline QQuickWebView* webView() const; - QJsonArray fetchPageList() const; - QScopedPointer<TestWindow> m_window; - QScopedPointer<QQmlComponent> m_component; -}; - -tst_InspectorServer::tst_InspectorServer() -{ - qputenv("QTWEBKIT_INSPECTOR_SERVER", INSPECTOR_SERVER_PORT); - addQtWebProcessToPath(); - prepareWebViewComponent(); -} - -void tst_InspectorServer::prepareWebViewComponent() -{ - static QQmlEngine* engine = new QQmlEngine(this); - engine->addImportPath(QString::fromUtf8(IMPORT_DIR)); - - m_component.reset(new QQmlComponent(engine, this)); - - m_component->setData(QByteArrayLiteral("import QtQuick 2.0\n" - "import QtWebKit 3.0\n" - "WebView {}") - , QUrl()); -} - -QQuickWebView* tst_InspectorServer::newWebView() -{ - QObject* viewInstance = m_component->create(); - - return qobject_cast<QQuickWebView*>(viewInstance); -} - -void tst_InspectorServer::init() -{ - m_window.reset(new TestWindow(newWebView())); - webView()->experimental()->preferences()->setDeveloperExtrasEnabled(true); -} - -void tst_InspectorServer::cleanup() -{ - m_window.reset(); -} - -inline QQuickWebView* tst_InspectorServer::webView() const -{ - return static_cast<QQuickWebView*>(m_window->webView.data()); -} - -QJsonArray tst_InspectorServer::fetchPageList() const -{ - QNetworkAccessManager qnam; - QScopedPointer<QNetworkReply> reply(qnam.get(QNetworkRequest(s_inspectorServerHttpBaseUrl.resolved(QUrl("pagelist.json"))))); - waitForSignal(reply.data(), SIGNAL(finished())); - return QJsonDocument::fromJson(reply->readAll()).array(); -} - -void tst_InspectorServer::testPageList() -{ - QUrl testPageUrl = QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")); - LoadStartedCatcher catcher(webView()); - webView()->setUrl(testPageUrl); - waitForSignal(&catcher, SIGNAL(finished())); - - // Our page has developerExtrasEnabled and should be the only one in the list. - QJsonArray pageList = fetchPageList(); - QCOMPARE(pageList.size(), 1); - QCOMPARE(testPageUrl.toString(), pageList.at(0).toObject().value("url").toString()); -} - -void tst_InspectorServer::testRemoteDebuggingMessage() -{ - QJsonArray pageList = fetchPageList(); - QCOMPARE(pageList.size(), 1); - - // Test sending a raw remote debugging message through our web socket server. - // For this specific message see: http://code.google.com/chrome/devtools/docs/protocol/tot/runtime.html#command-evaluate - QLatin1String jsExpression("2 + 2"); - QLatin1String jsExpressionResult("4"); - QScopedPointer<QQuickWebView> webSocketQueryWebView(newWebView()); - webSocketQueryWebView->loadHtml(QString( - "<script type=\"text/javascript\">\n" - "var socket = new WebSocket('%1/devtools/page/%2');\n" - "socket.onmessage = function(message) {\n" - "var response = JSON.parse(message.data);\n" - "if (response.id === 1)\n" - "document.title = response.result.result.value;\n" - "}\n" - "socket.onopen = function() {\n" - "socket.send('{\"id\": 1, \"method\": \"Runtime.evaluate\", \"params\": {\"expression\": \"%3\" } }');\n" - "}\n" - "</script>") - .arg(s_inspectorServerWebSocketBaseUrl.toString()) - .arg(pageList.at(0).toObject().value("id").toDouble()) - .arg(jsExpression)); - - for (int i = 0; i < 10; ++i) { - if (!webSocketQueryWebView->title().isEmpty()) - break; - waitForSignal(webSocketQueryWebView.data(), SIGNAL(titleChanged()), 500); - } - - QCOMPARE(webSocketQueryWebView->title(), jsExpressionResult); -} - -void tst_InspectorServer::openRemoteDebuggingSession() -{ - QJsonArray pageList = fetchPageList(); - QCOMPARE(pageList.size(), 1); - - QScopedPointer<QQuickWebView> inspectorWebView(newWebView()); - LoadStartedCatcher catcher2(inspectorWebView.data()); - inspectorWebView->setUrl(s_inspectorServerHttpBaseUrl.resolved(QUrl(pageList.at(0).toObject().value("inspectorUrl").toString()))); - waitForSignal(&catcher2, SIGNAL(finished())); - for (int i = 0; i < 10; ++i) { - if (!inspectorWebView->title().isEmpty()) - break; - waitForSignal(inspectorWebView.data(), SIGNAL(titleChanged()), 500); - } - - // To test the whole pipeline this exploits a behavior of the inspector front-end which won't provide any title unless the - // debugging session was established correctly through web socket. It should be something like "Web Inspector - <Page URL>". - // So this test case will fail if: - // - The page list didn't return a valid inspector URL - // - Or the front-end couldn't be loaded through the inspector HTTP server - // - Or the web socket connection couldn't be established between the front-end and the page through the inspector server - // Let's see if this test isn't raising too many false positives, in which case we should use a better predicate if available. - QVERIFY(!inspectorWebView->title().isEmpty()); -} - -QTEST_MAIN(tst_InspectorServer) - -#include "tst_inspectorserver.moc" diff --git a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro deleted file mode 100644 index 02dc197c7..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro +++ /dev/null @@ -1,3 +0,0 @@ -include(../tests.pri) -SOURCES += $${TARGET}.cpp -QT += webkit-private diff --git a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp deleted file mode 100644 index c042a3494..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp +++ /dev/null @@ -1,188 +0,0 @@ -/* - Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) - - 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 library 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 library; 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 <QMetaEnum> -#include <QMetaMethod> -#include <QMetaObject> -#include <QMetaProperty> -#include <QMetaType> -#include <QtTest/QtTest> -#include <private/qquickwebview_p.h> -#include <private/qwebloadrequest_p.h> -#include <private/qwebnavigationrequest_p.h> - -class tst_publicapi : public QObject { - Q_OBJECT -private Q_SLOTS: - void publicAPI(); -}; - -static QList<const QMetaObject*> typesToCheck = QList<const QMetaObject*>() - << &QQuickWebView::staticMetaObject - << &QWebLoadRequest::staticMetaObject - << &QWebNavigationRequest::staticMetaObject; - -static QStringList expectedAPI = QStringList() - << "QQuickWebView.AcceptRequest --> NavigationRequestAction" - << "QQuickWebView.IgnoreRequest --> NavigationRequestAction" - << "QQuickWebView.LoadStartedStatus --> LoadStatus" - << "QQuickWebView.LoadStoppedStatus --> LoadStatus" - << "QQuickWebView.LoadSucceededStatus --> LoadStatus" - << "QQuickWebView.LoadFailedStatus --> LoadStatus" - << "QQuickWebView.NoErrorDomain --> ErrorDomain" - << "QQuickWebView.InternalErrorDomain --> ErrorDomain" - << "QQuickWebView.NetworkErrorDomain --> ErrorDomain" - << "QQuickWebView.HttpErrorDomain --> ErrorDomain" - << "QQuickWebView.DownloadErrorDomain --> ErrorDomain" - << "QQuickWebView.LinkClickedNavigation --> NavigationType" - << "QQuickWebView.FormSubmittedNavigation --> NavigationType" - << "QQuickWebView.BackForwardNavigation --> NavigationType" - << "QQuickWebView.ReloadNavigation --> NavigationType" - << "QQuickWebView.FormResubmittedNavigation --> NavigationType" - << "QQuickWebView.OtherNavigation --> NavigationType" - << "QQuickWebView.title --> QString" - << "QQuickWebView.url --> QUrl" - << "QQuickWebView.icon --> QUrl" - << "QQuickWebView.canGoBack --> bool" - << "QQuickWebView.canGoForward --> bool" - << "QQuickWebView.loading --> bool" - << "QQuickWebView.loadProgress --> int" - << "QQuickWebView.titleChanged() --> void" - << "QQuickWebView.navigationHistoryChanged() --> void" - << "QQuickWebView.loadingChanged(QWebLoadRequest*) --> void" - << "QQuickWebView.loadProgressChanged() --> void" - << "QQuickWebView.urlChanged() --> void" - << "QQuickWebView.iconChanged() --> void" - << "QQuickWebView.linkHovered(QUrl,QString) --> void" - << "QQuickWebView.navigationRequested(QWebNavigationRequest*) --> void" - << "QQuickWebView.loadHtml(QString,QUrl,QUrl) --> void" - << "QQuickWebView.loadHtml(QString,QUrl) --> void" - << "QQuickWebView.loadHtml(QString) --> void" - << "QQuickWebView.goBack() --> void" - << "QQuickWebView.goForward() --> void" - << "QQuickWebView.stop() --> void" - << "QQuickWebView.reload() --> void" - << "QWebLoadRequest.url --> QUrl" - << "QWebLoadRequest.status --> QQuickWebView::LoadStatus" - << "QWebLoadRequest.errorString --> QString" - << "QWebLoadRequest.errorDomain --> QQuickWebView::ErrorDomain" - << "QWebLoadRequest.errorCode --> int" - << "QWebNavigationRequest.url --> QUrl" - << "QWebNavigationRequest.mouseButton --> int" - << "QWebNavigationRequest.keyboardModifiers --> int" - << "QWebNavigationRequest.action --> QQuickWebView::NavigationRequestAction" - << "QWebNavigationRequest.navigationType --> QQuickWebView::NavigationType" - << "QWebNavigationRequest.isMainFrame --> bool" - << "QWebNavigationRequest.actionChanged() --> void" - ; - -static bool isCheckedEnum(const QByteArray& typeName) -{ - QList<QByteArray> tokens = typeName.split(':'); - if (tokens.size() == 3) { - QByteArray& enumClass = tokens[0]; - QByteArray& enumName = tokens[2]; - foreach (const QMetaObject* mo, typesToCheck) { - if (mo->className() != enumClass) - continue; - for (int i = mo->enumeratorOffset(); i < mo->enumeratorCount(); ++i) - if (mo->enumerator(i).name() == enumName) - return true; - } - } - return false; -} - -static bool isCheckedClass(const QByteArray& typeName) -{ - foreach (const QMetaObject* mo, typesToCheck) { - QByteArray moTypeName(mo->className()); - if (moTypeName == typeName || moTypeName + "*" == typeName) - return true; - } - return false; -} - -static void checkKnownType(const QByteArray& typeName) -{ - if ((typeName != "void" && !QMetaType::type(typeName)) || QMetaType::type(typeName) >= QMetaType::User) { - bool knownEnum = isCheckedEnum(typeName); - bool knownClass = isCheckedClass(typeName); - QVERIFY2(knownEnum || knownClass, qPrintable(QString("The API uses an unknown type [%1], you might have to add it to the typesToCheck list.").arg(typeName.constData()))); - } -} - -static void gatherAPI(const QString& prefix, const QMetaEnum& metaEnum, QStringList* output) -{ - for (int i = 0; i < metaEnum.keyCount(); ++i) - *output << QString::fromLatin1("%1%2 --> %3").arg(prefix).arg(metaEnum.key(i)).arg(metaEnum.name()); -} - -static void gatherAPI(const QString& prefix, const QMetaProperty& property, QStringList* output) -{ - *output << QString::fromLatin1("%1%2 --> %3").arg(prefix).arg(property.name()).arg(property.typeName()); - checkKnownType(property.typeName()); -} - -static void gatherAPI(const QString& prefix, const QMetaMethod& method, QStringList* output) -{ - if (method.access() != QMetaMethod::Private) { - const char* methodTypeName = !!strlen(method.typeName()) ? method.typeName() : "void"; - *output << QString::fromLatin1("%1%2 --> %3").arg(prefix).arg(QString::fromLatin1(method.methodSignature())).arg(QString::fromLatin1(methodTypeName)); - - checkKnownType(methodTypeName); - foreach (QByteArray paramType, method.parameterTypes()) - checkKnownType(paramType); - } -} - -static void gatherAPI(const QString& prefix, const QMetaObject* meta, QStringList* output) -{ - // *Offset points us only at the leaf class members, we don't have inheritance in our API yet anyway. - for (int i = meta->enumeratorOffset(); i < meta->enumeratorCount(); ++i) - gatherAPI(prefix, meta->enumerator(i), output); - for (int i = meta->propertyOffset(); i < meta->propertyCount(); ++i) - gatherAPI(prefix, meta->property(i), output); - for (int i = meta->methodOffset(); i < meta->methodCount(); ++i) - gatherAPI(prefix, meta->method(i), output); -} - -void tst_publicapi::publicAPI() -{ - QStringList actualAPI; - foreach (const QMetaObject* meta, typesToCheck) - gatherAPI(QString::fromLatin1(meta->className()) + ".", meta, &actualAPI); - - // Uncomment to print the actual API. - // foreach(QString actual, actualAPI) - // printf(" << \"%s\"\n", qPrintable(actual)); - - // Make sure that nothing slips in the public API unintentionally. - foreach (QString actual, actualAPI) - QVERIFY2(expectedAPI.contains(actual), qPrintable(actual)); - // Make sure that the expected list is up-to-date with intentionally added APIs. - foreach (QString expected, expectedAPI) - QVERIFY2(actualAPI.contains(expected), qPrintable(expected)); -} - -QTEST_MAIN(tst_publicapi) - -#include "tst_publicapi.moc" diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro deleted file mode 100644 index e8ac901f1..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior.pro +++ /dev/null @@ -1,18 +0,0 @@ -include(../tests.pri) -SOURCES += tst_qmltests.cpp -TARGET = tst_qmltests_DesktopBehavior -OBJECTS_DIR = .obj_DesktopBehavior - -QT += webkit-private -CONFIG += testcase - -QT += qmltest - -DEFINES += DISABLE_FLICKABLE_VIEWPORT=1 -# Test the QML files under DesktopBehavior in the source repository. -DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$PWD$${QMAKE_DIR_SEP}DesktopBehavior\\\"\" -DEFINES += IMPORT_DIR=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}imports\\\"\" - -OTHER_FILES += \ - DesktopBehavior/* \ - common/* diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_linkHovered.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_linkHovered.qml deleted file mode 100644 index e035dc2a9..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_linkHovered.qml +++ /dev/null @@ -1,80 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import "../common" - -TestWebView { - id: webView - width: 200 - height: 400 - focus: true - - property string lastUrl - property string lastTitle - - SignalSpy { - id: spy - target: webView - signalName: "linkHovered" - } - - onLinkHovered: { - webView.lastUrl = hoveredUrl - webView.lastTitle = hoveredTitle - } - - TestCase { - name: "DesktopWebViewLinkHovered" - - // Delayed windowShown to workaround problems with Qt5 in debug mode. - when: false - Timer { - running: parent.windowShown - repeat: false - interval: 1 - onTriggered: parent.when = true - } - - function init() { - webView.lastUrl = "" - webView.lastTitle = "" - spy.clear() - } - - function test_linkHovered() { - compare(spy.count, 0) - webView.url = Qt.resolvedUrl("../common/test2.html") - verify(webView.waitForLoadSucceeded()) - mouseMove(webView, 100, 100) - spy.wait() - compare(spy.count, 1) - compare(webView.lastUrl, Qt.resolvedUrl("../common/test1.html")) - compare(webView.lastTitle, "A title") - mouseMove(webView, 100, 300) - spy.wait() - compare(spy.count, 2) - compare(webView.lastUrl, "") - compare(webView.lastTitle, "") - } - - function test_linkHoveredDoesntEmitRepeated() { - compare(spy.count, 0) - webView.url = Qt.resolvedUrl("../common/test2.html") - verify(webView.waitForLoadSucceeded()) - - for (var i = 0; i < 100; i += 10) - mouseMove(webView, 100, 100 + i) - - spy.wait() - compare(spy.count, 1) - compare(webView.lastUrl, Qt.resolvedUrl("../common/test1.html")) - - for (var i = 0; i < 100; i += 10) - mouseMove(webView, 100, 300 + i) - - spy.wait() - compare(spy.count, 2) - compare(webView.lastUrl, "") - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_loadHtml.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_loadHtml.qml deleted file mode 100644 index b50aec371..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_loadHtml.qml +++ /dev/null @@ -1,53 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import "../common" - -TestWebView { - id: webView - width: 200 - height: 400 - focus: true - - property string lastUrl - - SignalSpy { - id: linkHoveredSpy - target: webView - signalName: "linkHovered" - } - - onLinkHovered: { - webView.lastUrl = hoveredUrl - } - - TestCase { - name: "DesktopWebViewLoadHtml" - - // Delayed windowShown to workaround problems with Qt5 in debug mode. - when: false - Timer { - running: parent.windowShown - repeat: false - interval: 1 - onTriggered: parent.when = true - } - - function init() { - webView.lastUrl = "" - linkHoveredSpy.clear() - } - - function test_baseUrlAfterLoadHtml() { - linkHoveredSpy.clear() - compare(linkHoveredSpy.count, 0) - webView.loadHtml("<html><head><title>Test page with huge link area</title></head><body><a title=\"A title\" href=\"test1.html\"><img width=200 height=200></a></body></html>", "http://www.example.foo.com") - verify(webView.waitForLoadSucceeded()) - compare("http://www.example.foo.com/", webView.url) - mouseMove(webView, 100, 100) - linkHoveredSpy.wait() - compare(linkHoveredSpy.count, 1) - compare(webView.lastUrl, "http://www.example.foo.com/test1.html") - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_navigationRequested.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_navigationRequested.qml deleted file mode 100644 index 2aefce537..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/DesktopBehavior/tst_navigationRequested.qml +++ /dev/null @@ -1,116 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 -import "../common" - -Item { - property int expectedLength: 0 - property int totalBytes: 0 - property bool shouldDownload: false - property url beginUrl: Qt.resolvedUrl("../common/test2.html") - property url endUrl: Qt.resolvedUrl("../common/test1.html") - - TestWebView { - id: webView - width: 200 - height: 200 - - signal downloadFinished() - - onNavigationRequested: { - if (shouldDownload) - request.action = WebViewExperimental.DownloadRequest - else if (request.mouseButton == Qt.MiddleButton && request.keyboardModifiers & Qt.ControlModifier) { - otherWebView.url = request.url - request.action = WebView.IgnoreRequest - } - } - - experimental.onDownloadRequested: { - download.target = downloadItem - expectedLength = downloadItem.expectedContentLength - downloadItem.destinationPath = downloadItem.suggestedFilename - downloadItem.start() - } - - Connections { - id: download - ignoreUnknownSignals: true - onSucceeded: { - totalBytes = download.target.totalBytesReceived - webView.downloadFinished() - } - } - } - - TestWebView { - id: otherWebView - } - - SignalSpy { - id: downloadSpy - target: webView.experimental - signalName: "downloadRequested" - } - - SignalSpy { - id: downloadFinishedSpy - target: webView - signalName: "downloadFinished" - } - - TestCase { - name: "DesktopWebViewNavigationRequested" - - // Delayed windowShown to workaround problems with Qt5 in debug mode. - when: false - Timer { - running: parent.windowShown - repeat: false - interval: 1 - onTriggered: parent.when = true - } - - function init() { - downloadSpy.clear() - downloadFinishedSpy.clear() - shouldDownload = false - } - - function test_usePolicy() { - webView.url = beginUrl - verify(webView.waitForLoadSucceeded()) - mouseClick(webView, 100, 100, Qt.LeftButton) - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "Test page 1") - compare(webView.url, endUrl) - } - - function test_ignorePolicy() { - webView.url = beginUrl - verify(webView.waitForLoadSucceeded()) - mouseClick(webView, 100, 100, Qt.MiddleButton, Qt.ControlModifier) - verify(otherWebView.waitForLoadSucceeded()) - verify(webView.loadStatus == null) - compare(webView.url, beginUrl) - compare(otherWebView.title, "Test page 1") - compare(otherWebView.url, endUrl) - } - - function test_downloadPolicy() { - webView.url = beginUrl - verify(webView.waitForLoadSucceeded()) - downloadSpy.clear() - downloadFinishedSpy.clear() - expectedLength = 0 - shouldDownload = true - mouseClick(webView, 100, 100, Qt.LeftButton) - downloadSpy.wait() - compare(downloadSpy.count, 1) - downloadFinishedSpy.wait() - compare(downloadFinishedSpy.count, 1) - compare(totalBytes, expectedLength) - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro deleted file mode 100644 index 6c67da96e..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView.pro +++ /dev/null @@ -1,19 +0,0 @@ -include(../tests.pri) -SOURCES += tst_qmltests.cpp -TARGET = tst_qmltests_WebView -OBJECTS_DIR = .obj_WebView - -QT += webkit-private -CONFIG += testcase - -QT += qmltest - -# Test the QML files under WebView in the source repository. -DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$PWD$${QMAKE_DIR_SEP}WebView\\\"\" -DEFINES += IMPORT_DIR=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}imports\\\"\" - -OTHER_FILES += \ - WebView/* \ - common/* - -RESOURCES = resources.qrc diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml deleted file mode 100644 index d25dcb9a8..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml +++ /dev/null @@ -1,129 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 -import Test 1.0 -import "../common" - -TestWebView { - id: webView - width: 400 - height: 300 - - experimental { - urlSchemeDelegates: [ - UrlSchemeDelegate { - scheme: "applicationScheme" - onReceivedRequest: { - reply.data = "<html><head><title>Test Application Scheme</title></head><body>A test page.</body></html>" - reply.send() - } - }, - UrlSchemeDelegate { - scheme: "scheme1" - onReceivedRequest: { - reply.data = "<html><head><title>Scheme1 Reply</title></head><body>A test page.</body></html>" - reply.send() - } - }, - UrlSchemeDelegate { - scheme: "scheme2" - onReceivedRequest: { - reply.data = "<html><head><title>Scheme2 Reply</title></head><body>A test page.</body></html>" - reply.send() - } - }, - UrlSchemeDelegate { - scheme: "scheme3" - onReceivedRequest: { - if (request.url == "scheme3://url1") - reply.data = "<html><head><title>Scheme3 Reply1</title></head><body>A test page.</body></html>" - else if (request.url == "scheme3://url2") - reply.data = "<html><head><title>Scheme3 Reply2</title></head><body>A test page.</body></html>" - else - reply.data = "<html><head><title>Should not happen</title></head><body>A test page.</body></html>" - reply.send() - } - }, - UrlSchemeDelegate { - scheme: "schemeCharset" - onReceivedRequest: { - if (request.url == "schemecharset://latin1") { - reply.data = byteArrayHelper.latin1Data - reply.contentType = "text/html; charset=iso-8859-1" - } else if (request.url == "schemecharset://utf-8") { - reply.data = byteArrayHelper.utf8Data - reply.contentType = "text/html; charset=utf-8" - } - reply.send() - } - } - - ] - } - - ByteArrayTestData { - id: byteArrayHelper - } - - TestCase { - name: "WebViewApplicationSchemes" - - function test_applicationScheme() { - skip("QTFIXME: application schemes are not supported yet") - var testUrl = "applicationScheme://something" - webView.url = testUrl - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "Test Application Scheme") - } - - function test_multipleSchemes() { - skip("QTFIXME: application schemes are not supported yet") - // Test if we receive the right reply when defining multiple schemes. - var testUrl = "scheme2://some-url-string" - webView.url = testUrl - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "Scheme2 Reply") - - testUrl = "scheme1://some-url-string" - webView.url = testUrl - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "Scheme1 Reply") - } - - function test_multipleUrlsForScheme() { - skip("QTFIXME: application schemes are not supported yet") - var testUrl = "scheme3://url1" - webView.url = testUrl - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "Scheme3 Reply1") - - testUrl = "scheme3://url2" - webView.url = testUrl - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "Scheme3 Reply2") - - } - - function test_charsets() { - skip("QTFIXME: application schemes are not supported yet") - var testUrl = "schemeCharset://latin1" - webView.url = testUrl - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "title with copyright ©") - - testUrl = "schemeCharset://utf-8" - webView.url = testUrl - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "title with copyright ©") - } - - function test_qrcScheme() { - var testUrl = "qrc:///common/qrctest.html" - webView.url = testUrl - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "Loaded from qrc.") - - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_colorChooser.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_colorChooser.qml deleted file mode 100644 index b5152c2bb..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_colorChooser.qml +++ /dev/null @@ -1,103 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 -import "../common" - -TestWebView { - id: webView - - width: 400 - height: 400 - - property bool featureEnabled - - property string selectedColor - property bool shouldReject - property bool shouldAcceptCurrent - - experimental.colorChooser: Item { - Component.onCompleted: { - if (WebView.view.shouldReject) - model.reject() - else if (WebView.view.shouldAcceptCurrent) - model.accept(model.currentColor) - else - model.accept(WebView.view.selectedColor) - } - } - - function openColorChooser() { - webView.experimental.test.touchTap(webView, 25, 25) - } - - SignalSpy { - id: titleSpy - target: webView - signalName: "titleChanged" - } - - TestCase { - id: test - name: "WebViewColorChooser" - when: windowShown - - function init() { - webView.url = Qt.resolvedUrl("../common/colorChooser.html") - verify(webView.waitForLoadSucceeded()) - - while (webView.title != "Feature enabled" && webView.title != "Feature disabled") - wait(0) - - webView.featureEnabled = (webView.title == "Feature enabled") - if (!webView.featureEnabled) - return - - titleSpy.clear() - - webView.shouldReject = false - webView.shouldAcceptCurrent = false - } - - function cleanup() { - titleSpy.clear() - } - - function test_accept() { - if (!webView.featureEnabled) - return - - // The title changes here twice: first - // when we click, it changes from "Feature enabled" - // to the sanitized color and next, when we - // pick a new color with the chooser. - webView.selectedColor = "#020020" - openColorChooser() - while (titleSpy.count != 2) - wait(0) - compare(webView.title, "#020020") - } - - function test_currentValue() { - if (!webView.featureEnabled) - return - - webView.shouldAcceptCurrent = true - openColorChooser() - titleSpy.wait() - compare(titleSpy.count, 1) - compare(webView.title, "#000000") - } - - function test_reject() { - if (!webView.featureEnabled) - return - - webView.shouldReject = true; - openColorChooser() - titleSpy.wait() - compare(titleSpy.count, 1) - compare(webView.title, "#000000") - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_doubleTapToZoom.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_doubleTapToZoom.qml deleted file mode 100644 index d25f778bd..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_doubleTapToZoom.qml +++ /dev/null @@ -1,218 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 -import Test 1.0 -import "../common" - -Item { - TestWebView { - id: webView - width: 320 - height: 240 - - property variant result - - property variant content: "data:text/html," + - "<head>" + - " <meta name='viewport' content='width=device-width'>" + - "</head>" + - "<body>" + - " <div id='target' " + - " style='position:absolute; left:20; top:20; width:220; height:80;'>" + - " </div>" + - " <div id='smalltarget' " + - " style='position:absolute; left:20; top:120; width:140; height:80;'>" + - " </div>" + - "</body>" - - signal resultReceived - } - - SignalSpy { - id: resultSpy - target: webView - signalName: "resultReceived" - } - - SignalSpy { - id: scaleSpy - target: webView.experimental.test - signalName: "contentsScaleCommitted" - } - - TestCase { - name: "DoubleTapToZoom" - when: windowShown - - property variant test: webView.experimental.test - - function init() { - resultSpy.clear() - scaleSpy.clear() - } - - function windowSize() { - resultSpy.clear(); - var result; - - webView.experimental.evaluateJavaScript( - "window.innerWidth + 'x' + window.innerHeight", - function(size) { webView.resultReceived(); result = size }); - resultSpy.wait(); - return result; - } - - function elementRect(id) { - resultSpy.clear(); - var result; - - webView.experimental.evaluateJavaScript( - "JSON.stringify(document.getElementById('" + id + "').getBoundingClientRect());", - function(rect) { webView.resultReceived(); result = JSON.parse(rect); }); - resultSpy.wait(); - return result; - } - - function doubleTapAtPoint(x, y) { - scaleSpy.clear() - test.touchDoubleTap(webView, x, y) - scaleSpy.wait() - } - - function test_basic_zoomInAndBack() { - webView.url = webView.content - verify(webView.waitForViewportReady()) - - compare(windowSize(), "320x240") - - compare(test.contentsScale, 1.0) - - var rect = elementRect("target"); - var newScale = webView.width / (rect.width + 2 * 10) // inflated by 10px - doubleTapAtPoint(100, 50) - - compare(test.contentsScale, newScale) - - doubleTapAtPoint(100, 50) - - compare(test.contentsScale, 1.0) - } - - function test_double_zoomInAndBack() { - webView.url = webView.content - verify(webView.waitForViewportReady()) - - compare(windowSize(), "320x240") - compare(test.contentsScale, 1.0) - - var target = elementRect("target"); - var smalltarget = elementRect("smalltarget"); - var targetScale = webView.width / (target.width + 2 * 10) // inflated by 10px - var smallTargetScale = webView.width / (smalltarget.width + 2 * 10) // inflated by 10px - - doubleTapAtPoint(100, 50) - - compare(test.contentsScale, targetScale) - - doubleTapAtPoint(100, 160) - - compare(test.contentsScale, smallTargetScale) - - // Zoom out by double clicking first the small target and then the large target. - doubleTapAtPoint(100, 120) - - compare(test.contentsScale, targetScale) - - doubleTapAtPoint(100, 50) - - compare(test.contentsScale, 1.0) - } - - function test_double_zoomInAndBack2() { - webView.url = webView.content - verify(webView.waitForViewportReady()) - - compare(windowSize(), "320x240") - compare(test.contentsScale, 1.0) - - var target = elementRect("target"); - var smalltarget = elementRect("smalltarget"); - var targetScale = webView.width / (target.width + 2 * 10) // inflated by 10px - var smallTargetScale = webView.width / (smalltarget.width + 2 * 10) // inflated by 10px - - doubleTapAtPoint(100, 50) - - compare(test.contentsScale, targetScale) - - doubleTapAtPoint(100, 160) - - compare(test.contentsScale, smallTargetScale) - - // Zoom out by double clicking the small target twice. - doubleTapAtPoint(100, 120) - - compare(test.contentsScale, targetScale) - - doubleTapAtPoint(100, 160) - - compare(test.contentsScale, 1.0) - } - - function test_double_zoomInOutAndBack() { - webView.url = webView.content - verify(webView.waitForViewportReady()) - - compare(windowSize(), "320x240") - compare(test.contentsScale, 1.0) - - var target = elementRect("target"); - var smalltarget = elementRect("smalltarget"); - var targetScale = webView.width / (target.width + 2 * 10) // inflated by 10px - var smallTargetScale = webView.width / (smalltarget.width + 2 * 10) // inflated by 10px - - doubleTapAtPoint(100, 50) - - compare(test.contentsScale, targetScale) - - doubleTapAtPoint(100, 160) - - compare(test.contentsScale, smallTargetScale) - - // Zoom out by double clicking the large target twice. - doubleTapAtPoint(100, 40) - - compare(test.contentsScale, targetScale) - - doubleTapAtPoint(100, 50) - - compare(test.contentsScale, 1.0) - } - - function test_double_zoomInOutAndBack2() { - webView.url = webView.content - verify(webView.waitForViewportReady()) - - compare(windowSize(), "320x240") - compare(test.contentsScale, 1.0) - - var target = elementRect("target"); - var smalltarget = elementRect("smalltarget"); - var targetScale = webView.width / (target.width + 2 * 10) // inflated by 10px - var smallTargetScale = webView.width / (smalltarget.width + 2 * 10) // inflated by 10px - - // Zoom in directly to the small target, and then out over the large target. - doubleTapAtPoint(100, 140) - - compare(test.contentsScale, smallTargetScale) - - doubleTapAtPoint(100, 20) - - compare(test.contentsScale, targetScale) - - doubleTapAtPoint(100, 50) - - compare(test.contentsScale, 1.0) - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_download.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_download.qml deleted file mode 100644 index 9f1d43231..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_download.qml +++ /dev/null @@ -1,86 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 - -WebView { - id: webView - width: 200 - height: 200 - - property int expectedLength: 0 - property int totalBytes: 0 - - signal downloadFinished() - - SignalSpy { - id: spy - target: experimental - signalName: "downloadRequested" - } - - SignalSpy { - id: downloadFinishedSpy - target: webView - signalName: "downloadFinished" - } - - experimental.onDownloadRequested: { - download.target = downloadItem - expectedLength = downloadItem.expectedContentLength - downloadItem.destinationPath = downloadItem.suggestedFilename - downloadItem.start() - } - - Connections { - id: download - ignoreUnknownSignals: true - onSucceeded: { - totalBytes = download.target.totalBytesReceived - webView.downloadFinished() - } - } - - TestCase { - name: "WebViewDownload" - - // Delayed windowShown to workaround problems with Qt5 in debug mode. - when: false - Timer { - running: parent.windowShown - repeat: false - interval: 1 - onTriggered: parent.when = true - } - - function init() { - spy.clear() - downloadFinishedSpy.clear() - expectedLength = 0 - } - - function test_downloadRequest() { - compare(spy.count, 0) - webView.url = Qt.resolvedUrl("../common/download.zip") - spy.wait() - compare(spy.count, 1) - } - - function test_expectedLength() { - compare(spy.count, 0) - webView.url = Qt.resolvedUrl("../common/download.zip") - spy.wait() - compare(spy.count, 1) - compare(expectedLength, 325) - } - - function test_succeeded() { - compare(spy.count, 0) - webView.url = Qt.resolvedUrl("../common/download.zip") - spy.wait() - compare(spy.count, 1) - downloadFinishedSpy.wait() - compare(totalBytes, expectedLength) - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_evaluateJavaScript.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_evaluateJavaScript.qml deleted file mode 100644 index b4576af36..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_evaluateJavaScript.qml +++ /dev/null @@ -1,226 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 -import "../common" - -Item { - TestWebView { - id: webView - property variant lastMessage - property variant lastResult - - experimental.preferences.navigatorQtObjectEnabled: true - experimental.onMessageReceived: { - lastMessage = message - } - } - - SignalSpy { - id: messageSpy - target: webView.experimental - signalName: "messageReceived" - } - - SignalSpy { - id: resultSpy - target: webView - signalName: "lastResultChanged" - } - - TestCase { - name: "JavaScriptEvaluation" - - function init() { - messageSpy.clear() - webView.lastMessage = null - - resultSpy.clear() - webView.lastResult = null - } - - function test_basic() { - messageSpy.clear() - webView.url = "about:blank" - verify(webView.waitForLoadSucceeded()) - - webView.experimental.evaluateJavaScript( - "navigator.qt.onmessage = function(message) {" + - " var result = message.data.split('');" + - " result = result.reverse().join('');" + - " navigator.qt.postMessage(result);" + - "}"); - - webView.experimental.postMessage("DLROW OLLEH"); - messageSpy.wait() - compare(webView.lastMessage.data, "HELLO WORLD") - } - - function test_propertyObjectWithChild() { - resultSpy.clear() - webView.url = "about:blank" - verify(webView.waitForLoadSucceeded()) - - webView.experimental.evaluateJavaScript( - "(function() {" + - " var parent = new Object;" + - " var child = new Object;" + - " parent['level'] = '1';" + - " child['level'] = 2;" + - " parent['child'] = child;" + - " return parent;" + - "})()", - - function(result) { - webView.lastResult = result - }); - - resultSpy.wait() - - compare(JSON.stringify(webView.lastResult), - '{"level":"1","child":{"level":2}}') - } - - function test_undefinedValue() { - resultSpy.clear() - webView.url = "about:blank" - verify(webView.waitForLoadSucceeded()) - - webView.experimental.evaluateJavaScript( - "(function() { })()", - - function(result) { - webView.lastResult = result - }) - - resultSpy.wait() - verify(typeof webView.lastResult === "undefined") - compare(webView.lastResult, undefined) - } - - function test_nullValue() { - resultSpy.clear() - - webView.url = "about:blank" - verify(webView.waitForLoadSucceeded()) - - webView.experimental.evaluateJavaScript( - "(function() { return { value: null } })()", - - function(result) { - webView.lastResult = result - }) - - resultSpy.wait() - verify(typeof webView.lastResult === "object") - verify(typeof webView.lastResult.value === "object") - compare(webView.lastResult.value, null) - } - - function test_booleanValue() { - resultSpy.clear() - webView.url = "about:blank" - verify(webView.waitForLoadSucceeded()) - - webView.experimental.evaluateJavaScript( - "(function() { return true })()", - - function(result) { - webView.lastResult = result - }) - - resultSpy.wait() - verify(typeof webView.lastResult === "boolean") - compare(webView.lastResult, true) - } - - function test_stringValue() { - resultSpy.clear() - webView.url = "about:blank" - verify(webView.waitForLoadSucceeded()) - - webView.experimental.evaluateJavaScript( - "(function() { return 'dongs' })()", - - function(result) { - webView.lastResult = result - }) - - resultSpy.wait() - verify(typeof webView.lastResult === "string") - compare(webView.lastResult, "dongs") - } - - function test_integerValue() { - resultSpy.clear() - webView.url = "about:blank" - verify(webView.waitForLoadSucceeded()) - - webView.experimental.evaluateJavaScript( - "(function() { return 1337 })()", - - function(result) { - webView.lastResult = result - }) - - resultSpy.wait() - verify(typeof webView.lastResult === "number") - compare(webView.lastResult, 1337) - } - - function test_floatValue() { - resultSpy.clear() - webView.url = "about:blank" - verify(webView.waitForLoadSucceeded()) - - webView.experimental.evaluateJavaScript( - "(function() { return 13.37 })()", - - function(result) { - webView.lastResult = result - }) - - resultSpy.wait() - verify(typeof webView.lastResult === "number") - compare(webView.lastResult, 13.37) - } - - function test_queryTitle() { - resultSpy.clear() - var testUrl = Qt.resolvedUrl("../common/evaluatejavascript.html") - webView.url = testUrl - verify(webView.waitForLoadSucceeded()) - - webView.experimental.evaluateJavaScript( - "(function() {" + - " return document.title" + - "})()", - - function(result) { - webView.lastResult = result - }) - - resultSpy.wait() - compare(webView.lastResult, "Evaluate JavaScript") - } - - function test_queryById() { - resultSpy.clear() - var testUrl = Qt.resolvedUrl("../common/evaluatejavascript.html") - webView.url = testUrl - verify(webView.waitForLoadSucceeded()) - - webView.experimental.evaluateJavaScript( - "(function() {" + - " return document.getElementById('text').innerHTML" + - "})()", - - function(result) { - webView.lastResult = result - }) - - resultSpy.wait() - compare(webView.lastResult, "Hello from the WebProcess :-)") - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_favIconLoad.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_favIconLoad.qml deleted file mode 100644 index 4437b10a4..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_favIconLoad.qml +++ /dev/null @@ -1,59 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import "../common" - -TestWebView { - id: webView - - SignalSpy { - id: spy - target: webView - signalName: "iconChanged" - } - - Image { - id: favicon - asynchronous: true - source: webView.icon - } - - TestCase { - id: test - name: "WebViewLoadFavIcon" - when: windowShown - - function init() { - if (webView.icon != '') { - // If this is not the first test, then load a blank page without favicon, restoring the initial state. - webView.url = 'about:blank' - verify(webView.waitForLoadSucceeded()) - spy.wait() - } - spy.clear() - } - - function test_favIconLoad() { - compare(spy.count, 0) - var url = Qt.resolvedUrl("../common/favicon.html") - webView.url = url - verify(webView.waitForLoadSucceeded()) - spy.wait() - compare(spy.count, 1) - compare(favicon.width, 48) - compare(favicon.height, 48) - } - - function test_favIconLoadEncodedUrl() { - compare(spy.count, 0) - var url = Qt.resolvedUrl("../common/favicon2.html?favicon=load should work with#whitespace!") - webView.url = url - verify(webView.waitForLoadSucceeded()) - spy.wait() - compare(spy.count, 1) - compare(favicon.width, 16) - compare(favicon.height, 16) - - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_findText.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_findText.qml deleted file mode 100644 index f1ea15c50..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_findText.qml +++ /dev/null @@ -1,145 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 -import "../common" - -TestWebView { - id: webView - width: 400 - height: 300 - - property int matchCount: -1 - property bool findFailed: false - function clear() { - textFoundSpy.clear() - findFailed = false - matchCount = -1 - } - - SignalSpy { - id: textFoundSpy - target: webView.experimental - signalName: "textFound" - } - - experimental.onTextFound: { - webView.matchCount = matchCount - findFailed = matchCount == 0 - } - TestCase { - name: "WebViewFindText" - - function test_findText() { - var findFlags = WebViewExperimental.FindHighlightAllOccurrences | - WebViewExperimental.FindCaseSensitively - webView.clear() - webView.url = Qt.resolvedUrl("../common/test1.html") - verify(webView.waitForLoadSucceeded()) - webView.experimental.findText("Hello", findFlags) - textFoundSpy.wait() - compare(textFoundSpy.count, 1) - compare(matchCount, 1) - } - function test_findTextCaseInsensitive() { - var findFlags = 0 - - webView.clear() - webView.url = Qt.resolvedUrl("../common/test1.html") - verify(webView.waitForLoadSucceeded()) - webView.experimental.findText("heLLo", findFlags) - textFoundSpy.wait() - compare(textFoundSpy.count, 1) - compare(matchCount, 1) - } - function test_findTextManyMatches() { - var findFlags = WebViewExperimental.FindHighlightAllOccurrences - webView.clear() - webView.url = Qt.resolvedUrl("../common/test4.html") - verify(webView.waitForLoadSucceeded()) - webView.experimental.findText("bla", findFlags) - textFoundSpy.wait() - compare(textFoundSpy.count, 1) - compare(matchCount, 100) - } - function test_findTextBackward() { - var findFlags = WebViewExperimental.FindHighlightAllOccurrences - webView.clear() - webView.url = Qt.resolvedUrl("../common/test4.html") - verify(webView.waitForLoadSucceeded()) - webView.experimental.findText("bla0", findFlags) - textFoundSpy.wait() - compare(textFoundSpy.count, 1) - compare(matchCount, 10) - for(var i=0; i < 9; i++) { - webView.experimental.findText("bla0", findFlags) - textFoundSpy.wait() - } - compare(textFoundSpy.count, 10) - webView.experimental.findText("bla0", findFlags) - textFoundSpy.wait() - compare(textFoundSpy.count, 11) - compare(findFailed, true) - - webView.clear() - findFlags |= WebViewExperimental.FindBackward - webView.experimental.findText("bla0", findFlags) - textFoundSpy.wait() - compare(textFoundSpy.count, 1) - } - function test_findTextFailNoWrap() { - var findFlags = WebViewExperimental.FindHighlightAllOccurrences - webView.clear() - webView.url = Qt.resolvedUrl("../common/test4.html") - verify(webView.waitForLoadSucceeded()) - webView.experimental.findText("bla0", findFlags) - textFoundSpy.wait() - compare(textFoundSpy.count, 1) - compare(matchCount, 10) - for(var i=0; i < 9; i++) { - webView.experimental.findText("bla0", findFlags) - textFoundSpy.wait() - } - compare(textFoundSpy.count, 10) - webView.experimental.findText("bla0", findFlags) - textFoundSpy.wait() - compare(textFoundSpy.count, 11) - compare(findFailed, true) - } - function test_findTextWrap() { - var findFlags = WebViewExperimental.FindHighlightAllOccurrences - findFlags |= WebViewExperimental.FindWrapsAroundDocument - webView.clear() - webView.url = Qt.resolvedUrl("../common/test4.html") - verify(webView.waitForLoadSucceeded()) - webView.experimental.findText("bla0", findFlags) - textFoundSpy.wait() - compare(textFoundSpy.count, 1) - compare(matchCount, 10) - for(var i=0; i < 19; i++) { - webView.experimental.findText("bla0", findFlags) - textFoundSpy.wait() - } - compare(textFoundSpy.count, 20) - } - function test_findTextFailCaseSensitive() { - var findFlags = WebViewExperimental.FindCaseSensitively - webView.clear() - webView.url = Qt.resolvedUrl("../common/test1.html") - verify(webView.waitForLoadSucceeded()) - webView.experimental.findText("heLLo", findFlags) - textFoundSpy.wait() - compare(textFoundSpy.count, 1) - compare(findFailed, true) - } - function test_findTextNotFound() { - webView.clear() - webView.url = Qt.resolvedUrl("../common/test1.html") - verify(webView.waitForLoadSucceeded()) - webView.experimental.findText("string-that-is-not-threre") - textFoundSpy.wait() - compare(textFoundSpy.count, 1) - compare(findFailed, true) - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_fitToView.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_fitToView.qml deleted file mode 100644 index 01192a8af..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_fitToView.qml +++ /dev/null @@ -1,131 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 -import Test 1.0 -import "../common" - -Item { - TestWebView { - id: webView - width: 480 - height: 720 - - property variant result - - property variant content: "data:text/html," + - "<head>" + - " <meta name='viewport' content='width=device-width'>" + - "</head>" + - "<body style='margin: 0px'>" + - " <div id='target' style='display:none; width:960px; height:1440px;'></div>" + - "</body>" - - signal resultReceived - } - - SignalSpy { - id: resultSpy - target: webView - signalName: "resultReceived" - } - - SignalSpy { - id: scaleSpy - target: webView.experimental.test - signalName: "contentsScaleCommitted" - } - - TestCase { - name: "FitToView" - when: windowShown - - property variant test: webView.experimental.test - - function init() { - resultSpy.clear() - scaleSpy.clear() - } - - function run(signalSpy, script) { - signalSpy.clear(); - var result; - webView.experimental.evaluateJavaScript( - script, function(value) { webView.resultReceived(); result = value }); - signalSpy.wait(); - return result; - } - - function documentSize() { - return run(resultSpy, "document.width + 'x' + document.height"); - } - - function setDisplay(id, value) { - // When changing to/from 'none' to 'block', this will result in a - // contentsScaleCommitted scale, even if it results in the same - // scale, making it possible to check whether user interaction - // blocks fit-to-view or not. - run(scaleSpy, "document.getElementById('" + id + "').style.display = '" + value + "';"); - } - - function test_basic() { - webView.url = webView.content - verify(webView.waitForViewportReady()) - - compare(documentSize(), "480x720") - compare(test.contentsScale, 1.0) - - setDisplay("target", "block") - compare(documentSize(), "960x1440") - compare(test.contentsScale, 0.5) - - // Add user interaction. - test.touchTap(webView, 10, 10) - - // We are no longer within valid bounds after this change - // so we have to change our scale back to 1.0. - setDisplay("target", "none") - compare(documentSize(), "480x720") - compare(test.contentsScale, 1.0) - - // We had user interaction, size should change but not scale. - setDisplay("target", "block") - compare(documentSize(), "960x1440") - compare(test.contentsScale, 1.0) - } - - function test_localPageDeviceWidth() { - webView.url = "about:blank" - verify(webView.waitForLoadSucceeded()) - - webView.url = "../common/test5.html" - verify(webView.waitForLoadSucceeded()) - compare(test.contentsScale, 0.5) - - // Add user interaction. - test.touchTap(webView, 10, 10) - - webView.reload() - verify(webView.waitForLoadSucceeded()) - // The page should still fit to view after a reload - compare(test.contentsScale, 0.5) - } - - function test_localPageInitialScale() { - webView.url = "about:blank" - verify(webView.waitForLoadSucceeded()) - - webView.url = "../common/test4.html" - verify(webView.waitForLoadSucceeded()) - - compare(test.contentsScale, 2.0) - - // Add user interaction. - test.touchTap(webView, 10, 10) - - webView.reload() - verify(webView.waitForLoadSucceeded()) - compare(test.contentsScale, 2.0) - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_geopermission.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_geopermission.qml deleted file mode 100644 index 41097bbcf..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_geopermission.qml +++ /dev/null @@ -1,54 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 - -WebView { - id: webView - width: 200 - height: 200 - - property bool expectedPermission: false - - SignalSpy { - id: spy - target: experimental - signalName: "permissionRequested" - } - - experimental.onPermissionRequested: { - //Must be false by default - if (!permission.allow) { - permission.allow = true - } else - console.log("Fail: permission must be set to false") - - if (permission.type == PermissionRequest.Geolocation) { - console.log("Permission is geotype") - } - } - - TestCase { - name: "WebViewGeopermission" - - // Delayed windowShown to workaround problems with Qt5 in debug mode. - when: false - Timer { - running: parent.windowShown - repeat: false - interval: 1 - onTriggered: parent.when = true - } - - function init() { - spy.clear() - } - - function test_permissionRequest() { - compare(spy.count, 0) - webView.url = Qt.resolvedUrl("../common/geolocation.html") - spy.wait() - compare(spy.count, 1) - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_itemSelector.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_itemSelector.qml deleted file mode 100644 index 78ea6f94f..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_itemSelector.qml +++ /dev/null @@ -1,117 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 -import "../common" - -TestWebView { - id: webView - - width: 400 - height: 400 - - property int initialSelection - property int finalSelection - property bool useAcceptDirectly - property bool selectorLoaded - - experimental.itemSelector: Item { - Component.onCompleted: { - if (WebView.view.initialSelection != -1) - model.items.select(WebView.view.initialSelection) - - if (WebView.view.finalSelection == -1) - model.reject() - else { - if (useAcceptDirectly) { - model.accept(WebView.view.finalSelection) - } else { - model.items.select(WebView.view.finalSelection) - model.accept() - } - } - - WebView.view.selectorLoaded = true - } - } - - SignalSpy { - id: titleSpy - target: webView - signalName: "titleChanged" - } - - TestCase { - id: test - name: "WebViewItemSelector" - when: windowShown - - function init() { - webView.initialSelection = -1 - webView.finalSelection = -1 - webView.useAcceptDirectly = false - webView.selectorLoaded = false - webView.url = Qt.resolvedUrl("../common/select.html") - verify(webView.waitForLoadSucceeded()) - titleSpy.clear() - } - - function openItemSelector() { - webView.experimental.test.touchTap(webView, 15, 15) - } - - function test_accept() { - webView.finalSelection = 1 - openItemSelector() - titleSpy.wait() - compare(webView.title, "__closed__") - } - - function test_acceptDirectly() { - webView.finalSelection = 1 - webView.useAcceptDirectly = true - openItemSelector() - titleSpy.wait() - compare(webView.title, "__closed__") - } - - function test_selectFirstThenAccept() { - webView.initialSelection = 1 - webView.finalSelection = 2 - openItemSelector() - titleSpy.wait() - compare(webView.title, "__all__") - } - - function test_selectFirstThenAcceptDirectly() { - webView.initialSelection = 1 - webView.finalSelection = 2 - webView.useAcceptDirectly = true - openItemSelector() - titleSpy.wait() - compare(webView.title, "__all__") - } - - function test_reject() { - openItemSelector() - tryCompare(webView, "selectorLoaded", true) - compare(webView.title, "No new selection was made") - } - - function test_selectFirstThenReject() { - webView.initialSelection = 1 - webView.finalSelection = -1 - openItemSelector() - tryCompare(webView, "selectorLoaded", true) - compare(webView.title, "No new selection was made") - } - - function test_selectWithSize() { - webView.url = Qt.resolvedUrl("../common/selectwithsize.html") - verify(webView.waitForLoadSucceeded()) - titleSpy.clear() - - test_selectFirstThenAcceptDirectly() - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_javaScriptDialogs.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_javaScriptDialogs.qml deleted file mode 100644 index d77933dba..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_javaScriptDialogs.qml +++ /dev/null @@ -1,103 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 -import "../common" - -TestWebView { - id: webView - - property bool modelMessageEqualsMessage: false - property string messageFromAlertDialog: "" - property int confirmCount: 0 - property int promptCount: 0 - - experimental { - alertDialog: Item { - Component.onCompleted: { - // Testing both attached property and id defined in the Component context. - WebView.view.messageFromAlertDialog = message - parent.modelMessageEqualsMessage = Boolean(model.message == message) - model.dismiss() - } - } - - confirmDialog: Item { - Component.onCompleted: { - WebView.view.confirmCount += 1 - if (message == "ACCEPT") - model.accept() - else - model.reject() - } - } - - promptDialog: Item { - Component.onCompleted: { - WebView.view.promptCount += 1 - if (message == "REJECT") - model.reject() - else { - var reversedDefaultValue = defaultValue.split("").reverse().join("") - model.accept(reversedDefaultValue) - } - } - } - } - - TestCase { - id: test - name: "WebViewJavaScriptDialogs" - - function init() { - webView.modelMessageEqualsMessage = false - webView.messageFromAlertDialog = "" - webView.confirmCount = 0 - webView.promptCount = 0 - } - - function test_alert() { - webView.url = Qt.resolvedUrl("../common/alert.html") - verify(webView.waitForLoadSucceeded()) - compare(webView.messageFromAlertDialog, "Hello Qt") - verify(webView.modelMessageEqualsMessage) - } - - function test_alertWithoutDialog() { - webView.experimental.alertDialog = null - webView.url = Qt.resolvedUrl("../common/alert.html") - verify(webView.waitForLoadSucceeded()) - compare(webView.messageFromAlertDialog, "") - } - - function test_confirm() { - webView.url = Qt.resolvedUrl("../common/confirm.html") - verify(webView.waitForLoadSucceeded()) - compare(webView.confirmCount, 2) - compare(webView.title, "ACCEPTED REJECTED") - } - - function test_confirmWithoutDialog() { - webView.experimental.confirmDialog = null - webView.url = Qt.resolvedUrl("../common/confirm.html") - verify(webView.waitForLoadSucceeded()) - compare(webView.confirmCount, 0) - compare(webView.title, "ACCEPTED ACCEPTED") - } - - function test_prompt() { - webView.url = Qt.resolvedUrl("../common/prompt.html") - verify(webView.waitForLoadSucceeded()) - compare(webView.promptCount, 2) - compare(webView.title, "tQ olleH") - } - - function test_promptWithoutDialog() { - webView.experimental.promptDialog = null - webView.url = Qt.resolvedUrl("../common/prompt.html") - verify(webView.waitForLoadSucceeded()) - compare(webView.promptCount, 0) - compare(webView.title, "FAIL") - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadFail.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadFail.qml deleted file mode 100644 index 51c1f7dd0..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadFail.qml +++ /dev/null @@ -1,30 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import "../common" - -TestWebView { - id: webView - width: 400 - height: 300 - - property variant testUrl - - TestCase { - id: test - name: "WebViewLoadFail" - function test_fail() { - testUrl = Qt.resolvedUrl("file_that_does_not_exist.html") - webView.url = testUrl - verify(webView.waitForLoadFailed()) - } - } - - onLoadingChanged: { - if (loadRequest.status == WebView.LoadFailedStatus) { - test.compare(loadRequest.url, testUrl) - test.compare(loadRequest.errorCode, NetworkReply.ContentNotFoundError) - test.compare(loadRequest.errorDomain, WebView.NetworkErrorDomain) - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadHtml.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadHtml.qml deleted file mode 100644 index 297c082e5..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadHtml.qml +++ /dev/null @@ -1,21 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import "../common" - -TestWebView { - id: webView - width: 200 - height: 400 - - TestCase { - name: "WebViewLoadHtml" - - function test_loadProgressAfterLoadHtml() { - compare(webView.loadProgress, 0) - webView.loadHtml("<html><head><title>Test page 1</title></head><body>Hello.</body></html>") - verify(webView.waitForLoadSucceeded()) - compare(webView.loadProgress, 100) - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadProgress.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadProgress.qml deleted file mode 100644 index 2f95ef11d..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadProgress.qml +++ /dev/null @@ -1,22 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import "../common" - -TestWebView { - id: webView - width: 400 - height: 300 - - TestCase { - name: "WebViewLoadProgress" - - function test_loadProgress() { - compare(webView.loadProgress, 0) - webView.url = Qt.resolvedUrl("../common/test1.html") - compare(webView.loadProgress, 0) - verify(webView.waitForLoadSucceeded()) - compare(webView.loadProgress, 100) - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadProgressSignal.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadProgressSignal.qml deleted file mode 100644 index 620686003..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadProgressSignal.qml +++ /dev/null @@ -1,33 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import "../common" - -TestWebView { - id: webView - width: 400 - height: 300 - - SignalSpy { - id: spyProgress - target: webView - signalName: "loadProgressChanged" - } - - TestCase { - name: "WebViewLoadProgressSignal" - - function test_loadProgressSignal() { - compare(spyProgress.count, 0) - compare(webView.loadProgress, 0) - webView.url = Qt.resolvedUrl("../common/test1.html") - spyProgress.wait() - compare(true, webView.loadProgress > -1 && webView.loadProgress < 101) - if (webView.loadProgress > 0 && webView.loadProgress < 100) { - verify(webView.waitForLoadSucceeded()) - spyProgress.wait() - compare(webView.loadProgress, 100) - } - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadUrl.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadUrl.qml deleted file mode 100644 index 0f8f6a1ff..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_loadUrl.qml +++ /dev/null @@ -1,141 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import "../common" - -TestWebView { - id: webView - property variant lastUrl - property bool watchProgress: false - property int numLoadStarted: 0 - property int numLoadSucceeded: 0 - - focus: true - - onLoadProgressChanged: { - if (watchProgress && webView.loadProgress != 100) { - watchProgress = false - url = '' - } - } - - onLoadingChanged: { - if (loadRequest.status == WebView.LoadStartedStatus) - ++numLoadStarted - if (loadRequest.status == WebView.LoadSucceededStatus) - ++numLoadSucceeded - } - - TestCase { - id: test - name: "WebViewLoadUrl" - when: windowShown - - function test_loadIgnoreEmptyUrl() { - var url = Qt.resolvedUrl("../common/test1.html") - - webView.url = url - verify(webView.waitForLoadSucceeded()) - compare(numLoadStarted, 1) - compare(numLoadSucceeded, 1) - compare(webView.url, url) - - lastUrl = webView.url - webView.url = '' - wait(1000) - compare(numLoadStarted, 1) - compare(numLoadSucceeded, 1) - compare(webView.url, lastUrl) - - webView.url = 'about:blank' - verify(webView.waitForLoadSucceeded()) - compare(numLoadStarted, 2) - compare(numLoadSucceeded, 2) - compare(webView.url, 'about:blank') - - // It shouldn't interrupt any ongoing load when an empty url is used. - watchProgress = true - webView.url = url - webView.waitForLoadSucceeded() - compare(numLoadStarted, 3) - compare(numLoadSucceeded, 3) - verify(!watchProgress) - compare(webView.url, url) - } - - function test_urlProperty() { - var url = Qt.resolvedUrl("../common/test1.html") - - webView.url = url - compare(webView.url, url) - verify(webView.waitForLoadSucceeded()) - compare(webView.url, url) - - var bogusSite = "http://www.somesitethatdoesnotexist.abc/" - webView.url = bogusSite - compare(webView.url, bogusSite) - verify(webView.waitForLoadFailed()) - compare(webView.url, bogusSite) - - webView.url = "about:blank" // Reset from previous test - verify(webView.waitForLoadSucceeded()) - - var handleLoadFailed = function(loadRequest) { - if (loadRequest.status == WebView.LoadFailedStatus) { - compare(webView.url, bogusSite) - compare(loadRequest.url, bogusSite) - webView.loadHtml("load failed", bogusSite, bogusSite) - } - } - webView.loadingChanged.connect(handleLoadFailed) - webView.url = bogusSite - compare(webView.url, bogusSite) - verify(webView.waitForLoadSucceeded()) - compare(webView.url, bogusSite) - webView.loadingChanged.disconnect(handleLoadFailed) - - var dataUrl = "data:text/html,foo" - webView.url = dataUrl - compare(webView.url, dataUrl) - - var redirectUrl = Qt.resolvedUrl("../common/redirect.html") - webView.url = redirectUrl - compare(webView.url, redirectUrl) - verify(webView.waitForLoadSucceeded()) - compare(webView.url, redirectUrl) - verify(webView.waitForLoadSucceeded()) - compare(webView.url, url) - - var linkUrl = Qt.resolvedUrl("../common/link.html") - webView.url = linkUrl - compare(webView.url, linkUrl) - verify(webView.waitForLoadSucceeded()) - compare(webView.url, linkUrl) - webView.loadingChanged.connect(function(loadRequest) { - compare(webView.url, loadRequest.url) - compare(webView.url, url) - }) - webView.forceActiveFocus() - keyPress(Qt.Key_Return) // Link is focused - verify(webView.waitForLoadSucceeded()) - compare(webView.url, url) - } - - function test_stopStatus() { - var url = Qt.resolvedUrl("../common/test1.html") - - webView.loadingChanged.connect(function(loadRequest) { - if (loadRequest.status == WebView.LoadStopStatus) { - compare(webView.url, url) - compare(loadRequest.url, url) - } - }) - - webView.url = url - compare(webView.url, url) - webView.stop() - verify(webView.waitForLoadStopped()) - compare(webView.url, url) - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_messaging.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_messaging.qml deleted file mode 100644 index 9f16bb8b6..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_messaging.qml +++ /dev/null @@ -1,89 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 -import "../common" - -Item { - TestWebView { - id: webView - property variant lastMessage - experimental.preferences.navigatorQtObjectEnabled: true - experimental.onMessageReceived: { - lastMessage = message - } - } - - TestWebView { - id: otherWebView - property variant lastMessage - experimental.preferences.navigatorQtObjectEnabled: true - experimental.onMessageReceived: { - lastMessage = message - } - } - - TestWebView { - id: disabledWebView - property bool receivedMessage - experimental.preferences.navigatorQtObjectEnabled: false - experimental.onMessageReceived: { - receivedMessage = true - } - } - - SignalSpy { - id: messageSpy - target: webView.experimental - signalName: "messageReceived" - } - - SignalSpy { - id: otherMessageSpy - target: otherWebView.experimental - signalName: "messageReceived" - } - - TestCase { - name: "WebViewMessaging" - property url testUrl: Qt.resolvedUrl("../common/messaging.html") - - function init() { - messageSpy.clear() - webView.lastMessage = null - otherMessageSpy.clear() - otherWebView.lastMessage = null - } - - function test_basic() { - webView.url = testUrl - verify(webView.waitForLoadSucceeded()) - webView.experimental.postMessage("HELLO") - messageSpy.wait() - compare(webView.lastMessage.data, "OLLEH") - compare(webView.lastMessage.origin.toString(), testUrl.toString()) - } - - function test_twoWebViews() { - webView.url = testUrl - otherWebView.url = testUrl - verify(webView.waitForLoadSucceeded()) - verify(otherWebView.waitForLoadSucceeded()) - webView.experimental.postMessage("FIRST") - otherWebView.experimental.postMessage("SECOND") - messageSpy.wait() - otherMessageSpy.wait() - compare(webView.lastMessage.data, "TSRIF") - compare(otherWebView.lastMessage.data, "DNOCES") - } - - function test_disabled() { - disabledWebView.url = testUrl - verify(!disabledWebView.experimental.preferences.navigatorQtObjectEnabled) - verify(disabledWebView.waitForLoadSucceeded()) - disabledWebView.experimental.postMessage("HI") - wait(1000) - verify(!disabledWebView.receivedMessage) - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_multiFileUpload.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_multiFileUpload.qml deleted file mode 100644 index 15bb0bf7c..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_multiFileUpload.qml +++ /dev/null @@ -1,60 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 -import "../common" - -TestWebView { - id: webView - - width: 400 - height: 400 - - property bool selectFile - - experimental.filePicker: Item { - Component.onCompleted: { - var selectedFiles = ["filename1", "filename2"] - if (selectFile) - model.accept(selectedFiles) - else - model.reject(); - } - } - - SignalSpy { - id: titleSpy - target: webView - signalName: "titleChanged" - } - - TestCase { - id: test - name: "WebViewMultiFilePicker" - when: windowShown - - function init() { - webView.url = Qt.resolvedUrl("../common/multifileupload.html") - verify(webView.waitForLoadSucceeded()) - titleSpy.clear() - } - - function openItemSelector() { - webView.experimental.test.touchTap(webView, 15, 15) - } - - function test_accept() { - webView.selectFile = true; - openItemSelector() - titleSpy.wait() - compare(webView.title, "filename1,filename2") - } - - function test_reject() { - var oldTitle = webView.title - webView.selectFile = false; - openItemSelector() - compare(webView.title, oldTitle) - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_navigationHistory.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_navigationHistory.qml deleted file mode 100644 index 3b51c9cc1..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_navigationHistory.qml +++ /dev/null @@ -1,95 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 -import "../common" - -TestWebView { - id: webView - width: 400 - height: 300 - - ListView { - id: backItemsList - anchors.fill: parent - model: webView.experimental.navigationHistory.backItems - delegate: - Text { - color:"black" - text: "title : " + title - } - } - - ListView { - id: forwardItemsList - anchors.fill: parent - model: webView.experimental.navigationHistory.forwardItems - delegate: - Text { - color:"black" - text: "title : " + title - } - } - - TestCase { - name: "WebViewNavigationHistory" - - function test_navigationHistory() { - compare(webView.loadProgress, 0) - webView.url = Qt.resolvedUrl("../common/test1.html") - verify(webView.waitForLoadSucceeded()) - compare(webView.canGoBack, false) - compare(webView.canGoForward, false) - compare(backItemsList.count, 0) - compare(forwardItemsList.count, 0) - webView.url = Qt.resolvedUrl("../common/test2.html") - verify(webView.waitForLoadSucceeded()) - compare(webView.url, Qt.resolvedUrl("../common/test2.html")) - compare(webView.canGoBack, true) - compare(webView.canGoForward, false) - compare(backItemsList.count, 1) - webView.experimental.goBackTo(0) - verify(webView.waitForLoadSucceeded()) - compare(webView.url, Qt.resolvedUrl("../common/test1.html")) - compare(webView.canGoBack, false) - compare(webView.canGoForward, true) - compare(backItemsList.count, 0) - compare(forwardItemsList.count, 1) - webView.goForward() - verify(webView.waitForLoadSucceeded()) - compare(webView.url, Qt.resolvedUrl("../common/test2.html")) - compare(webView.canGoBack, true) - compare(webView.canGoForward, false) - compare(backItemsList.count, 1) - compare(forwardItemsList.count, 0) - webView.url = Qt.resolvedUrl("../common/javascript.html") - verify(webView.waitForLoadSucceeded()) - compare(webView.url, Qt.resolvedUrl("../common/javascript.html")) - compare(webView.canGoBack, true) - compare(webView.canGoForward, false) - compare(backItemsList.count, 2) - compare(forwardItemsList.count, 0) - webView.experimental.goBackTo(1) - verify(webView.waitForLoadSucceeded()) - compare(webView.url, Qt.resolvedUrl("../common/test1.html")) - compare(webView.canGoBack, false) - compare(webView.canGoForward, true) - compare(backItemsList.count, 0) - compare(forwardItemsList.count, 2) - webView.experimental.goForwardTo(1) - verify(webView.waitForLoadSucceeded()) - compare(webView.url, Qt.resolvedUrl("../common/javascript.html")) - compare(webView.canGoBack, true) - compare(webView.canGoForward, false) - compare(backItemsList.count, 2) - compare(forwardItemsList.count, 0) - webView.goBack() - verify(webView.waitForLoadSucceeded()) - compare(webView.url, Qt.resolvedUrl("../common/test2.html")) - compare(webView.canGoBack, true) - compare(webView.canGoForward, true) - compare(backItemsList.count, 1) - compare(forwardItemsList.count, 1) - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_notification.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_notification.qml deleted file mode 100644 index aa432f60c..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_notification.qml +++ /dev/null @@ -1,55 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 - -WebView { - id: webView - width: 200 - height: 200 - - property bool expectedPermission: false - - SignalSpy { - id: spy - target: experimental - signalName: "permissionRequested" - } - - experimental.onPermissionRequested: { - // Must be false by default - if (!permission.allow) { - permission.allow = true - } else { - console.log("Fail: permission must be set to false") - } - - if (permission.type == PermissionRequest.Notification) { - console.log("Permission is Desktop Notification") - } - } - - TestCase { - name: "WebViewDesktopNotificationPermission" - - // Delayed windowShown to workaround problems with Qt5 in debug mode. - when: false - Timer { - running: parent.windowShown - repeat: false - interval: 1 - onTriggered: parent.when = true - } - - function init() { - spy.clear() - } - - function test_permissionRequest() { - compare(spy.count, 0) - webView.url = Qt.resolvedUrl("../common/notification.html") - spy.wait() - compare(spy.count, 1) - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_origin.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_origin.qml deleted file mode 100644 index 660ca7326..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_origin.qml +++ /dev/null @@ -1,57 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 - -WebView { - id: webView - width: 200 - height: 200 - - property bool success: true - property int port: 0 - property string scheme: "file" - - SignalSpy { - id: spy - target: experimental - signalName: "permissionRequested" - } - - experimental.onPermissionRequested: { - if (permission.origin.port != webView.port) { - console.log("Expected port value should be zero.") - webView.success = false - } - - if (permission.origin.scheme != webView.scheme) { - console.log("Expected scheme should be \"file\".") - webView.success = false - } - } - - TestCase { - name: "WebViewSecurityOrigin" - - // Delayed windowShown to workaround problems with Qt5 in debug mode. - when: false - Timer { - running: parent.windowShown - repeat: false - interval: 1 - onTriggered: parent.when = true - } - - function init() { - spy.clear() - } - - function test_permissionRequest() { - compare(spy.count, 0) - webView.url = Qt.resolvedUrl("../common/geolocation.html") - spy.wait() - compare(spy.count, 1) - compare(webView.success, true) - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_preferences.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_preferences.qml deleted file mode 100644 index 71fa3eb9b..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_preferences.qml +++ /dev/null @@ -1,337 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 -import "../common" - -Item { - TestWebView { - id: webView - width: 400 - height: 300 - - experimental.preferences.javascriptEnabled: true - experimental.preferences.localStorageEnabled: true - experimental.preferences.pluginsEnabled: true - - TestWebView { - id: webView2 - width: 400 - height: 300 - } - - SignalSpy { - id: titleSpy - target: webView - signalName: "titleChanged" - } - - SignalSpy { - id: standardFontFamilySpy - target: webView.experimental.preferences - signalName: "standardFontFamilyChanged" - } - - SignalSpy { - id: fixedFontFamilySpy - target: webView.experimental.preferences - signalName: "fixedFontFamilyChanged" - } - - SignalSpy { - id: serifFontFamilySpy - target: webView.experimental.preferences - signalName: "serifFontFamilyChanged" - } - - SignalSpy { - id: sansSerifFontFamilySpy - target: webView.experimental.preferences - signalName: "sansSerifFontFamilyChanged" - } - - SignalSpy { - id: cursiveFontFamilySpy - target: webView.experimental.preferences - signalName: "cursiveFontFamilyChanged" - } - - SignalSpy { - id: fantasyFontFamilySpy - target: webView.experimental.preferences - signalName: "fantasyFontFamilyChanged" - } - - SignalSpy { - id: minimumFontSizeSpy - target: webView.experimental.preferences - signalName: "minimumFontSizeChanged" - } - - SignalSpy { - id: defaultFontSizeSpy - target: webView.experimental.preferences - signalName: "defaultFontSizeChanged" - } - - SignalSpy { - id: defaultFixedFontSizeSpy - target: webView.experimental.preferences - signalName: "defaultFixedFontSizeChanged" - } - - TestCase { - name: "WebViewPreferences" - - property bool shouldSetupFonts: true - property string defaultStandardFontFamily - property string defaultFixedFontFamily - property string defaultSerifFontFamily - property string defaultSansSerifFontFamily - property string defaultCursiveFontFamily - property string defaultFantasyFontFamily - property int defaultMinimumFontSize - property int defaultFontSize - property int defaultFixedFontSize - - function init() { - if (shouldSetupFonts) { - // Setup initial values (may be different per platform). - shouldSetupFonts = false - defaultStandardFontFamily = webView.experimental.preferences.standardFontFamily - defaultFixedFontFamily = webView.experimental.preferences.fixedFontFamily - defaultSerifFontFamily = webView.experimental.preferences.serifFontFamily - defaultSansSerifFontFamily = webView.experimental.preferences.sansSerifFontFamily - defaultCursiveFontFamily = webView.experimental.preferences.cursiveFontFamily - defaultFantasyFontFamily = webView.experimental.preferences.fantasyFontFamily - defaultMinimumFontSize = webView.experimental.preferences.minimumFontSize - defaultFontSize = webView.experimental.preferences.defaultFontSize - defaultFixedFontSize = webView.experimental.preferences.defaultFixedFontSize - } - else { - // Restore default values before starting a new test case. - webView.experimental.preferences.standardFontFamily = defaultStandardFontFamily - webView.experimental.preferences.fixedFontFamily = defaultFixedFontFamily - webView.experimental.preferences.serifFontFamily = defaultSerifFontFamily - webView.experimental.preferences.sansSerifFontFamily = defaultSansSerifFontFamily - webView.experimental.preferences.cursiveFontFamily = defaultCursiveFontFamily - webView.experimental.preferences.fantasyFontFamily = defaultFantasyFontFamily - webView.experimental.preferences.minimumFontSize = defaultMinimumFontSize - webView.experimental.preferences.defaultFontSize = defaultFontSize - webView.experimental.preferences.defaultFixedFontSize = defaultFixedFontSize - - if (webView.url != '' && webView.url != 'about:blank') { - webView.url = 'about:blank' - verify(webView.waitForLoadSucceeded()) - } - - standardFontFamilySpy.clear() - fixedFontFamilySpy.clear() - serifFontFamilySpy.clear() - sansSerifFontFamilySpy.clear() - cursiveFontFamilySpy.clear() - fantasyFontFamilySpy.clear() - minimumFontSizeSpy.clear() - defaultFontSizeSpy.clear() - defaultFixedFontSizeSpy.clear() - } - - webView.experimental.preferences.javascriptEnabled = true - webView.experimental.preferences.localStorageEnabled = true - webView.experimental.preferences.pluginsEnabled = true - titleSpy.clear() - } - - function test_javascriptEnabled() { - webView.experimental.preferences.javascriptEnabled = true - var testUrl = Qt.resolvedUrl("../common/javascript.html") - webView.url = testUrl - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "New Title") - } - - function test_javascriptDisabled() { - webView.experimental.preferences.javascriptEnabled = false - var testUrl = Qt.resolvedUrl("../common/javascript.html") - webView.url = testUrl - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "Original Title") - } - - function test_localStorageDisabled() { - webView.experimental.preferences.localStorageEnabled = false - var testUrl = Qt.resolvedUrl("../common/localStorage.html") - webView.url = testUrl - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "Original Title") - } - - function test_localStorageEnabled() { - webView.experimental.preferences.localStorageEnabled = true - var testUrl = Qt.resolvedUrl("../common/localStorage.html") - webView.url = testUrl - verify(webView.waitForLoadSucceeded()) - webView.url = testUrl - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "New Title") - } - - function test_preferencesAffectCurrentViewOnly() { - webView.experimental.preferences.javascriptEnabled = true - webView2.experimental.preferences.javascriptEnabled = true - var testUrl = Qt.resolvedUrl("../common/javascript.html") - webView.url = testUrl - verify(webView.waitForLoadSucceeded()) - webView2.url = testUrl - verify(webView2.waitForLoadSucceeded()) - compare(webView.title, "New Title") - compare(webView2.title, "New Title") - webView.experimental.preferences.javascriptEnabled = false - webView.url = testUrl - verify(webView.waitForLoadSucceeded()) - webView2.url = testUrl - verify(webView2.waitForLoadSucceeded()) - compare(webView.title, "Original Title") - compare(webView2.title, "New Title") - } - - function unquote(text) { - return text[0] === "'" ? text.slice(1, -1) : text - } - - function test_standardFontFamilyChanged() { - var url = Qt.resolvedUrl("../common/font-preferences.html?standard#font-family") - webView.url = url - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "Original Title") - titleSpy.clear() - - titleSpy.wait() - compare(unquote(webView.title), defaultStandardFontFamily) - - webView.experimental.preferences.standardFontFamily = "foobar" - standardFontFamilySpy.wait() - compare(standardFontFamilySpy.count, 1) - webView.url = url - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "Original Title") - titleSpy.clear() - - titleSpy.wait() - compare(webView.title, "foobar") - } - - function test_fontSizeChanged() { - var url = Qt.resolvedUrl("../common/font-preferences.html?standard#font-size") - webView.url = url - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "Original Title") - titleSpy.clear() - - titleSpy.wait() - compare(webView.title, defaultFontSize.toString() + "px") - - webView.experimental.preferences.defaultFontSize = defaultFontSize + 1 - defaultFontSizeSpy.wait() - compare(defaultFontSizeSpy.count, 1) - webView.url = url - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "Original Title") - titleSpy.clear() - - titleSpy.wait() - compare(webView.title, (defaultFontSize + 1).toString() + "px") - } - - function test_fixedFontSizeChanged() { - var url = Qt.resolvedUrl("../common/font-preferences.html?fixed#font-size") - webView.url = url - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "Original Title") - titleSpy.clear() - - titleSpy.wait() - compare(webView.title, defaultFixedFontSize.toString() + "px") - - webView.experimental.preferences.defaultFixedFontSize = defaultFixedFontSize + 1 - defaultFixedFontSizeSpy.wait() - compare(defaultFixedFontSizeSpy.count, 1) - webView.url = url - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "Original Title") - titleSpy.clear() - - titleSpy.wait() - compare(webView.title, (defaultFixedFontSize + 1).toString() + "px") - - webView.url = Qt.resolvedUrl("../common/font-preferences.html?standard#font-size") - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "Original Title") - titleSpy.clear() - - titleSpy.wait() - compare(webView.title, defaultFontSize.toString() + "px") - } - - function test_minimumFontSizeChanged() { - verify(defaultMinimumFontSize < defaultFontSize) - var url = Qt.resolvedUrl("../common/font-preferences.html?minimum#font-size") - webView.url = url - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "Original Title") - titleSpy.clear() - - titleSpy.wait() - var smallerFontSize = webView.title - smallerFontSize = smallerFontSize.substring(0, smallerFontSize.length - 2) - smallerFontSize = parseInt(smallerFontSize) - verify(smallerFontSize < defaultFontSize) - - webView.experimental.preferences.minimumFontSize = defaultFontSize - minimumFontSizeSpy.wait() - compare(minimumFontSizeSpy.count, 1) - webView.url = url - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "Original Title") - titleSpy.clear() - - titleSpy.wait() - compare(webView.title, defaultFontSize.toString() + "px") - } - - function test_defaultFontsChanged() { - // As there's currently no way to test through JS if a generic font was indeed changed - // we keep this test for really basic coverage. - - webView.experimental.preferences.standardFontFamily = "foobar0" - standardFontFamilySpy.wait() - webView.experimental.preferences.fixedFontFamily = "foobar1" - fixedFontFamilySpy.wait() - webView.experimental.preferences.serifFontFamily = "foobar2" - serifFontFamilySpy.wait() - webView.experimental.preferences.sansSerifFontFamily = "foobar3" - sansSerifFontFamilySpy.wait() - webView.experimental.preferences.cursiveFontFamily = "foobar4" - cursiveFontFamilySpy.wait() - webView.experimental.preferences.fantasyFontFamily = "foobar5" - fantasyFontFamilySpy.wait() - - compare(standardFontFamilySpy.count, 1) - compare(fixedFontFamilySpy.count, 1) - compare(serifFontFamilySpy.count, 1) - compare(sansSerifFontFamilySpy.count, 1) - compare(cursiveFontFamilySpy.count, 1) - compare(fantasyFontFamilySpy.count, 1) - - compare(webView.experimental.preferences.standardFontFamily, "foobar0") - compare(webView.experimental.preferences.fixedFontFamily, "foobar1") - compare(webView.experimental.preferences.serifFontFamily, "foobar2") - compare(webView.experimental.preferences.sansSerifFontFamily, "foobar3") - compare(webView.experimental.preferences.cursiveFontFamily, "foobar4") - compare(webView.experimental.preferences.fantasyFontFamily, "foobar5") - } - - - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_properties.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_properties.qml deleted file mode 100644 index 036ee9d86..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_properties.qml +++ /dev/null @@ -1,27 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import "../common" - -TestWebView { - id: webView - width: 400 - height: 300 - - TestCase { - name: "WebViewProperties" - - function test_title() { - webView.url = Qt.resolvedUrl("../common/test1.html") - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "Test page 1") - } - - function test_url() { - var testUrl = Qt.resolvedUrl("../common/test1.html") - webView.url = testUrl - verify(webView.waitForLoadSucceeded()) - compare(webView.url, testUrl) - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_resize.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_resize.qml deleted file mode 100644 index dea000868..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_resize.qml +++ /dev/null @@ -1,175 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 -import Test 1.0 -import "../common" - -Item { - TestWebView { - id: webView - width: 320 - height: 480 - - property variant result - - property variant content: "data:text/html," + - "<head>" + - " <meta name='viewport' content='width=device-width'>" + - "</head>" + - "<body>" + - " <div id='target' style='width: 240px; height: 360px;'>" + - " </div>" + - "</body>" - - signal resultReceived - } - - SignalSpy { - id: resultSpy - target: webView - signalName: "resultReceived" - } - - SignalSpy { - id: scaleSpy - target: webView.experimental.test - signalName: "contentsScaleCommitted" - } - - SignalSpy { - id: sizeSpy - target: webView.experimental.test - signalName: "contentsSizeChanged" - } - - TestCase { - name: "Resize" - when: windowShown - - property variant test: webView.experimental.test - - function init() { - resultSpy.clear() - scaleSpy.clear() - sizeSpy.clear() - } - - function run(signalSpy, script) { - signalSpy.clear(); - var result; - webView.experimental.evaluateJavaScript( - script, - function(value) { webView.resultReceived(); result = value }); - signalSpy.wait(); - return result; - } - - function contentsSize() { - return test.contentsSize.width + "x" + test.contentsSize.height; - } - - function elementRect(id) { - return JSON.parse(run(resultSpy, "JSON.stringify(document.getElementById('" + id + "').getBoundingClientRect());")) - } - - function doubleTapAtPoint(x, y) { - scaleSpy.clear() - test.touchDoubleTap(webView, x, y) - scaleSpy.wait() - } - - function resize(w, h) { - sizeSpy.clear() - webView.width = w - sizeSpy.wait() - webView.height = h - sizeSpy.wait() - } - - function test_basic() { - webView.url = webView.content - verify(webView.waitForViewportReady()) - - compare(contentsSize(), "320x480") - compare(test.contentsScale, 1.0) - - resize(480, 720) - compare(contentsSize(), "480x720") - compare(test.contentsScale, 1.0) - - resize(320, 480) - compare(contentsSize(), "320x480") - compare(test.contentsScale, 1.0) - - } - - function test_resizeAfterNeutralZoom() { - webView.url = webView.content - verify(webView.waitForViewportReady()) - - compare(contentsSize(), "320x480") - compare(test.contentsScale, 1.0) - - var target = elementRect("target"); - var targetScale = webView.width / (target.width + 2 * 10) // inflated by 10px - - // Zoom in and out. - doubleTapAtPoint(100, 50) - - compare(test.contentsScale, targetScale) - - doubleTapAtPoint(100, 50) - - compare(test.contentsScale, 1.0) - - // Now check resizing still works as expected. - resize(480, 720) - compare(contentsSize(), "480x720") - compare(test.contentsScale, 1.0) - - resize(320, 480) - compare(contentsSize(), "320x480") - compare(test.contentsScale, 1.0) - } - - function test_resizeZoomedIn() { - // Note that if we change the behavior of resize on zoomed-in content, for instance - // to preserve the visible width (like rotate), this test will need to be updated. - webView.url = webView.content - verify(webView.waitForViewportReady()) - - compare(contentsSize(), "320x480") - compare(test.contentsScale, 1.0) - - var target = elementRect("target"); - var targetScale = webView.width / (target.width + 2 * 10) // inflated by 10px - - // Double tap to zoom in. - doubleTapAtPoint(100, 50) - - compare(test.contentsScale, targetScale) - - // Resize just a small bit, not changing scale. - resize(288, 432) - compare(contentsSize(), "288x432") - compare(test.contentsScale, targetScale) - - // And double tap to reset zoom. - target = elementRect("target"); - targetScale = webView.width / (target.width + 2 * 10) - doubleTapAtPoint(100, 50) - compare(test.contentsScale, targetScale) - - // Double tap again to zoom out. - doubleTapAtPoint(100, 50) - compare(contentsSize(), "288x432") - compare(test.contentsScale, 1.0) - - // And reset - resize(320, 480) - compare(contentsSize(), "320x480") - compare(test.contentsScale, 1.0) - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_singleFileUpload.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_singleFileUpload.qml deleted file mode 100644 index 30514a3b6..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_singleFileUpload.qml +++ /dev/null @@ -1,84 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 -import "../common" - -TestWebView { - id: webView - - width: 400 - height: 400 - - property bool selectFile - property bool returnEmpty: false - property bool acceptMultiple: false - - experimental.filePicker: Item { - Component.onCompleted: { - if (returnEmpty) - model.accept(""); - else if (selectFile) { - var selectedFiles = ["filename1", "filename2"]; - if (acceptMultiple) - model.accept(selectedFiles); - else - model.accept("acceptedfilename"); - } else - model.reject(); - } - } - - SignalSpy { - id: titleSpy - target: webView - signalName: "titleChanged" - } - - TestCase { - id: test - name: "WebViewSingleFilePicker" - when: windowShown - - function init() { - webView.url = Qt.resolvedUrl("../common/singlefileupload.html") - verify(webView.waitForLoadSucceeded()) - titleSpy.clear() - } - - function openItemSelector() { - webView.experimental.test.touchTap(webView, 15, 15) - } - - function test_accept() { - webView.selectFile = true; - openItemSelector() - titleSpy.wait() - compare(webView.title, "acceptedfilename") - } - - function test_multiple() { - webView.selectFile = true; - webView.returnEmpty = false; - webView.acceptMultiple = true; - openItemSelector() - titleSpy.wait() - compare(webView.title, "filename1") - } - - function test_rejectIfEmptyAccept() { - var oldTitle = webView.title - webView.selectFile = false; - webView.returnEmpty = true; - openItemSelector() - compare(webView.title, oldTitle) - } - - function test_reject() { - var oldTitle = webView.title - webView.selectFile = false; - openItemSelector() - compare(webView.title, oldTitle) - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_titleChanged.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_titleChanged.qml deleted file mode 100644 index 38e587d57..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_titleChanged.qml +++ /dev/null @@ -1,32 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import "../common" - -TestWebView { - id: webView - width: 400 - height: 300 - - SignalSpy { - id: spyTitle - target: webView - signalName: "titleChanged" - } - - TestCase { - name: "WebViewTitleChangedSignal" - - function test_titleFirstLoad() { - compare(spyTitle.count, 0) - var testUrl = Qt.resolvedUrl("../common/test3.html") - webView.url = testUrl - verify(webView.waitForLoadSucceeded()) - compare(webView.title, "Test page 3") - spyTitle.clear() - - spyTitle.wait() - compare(webView.title, "New Title") - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_userScripts.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_userScripts.qml deleted file mode 100644 index 3d15aca05..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_userScripts.qml +++ /dev/null @@ -1,113 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 -import "../common" - -Item { - TestWebView { - id: webView - width: 400 - height: 300 - } - - TestWebView { - id: webViewWithConditionalUserScripts - width: 400 - height: 300 - - onNavigationRequested: { - var urlString = request.url.toString(); - if (urlString.indexOf("test1.html") !== -1) - experimental.userScripts = [Qt.resolvedUrl("../common/change-document-title.js")]; - else if (urlString.indexOf("test2.html") !== -1) - experimental.userScripts = [Qt.resolvedUrl("../common/append-document-title.js")]; - else - experimental.userScripts = []; - } - } - - TestCase { - name: "WebViewUserScripts" - - function init() { - webView.url = ""; - webView.experimental.userScripts = []; - } - - function test_oneScript() { - webView.url = Qt.resolvedUrl("../common/test1.html"); - webView.waitForLoadSucceeded(); - compare(webView.title, "Test page 1"); - - webView.experimental.userScripts = [Qt.resolvedUrl("../common/change-document-title.js")]; - compare(webView.title, "Test page 1"); - - webView.reload(); - webView.waitForLoadSucceeded(); - compare(webView.title, "New title"); - - webView.url = Qt.resolvedUrl("../common/test2.html"); - webView.waitForLoadSucceeded(); - compare(webView.title, "New title"); - - webView.experimental.userScripts = []; - compare(webView.title, "New title"); - - webView.reload(); - webView.waitForLoadSucceeded(); - compare(webView.title, "Test page with huge link area"); - } - - function test_twoScripts() { - webView.url = Qt.resolvedUrl("../common/test1.html"); - webView.waitForLoadSucceeded(); - compare(webView.title, "Test page 1"); - - webView.experimental.userScripts = [Qt.resolvedUrl("../common/change-document-title.js"), Qt.resolvedUrl("../common/append-document-title.js")]; - webView.reload(); - webView.waitForLoadSucceeded(); - compare(webView.title, "New title with appendix"); - - // Make sure we can remove scripts from the preload list. - webView.experimental.userScripts = [Qt.resolvedUrl("../common/append-document-title.js")]; - webView.reload(); - webView.waitForLoadSucceeded(); - compare(webView.title, "Test page 1 with appendix"); - - // Make sure the scripts are loaded in order. - webView.experimental.userScripts = [Qt.resolvedUrl("../common/append-document-title.js"), Qt.resolvedUrl("../common/change-document-title.js")]; - webView.reload(); - webView.waitForLoadSucceeded(); - compare(webView.title, "New title"); - } - - function test_setUserScriptsConditionally() { - webViewWithConditionalUserScripts.url = Qt.resolvedUrl("../common/test1.html"); - webViewWithConditionalUserScripts.waitForLoadSucceeded(); - compare(webViewWithConditionalUserScripts.title, "New title"); - - webViewWithConditionalUserScripts.url = Qt.resolvedUrl("../common/test2.html"); - webViewWithConditionalUserScripts.waitForLoadSucceeded(); - compare(webViewWithConditionalUserScripts.title, "Test page with huge link area with appendix"); - - webViewWithConditionalUserScripts.url = Qt.resolvedUrl("../common/test3.html"); - webViewWithConditionalUserScripts.waitForLoadSucceeded(); - compare(webViewWithConditionalUserScripts.title, "Test page 3"); - } - - function test_bigScript() { - webView.experimental.userScripts = [Qt.resolvedUrl("../common/big-user-script.js")]; - webView.url = Qt.resolvedUrl("../common/test1.html"); - webView.waitForLoadSucceeded(); - compare(webView.title, "Big user script changed title"); - } - - function test_fromResourceFile() { - webView.experimental.userScripts = ["qrc:///common/change-document-title.js"]; - webView.url = Qt.resolvedUrl("../common/test1.html"); - webView.waitForLoadSucceeded(); - compare(webView.title, "New title"); - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_webchannel.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_webchannel.qml deleted file mode 100644 index dfdcf7add..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_webchannel.qml +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Milian Wolff <milian.wolff@kdab.com> -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtWebChannel module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 -import "../common" - -import QtWebChannel 1.0 - -Item { - id: test - signal barCalled(var arg) - signal clientInitializedCalled(var arg) - - QtObject { - id: testObject - WebChannel.id: "testObject" - - property var foo: 42 - - function clientInitialized(arg) - { - clientInitializedCalled(arg); - } - - function bar(arg) { - barCalled(arg); - } - - signal runTest(var foo) - } - - TestWebView { - id: webView - experimental.webChannel.registeredObjects: [testObject] - experimental.preferences.developerExtrasEnabled: true - } - - SignalSpy { - id: initializedSpy - target: test - signalName: "clientInitializedCalled" - } - - SignalSpy { - id: barSpy - target: test - signalName: "barCalled" - } - - TestCase { - name: "WebViewWebChannel" - property url testUrl: Qt.resolvedUrl("../common/webchannel.html") - - function init() { - initializedSpy.clear(); - barSpy.clear(); - } - - function test_basic() { - webView.url = testUrl; - verify(webView.waitForLoadSucceeded()); - - initializedSpy.wait(); - compare(initializedSpy.signalArguments.length, 1); - compare(initializedSpy.signalArguments[0][0], 42); - - var newValue = "roundtrip"; - testObject.runTest(newValue); - barSpy.wait(); - compare(barSpy.signalArguments.length, 1); - compare(barSpy.signalArguments[0][0], newValue); - - compare(testObject.foo, newValue); - } - } -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_wheelEventHandling.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_wheelEventHandling.qml deleted file mode 100644 index aa6d711a1..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_wheelEventHandling.qml +++ /dev/null @@ -1,58 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 -import Test 1.0 -import "../common" - -Item { - TestWebView { - id: webView - width: 800 - height: 600 - url: Qt.resolvedUrl("../common/test4.html") - } - - SignalSpy { - id: scrollSpy - target: webView - signalName: "contentYChanged" - } - - TestCase { - name: "WheelEventHandling" - when: windowShown - - property variant test: webView.experimental.test - - function init() { - webView.url = Qt.resolvedUrl("../common/test4.html") - verify(webView.waitForViewportReady()) - webView.contentY = 0 - } - - function test_wheelScrollEvent() { - scrollSpy.clear() - var centerPoint = Qt.point(webView.width / 2, webView.height / 2) - test.wheelEvent(webView, centerPoint.x, centerPoint.y, -500); - // The signal spy below will time out if the wheel event did not scroll the content. - scrollSpy.wait() - var position = webView.contentY - webView.reload() - verify(webView.waitForViewportReady()) - // The check below will fail if the previous position was not restored after reload. - verify(position == webView.contentY) - } - - function test_wheelScrollEventAfterReload() { - scrollSpy.clear() - webView.reload() - verify(webView.waitForViewportReady()) - var centerPoint = Qt.point(webView.width / 2, webView.height / 2) - test.wheelEvent(webView, centerPoint.x, centerPoint.y, -500); - // The signal spy below will time out if the wheel event did not scroll the content. - scrollSpy.wait() - } - } - -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/TestWebView.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/TestWebView.qml deleted file mode 100644 index 5a05f9b3e..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/TestWebView.qml +++ /dev/null @@ -1,51 +0,0 @@ -import QtQuick 2.0 -import QtTest 1.0 -import QtWebKit 3.0 -import QtWebKit.experimental 1.0 - -WebView { - property var loadStatus: null - property var viewportReady: false - - function waitForLoadSucceeded() { - var success = _waitFor(function() { return loadStatus == WebView.LoadSucceededStatus }) - loadStatus = null - return success - } - function waitForViewportReady() { - // Note: You need to have "when: windowShown" in your TestCase for this to work. - // The viewport is locked until the first frame is rendered, and the rendering isn't - // activated until the WebView is visible in a mapped QQuickView. - return _waitFor(function() { return viewportReady }) - } - function waitForLoadFailed() { - var failure = _waitFor(function() { return loadStatus == WebView.LoadFailedStatus }) - loadStatus = null - return failure - } - function waitForLoadStopped() { - var stop = _waitFor(function() { return loadStatus == WebView.LoadStoppedStatus }) - loadStatus = null - return stop - } - function _waitFor(predicate) { - var timeout = 5000 - var i = 0 - while (i < timeout && !predicate()) { - testResult.wait(50) - i += 50 - } - return predicate() - } - - TestResult { id: testResult } - - experimental.onLoadVisuallyCommitted: viewportReady = true - onLoadingChanged: { - loadStatus = loadRequest.status - if (loadRequest.status == WebView.LoadStartedStatus) - viewportReady = false - } - -} - diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/alert.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/alert.html deleted file mode 100644 index a75b9a60f..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/alert.html +++ /dev/null @@ -1,8 +0,0 @@ -<!doctype html> -<html> -<head> -<script>alert("Hello Qt");</script> -</head> -<body> -</body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/append-document-title.js b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/append-document-title.js deleted file mode 100644 index fb4a2a6f2..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/append-document-title.js +++ /dev/null @@ -1 +0,0 @@ -document.title += " with appendix"; diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/big-user-script.js b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/big-user-script.js deleted file mode 100644 index e6e3d2b44..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/big-user-script.js +++ /dev/null @@ -1,110 +0,0 @@ -// Used to make sure serialization of user scripts between UI process and Web process can handle files bigger -// than the maximum message size defined in ConnectionXXX classes. - -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// -// //////////////////////////////////////////////////////////////////////////////////////////////////// - -document.title = "Big user script changed title"; diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/change-document-title.js b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/change-document-title.js deleted file mode 100644 index bdae45c21..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/change-document-title.js +++ /dev/null @@ -1 +0,0 @@ -document.title = "New title"; diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/colorChooser.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/colorChooser.html deleted file mode 100644 index b3254c3b8..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/colorChooser.html +++ /dev/null @@ -1,21 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<title>Title</title> -<script> -function detectInputTypeColorEnabled() { - var element = document.getElementById('test') - element.value = 'should sanitize'; - if (element.value != 'should sanitize') - document.title = 'Feature enabled'; - else - document.title = 'Feature disabled'; -} -function updateTitle(element) { - document.title = element.value; -} -</script> -</head> -<body onload='detectInputTypeColorEnabled()'> -<input id='test' type='color' onclick='updateTitle(this)' onchange='updateTitle(this)' style='width:50px; height:50px; position:"absolute"; top:0px; left:0px'> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/confirm.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/confirm.html deleted file mode 100644 index 5dd6081d4..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/confirm.html +++ /dev/null @@ -1,19 +0,0 @@ -<!doctype html> -<html> -<head> -<script> -document.title = ""; -function updateTitle(accepted) { - if (accepted) - document.title += " ACCEPTED"; - else - document.title += " REJECTED"; -} - -updateTitle(confirm("ACCEPT")); -updateTitle(confirm("REJECT")); -</script> -</head> -<body> -</body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/download.zip b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/download.zip Binary files differdeleted file mode 100644 index b5456351a..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/download.zip +++ /dev/null diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/evaluatejavascript.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/evaluatejavascript.html deleted file mode 100644 index 023e9ab7f..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/evaluatejavascript.html +++ /dev/null @@ -1,10 +0,0 @@ -<!doctype html> -<html> - <head> - <meta charset="UTF-8"> - <title>Evaluate JavaScript</title> - </head> - <body> - <div id="text">Hello from the WebProcess :-)</div> - </body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/favicon.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/favicon.html deleted file mode 100644 index c9f225c52..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/favicon.html +++ /dev/null @@ -1,10 +0,0 @@ -<html> -<head> -</head> -<link type="image/png" href="favicon.png" sizes="48x48" rel="icon" /> -<body> -<p>It's expected that you see a favicon displayed for this page when you open it as a local file.</p> -<p>The favicon looks like this:</p> -<img src="favicon.png"/> -</body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/favicon.png b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/favicon.png Binary files differdeleted file mode 100644 index 35717cca5..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/favicon.png +++ /dev/null diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/favicon2.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/favicon2.html deleted file mode 100644 index 5548b867f..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/favicon2.html +++ /dev/null @@ -1,10 +0,0 @@ -<html> -<head> -</head> -<link type="image/png" href="small-favicon.png" sizes="16x16" rel="icon" /> -<body> -<p>It's expected that you see a favicon displayed for this page when you open it as a local file.</p> -<p>The favicon looks like this:</p> -<img src="small-favicon.png"/> -</body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/font-preferences.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/font-preferences.html deleted file mode 100644 index cbc11432d..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/font-preferences.html +++ /dev/null @@ -1,31 +0,0 @@ -<html> -<head> -<title>Original Title</title> -</head> -<script type="text/javascript"> -function getTestId() { - url = document.location.href - var i, j = 0; - for (i = url.length - 1; i >= 0; --i) { - if (url[i] == '?') - break - else if (url[i] == '#') - j = i - 1 - } - return url.substr(i + 1, j - i) -} - -function getStyleForId(id, styleProp) { - return document.defaultView.getComputedStyle(document.getElementById(id), null).getPropertyValue(styleProp); -} - -function changeTitle() { - document.title = getStyleForId(getTestId(), window.location.hash.substr(1)) -} -</script> -<body onload='setTimeout("changeTitle()", 100)'> -<p id="standard">hello</p> -<code id="fixed">hello</code> -<p id="minimum" style="font-size: smaller">hello</p> -</body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/geolocation.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/geolocation.html deleted file mode 100644 index 2d41cab3e..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/geolocation.html +++ /dev/null @@ -1,29 +0,0 @@ -<head> -<title>Geolocation Permission API Test</title> -<meta content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" name="viewport"/> -<script> -var watchId = 0; - -function successHandler(location) { - var message = document.getElementById("message"), html = []; - html.push("<img width='256' height='256' src='http://maps.google.com/maps/api/staticmap?center=", location.coords.latitude, ",", location.coords.longitude, "&markers=size:small|color:blue|", location.coords.latitude, ",", location.coords.longitude, "&zoom=14&size=256x256&sensor=false' />"); - html.push("<p>Longitude: ", location.coords.longitude, "</p>"); - html.push("<p>Latitude: ", location.coords.latitude, "</p>"); - html.push("<p>Accuracy: ", location.coords.accuracy, " meters</p>"); - message.innerHTML = html.join(""); -} - -function errorHandler(error) { - alert('Attempt to get location failed: ' + error.message); -} - -<!-- One shot example --> -navigator.geolocation.getCurrentPosition(successHandler, errorHandler); - -</script> -</head> -<body> -<div id="message">Location unknown</div> -</body> -</html> - diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/javascript.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/javascript.html deleted file mode 100644 index 7a3dc0a1c..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/javascript.html +++ /dev/null @@ -1,8 +0,0 @@ -<html> -<head><title>Original Title</title></head> -<body> -<script type="text/javascript"> -document.title = "New Title"; -</script> -</body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/link.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/link.html deleted file mode 100644 index e791b7de4..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/link.html +++ /dev/null @@ -1,6 +0,0 @@ -<!doctype html> -<html> -<body onload="document.links['foo'].focus();"> -<a name="foo" href="test1.html">Link</a> -</body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/localStorage.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/localStorage.html deleted file mode 100644 index a4e395f48..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/localStorage.html +++ /dev/null @@ -1,9 +0,0 @@ -<html> -<head><title>Original Title</title></head> -<body> -<script type="text/javascript"> -document.title = localStorage.getItem('title'); -localStorage.setItem('title', 'New Title'); -</script> -</body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/messaging.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/messaging.html deleted file mode 100644 index 7e3dd7230..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/messaging.html +++ /dev/null @@ -1,15 +0,0 @@ -<!doctype html> -<html> -<head> -<script> - function initialize() { - navigator.qt.onmessage = function(ev) { - var reversed = ev.data.split("").reverse().join(""); - navigator.qt.postMessage(reversed); - } - } -</script> -</head> -<body onload="initialize();"> -</body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/multifileupload.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/multifileupload.html deleted file mode 100644 index 7701ed4b5..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/multifileupload.html +++ /dev/null @@ -1,11 +0,0 @@ -<html> -<head> -<meta name="viewport" initial-scale=1"> -<title> Mutli-file Upload </title> -<script src = "./titleupdate.js"> -</script> - -<body> -<input type="file" name="file" id="upfile" onchange="updateTitle()" multiple/> -</body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/notification.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/notification.html deleted file mode 100644 index e9186a4fd..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/notification.html +++ /dev/null @@ -1,19 +0,0 @@ -<html> -<head> - <title>Desktop Notification Permission test</title> - <script> - requestPermission = function(cb) { - window.Notification.requestPermission(function() { - if (cb) - cb(window.Notification.permission); - }); - } - requestPermission() - </script> -</head> - -<body> - Desktop Notification test -</body> - -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/prompt.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/prompt.html deleted file mode 100644 index f35e30204..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/prompt.html +++ /dev/null @@ -1,13 +0,0 @@ -<!doctype html> -<html> -<head> -<script> -document.title = prompt("Please, reverse the default value", "Hello Qt"); -if (prompt("REJECT") !== null) { - document.title = "FAIL"; -} -</script> -</head> -<body> -</body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/qrctest.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/qrctest.html deleted file mode 100644 index 98f25fb7e..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/qrctest.html +++ /dev/null @@ -1,6 +0,0 @@ -<html> -<head><title>Loaded from qrc.</title></head> -<body> -Hello. I was loaded from a qrc file. Amazing. -</body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/redirect.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/redirect.html deleted file mode 100644 index 914e5e35a..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/redirect.html +++ /dev/null @@ -1,8 +0,0 @@ -<!doctype html> -<html> -<head> -<meta http-equiv="refresh" content="2; url=test1.html" -</head> -<body> -</body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/select.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/select.html deleted file mode 100644 index 46080f6e4..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/select.html +++ /dev/null @@ -1,18 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<title>No new selection was made</title> -<script> -function updateTitle(selectElement) { - var index = selectElement.selectedIndex; - document.title = selectElement.options[index].value; -} -</script> -</head> -<body> -<select onchange="updateTitle(this)"> -<option value="__open__" >Open</option> -<option value="__closed__" >Closed</option> -<option value="__all__" >All</option> -</select> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/selectwithsize.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/selectwithsize.html deleted file mode 100644 index f514c46cc..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/selectwithsize.html +++ /dev/null @@ -1,18 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<title>No new selection was made</title> -<script> -function updateTitle(selectElement) { - var index = selectElement.selectedIndex; - document.title = selectElement.options[index].value; -} -</script> -</head> -<body> -<select size=2 onchange="updateTitle(this)"> -<option value="__open__" >Open</option> -<option value="__closed__" >Closed</option> -<option value="__all__" >All</option> -</select> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/singlefileupload.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/singlefileupload.html deleted file mode 100644 index 38e345f4b..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/singlefileupload.html +++ /dev/null @@ -1,11 +0,0 @@ -<html> -<head> -<meta name="viewport" initial-scale=1"> -<title> Single File Upload </title> -<script src = "./titleupdate.js"> -</script> - -<body> -<input type="file" name="file" id="upfile" onchange="updateTitle()"/> -</body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/small-favicon.png b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/small-favicon.png Binary files differdeleted file mode 100644 index 4462752a5..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/small-favicon.png +++ /dev/null diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test1.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test1.html deleted file mode 100644 index 5c09f06ed..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test1.html +++ /dev/null @@ -1,6 +0,0 @@ -<html> -<head><title>Test page 1</title></head> -<body> -Hello. -</body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test2.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test2.html deleted file mode 100644 index 629c2a063..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test2.html +++ /dev/null @@ -1,6 +0,0 @@ -<html> -<head><title>Test page with huge link area</title></head> -<body> -<a title="A title" href="test1.html"><img width=200 height=200></a> -</body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test3.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test3.html deleted file mode 100644 index 0c0e4eebf..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test3.html +++ /dev/null @@ -1,18 +0,0 @@ -<html> -<head> -<title>Test page 3</title> -</head> -<script type="text/javascript"> -function kickOffTitleChange() -{ - var t = setTimeout("changeTitle('New Title')",3000); -} -function changeTitle(title) -{ - document.title = title; -} -</script> -<body onload="kickOffTitleChange()"> -Hello. -</body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test4.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test4.html deleted file mode 100644 index 8f75af606..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test4.html +++ /dev/null @@ -1,118 +0,0 @@ -<html> - <head> - <title>Long Page To Scroll</title> - <style> - #content { - margin: auto; - width: 100%; - background: #eeeeee; - font-size: 50px; - } - </style> - <meta name="viewport" content="initial-scale=2.0"/> - </head> - <body> - <div id="content"> - bla00<br/> - bla01<br/> - bla02<br/> - bla03<br/> - bla04<br/> - bla05<br/> - bla06<br/> - bla07<br/> - bla08<br/> - bla09<br/> - bla10<br/> - bla11<br/> - bla12<br/> - bla13<br/> - bla14<br/> - bla15<br/> - bla16<br/> - bla17<br/> - bla18<br/> - bla19<br/> - bla20<br/> - bla21<br/> - bla22<br/> - bla23<br/> - bla24<br/> - bla25<br/> - bla26<br/> - bla27<br/> - bla28<br/> - bla29<br/> - bla30<br/> - bla31<br/> - bla32<br/> - bla33<br/> - bla34<br/> - bla35<br/> - bla36<br/> - bla37<br/> - bla38<br/> - bla39<br/> - bla40<br/> - bla41<br/> - bla42<br/> - bla43<br/> - bla44<br/> - bla45<br/> - bla46<br/> - bla47<br/> - bla48<br/> - bla49<br/> - bla50<br/> - bla51<br/> - bla52<br/> - bla53<br/> - bla54<br/> - bla55<br/> - bla56<br/> - bla57<br/> - bla58<br/> - bla59<br/> - bla60<br/> - bla61<br/> - bla62<br/> - bla63<br/> - bla64<br/> - bla65<br/> - bla66<br/> - bla67<br/> - bla68<br/> - bla69<br/> - bla70<br/> - bla71<br/> - bla72<br/> - bla73<br/> - bla74<br/> - bla75<br/> - bla76<br/> - bla77<br/> - bla78<br/> - bla79<br/> - bla80<br/> - bla81<br/> - bla82<br/> - bla83<br/> - bla84<br/> - bla85<br/> - bla86<br/> - bla87<br/> - bla88<br/> - bla89<br/> - bla90<br/> - bla91<br/> - bla92<br/> - bla93<br/> - bla94<br/> - bla95<br/> - bla96<br/> - bla97<br/> - bla98<br/> - bla99<br/> - </div> - </body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test5.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test5.html deleted file mode 100644 index 3630ea6bd..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/test5.html +++ /dev/null @@ -1,10 +0,0 @@ -<html> - <head> - <title>Local page with viewport meta tag: width=device-width</title> - <meta name="viewport" content="width=device-width"/> - </head> - <body> - <style type="text/css">body {width: 960px; height: 1440px; margin: 0; padding: 0;}</style> - <div>blah</div> - </body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/titleupdate.js b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/titleupdate.js deleted file mode 100644 index 2a5bac0ac..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/titleupdate.js +++ /dev/null @@ -1,15 +0,0 @@ -function updateTitle() -{ - var inp = document.getElementById("upfile"); - var allfiles = new String(""); - var name = new String(""); - for (var i = 0; i < inp.files.length; ++i) - { - name = inp.files.item(i).name; - if (allfiles.length == 0) - allfiles = name; - else - allfiles = allfiles + "," + name; - } - document.title = allfiles; -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/webchannel.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/webchannel.html deleted file mode 100644 index 940821209..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/webchannel.html +++ /dev/null @@ -1,21 +0,0 @@ -<!DOCTYPE html> -<html> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <script type="text/javascript" src="qrc:///qtwebchannel/qwebchannel.js"></script> - <script type="text/javascript"> - //BEGIN SETUP - var channel = new QWebChannel(navigator.qtWebChannelTransport, function(channel) { - window.testObject = channel.objects.testObject; - testObject.runTest.connect(function(foo) { - testObject.foo = foo; - testObject.bar(foo); - }); - testObject.clientInitialized(testObject.foo); - }); - //END SETUP - </script> - </head> - <body> - </body> -</html> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/qmltests.pro b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/qmltests.pro deleted file mode 100644 index 8ddc4484e..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/qmltests.pro +++ /dev/null @@ -1,3 +0,0 @@ -TEMPLATE = subdirs - -SUBDIRS += DesktopBehavior.pro WebView.pro diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/resources.qrc b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/resources.qrc deleted file mode 100644 index f251865ef..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/resources.qrc +++ /dev/null @@ -1,6 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>common/change-document-title.js</file> - <file>common/qrctest.html</file> - </qresource> -</RCC> diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp deleted file mode 100644 index e681daa0d..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) - - 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 library 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 library; 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 "../bytearraytestdata.h" -#include "../util.h" - -#include "private/qquickwebview_p.h" -#include <QVarLengthArray> -#include <QtQuickTest/quicktest.h> - -int main(int argc, char** argv) -{ - QVarLengthArray<char*, 8> arguments; - for (int i = 0; i < argc; ++i) - arguments.append(argv[i]); - - arguments.append(const_cast<char*>("-import")); - arguments.append(const_cast<char*>(IMPORT_DIR)); - - argc = arguments.count(); - argv = arguments.data(); - - suppressDebugOutput(); - addQtWebProcessToPath(); - - qmlRegisterType<ByteArrayTestData>("Test", 1, 0, "ByteArrayTestData"); - -#ifdef DISABLE_FLICKABLE_VIEWPORT - QQuickWebViewExperimental::setFlickableViewportEnabled(false); -#endif - return quick_test_main(argc, argv, "qmltests", QUICK_TEST_SOURCE_DIR); -} diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro deleted file mode 100644 index 4a8d86f80..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/qquickwebview.pro +++ /dev/null @@ -1,4 +0,0 @@ -include(../tests.pri) -SOURCES += $${TARGET}.cpp -QT += webkit-private -DEFINES += IMPORT_DIR=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}imports\\\"\" diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp deleted file mode 100644 index 7cf1ddb72..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qquickwebview/tst_qquickwebview.cpp +++ /dev/null @@ -1,449 +0,0 @@ -/* - Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) - - 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 library 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 library; 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 "../testwindow.h" -#include "../util.h" - -#include <QScopedPointer> -#include <QtQml/QQmlEngine> -#include <QtTest/QtTest> -#include <private/qquickwebpage_p.h> -#include <private/qquickwebview_p.h> - -class tst_QQuickWebView : public QObject { - Q_OBJECT -public: - tst_QQuickWebView(); - -private Q_SLOTS: - void init(); - void cleanup(); - - void accessPage(); - void navigationStatusAtStartup(); - void stopEnabledAfterLoadStarted(); - void baseUrl(); - void loadEmptyUrl(); - void loadEmptyPageViewVisible(); - void loadEmptyPageViewHidden(); - void loadNonexistentFileUrl(); - void backAndForward(); - void reload(); - void stop(); - void loadProgress(); - void scrollRequest(); - - void show(); - void showWebView(); - void removeFromCanvas(); - void multipleWebViewWindows(); - void multipleWebViews(); - void titleUpdate(); - void transparentWebViews(); - - void inputMethod(); - void inputMethodHints(); - void basicRenderingSanity(); - -private: - void prepareWebViewComponent(); - inline QQuickWebView* newWebView(); - inline QQuickWebView* webView() const; - void runJavaScript(const QString& script); - QScopedPointer<TestWindow> m_window; - QScopedPointer<QQmlComponent> m_component; -}; - -tst_QQuickWebView::tst_QQuickWebView() -{ - addQtWebProcessToPath(); - prepareWebViewComponent(); -} - -void tst_QQuickWebView::prepareWebViewComponent() -{ - static QQmlEngine* engine = new QQmlEngine(this); - engine->addImportPath(QString::fromUtf8(IMPORT_DIR)); - - m_component.reset(new QQmlComponent(engine, this)); - - m_component->setData(QByteArrayLiteral("import QtQuick 2.0\n" - "import QtWebKit 3.0\n" - "WebView {}") - , QUrl()); -} - -QQuickWebView* tst_QQuickWebView::newWebView() -{ - QObject* viewInstance = m_component->create(); - QQuickWebView* webView = qobject_cast<QQuickWebView*>(viewInstance); - return webView; -} - -void tst_QQuickWebView::init() -{ - m_window.reset(new TestWindow(newWebView())); -} - -void tst_QQuickWebView::cleanup() -{ - m_window.reset(); -} - -inline QQuickWebView* tst_QQuickWebView::webView() const -{ - return static_cast<QQuickWebView*>(m_window->webView.data()); -} - -void tst_QQuickWebView::runJavaScript(const QString &script) -{ - QEventLoop loop; - webView()->runJavaScriptInMainFrame(script, &loop, "quit"); - loop.exec(); -} - -void tst_QQuickWebView::accessPage() -{ - QQuickWebPage* const pageDirectAccess = webView()->page(); - - QVariant pagePropertyValue = webView()->experimental()->property("page"); - QQuickWebPage* const pagePropertyAccess = pagePropertyValue.value<QQuickWebPage*>(); - QCOMPARE(pagePropertyAccess, pageDirectAccess); -} - -void tst_QQuickWebView::navigationStatusAtStartup() -{ - QCOMPARE(webView()->canGoBack(), false); - - QCOMPARE(webView()->canGoForward(), false); - - QCOMPARE(webView()->loading(), false); -} - -void tst_QQuickWebView::stopEnabledAfterLoadStarted() -{ - QCOMPARE(webView()->loading(), false); - - LoadStartedCatcher catcher(webView()); - webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html"))); - waitForSignal(&catcher, SIGNAL(finished())); - - QCOMPARE(webView()->loading(), true); - - QVERIFY(waitForLoadSucceeded(webView())); -} - -void tst_QQuickWebView::baseUrl() -{ - // Test the url is in a well defined state when instanciating the view, but before loading anything. - QVERIFY(webView()->url().isEmpty()); -} - -void tst_QQuickWebView::loadEmptyUrl() -{ - webView()->setUrl(QUrl()); - webView()->setUrl(QUrl(QLatin1String(""))); -} - -void tst_QQuickWebView::loadEmptyPageViewVisible() -{ - m_window->show(); - loadEmptyPageViewHidden(); -} - -void tst_QQuickWebView::loadEmptyPageViewHidden() -{ - QSignalSpy loadSpy(webView(), SIGNAL(loadingChanged(QWebLoadRequest*))); - - webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html"))); - QVERIFY(waitForLoadSucceeded(webView())); - - QCOMPARE(loadSpy.size(), 2); -} - -void tst_QQuickWebView::loadNonexistentFileUrl() -{ - QSignalSpy loadSpy(webView(), SIGNAL(loadingChanged(QWebLoadRequest*))); - - webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/file_that_does_not_exist.html"))); - QVERIFY(waitForLoadFailed(webView())); - - QCOMPARE(loadSpy.size(), 2); -} - -void tst_QQuickWebView::backAndForward() -{ - webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html"))); - QVERIFY(waitForLoadSucceeded(webView())); - - QCOMPARE(webView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")); - - webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page2.html"))); - QVERIFY(waitForLoadSucceeded(webView())); - - QCOMPARE(webView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "/html/basic_page2.html")); - - webView()->goBack(); - QVERIFY(waitForLoadSucceeded(webView())); - - QCOMPARE(webView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")); - - webView()->goForward(); - QVERIFY(waitForLoadSucceeded(webView())); - - QCOMPARE(webView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "/html/basic_page2.html")); -} - -void tst_QQuickWebView::reload() -{ - webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html"))); - QVERIFY(waitForLoadSucceeded(webView())); - - QCOMPARE(webView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")); - - webView()->reload(); - QVERIFY(waitForLoadSucceeded(webView())); - - QCOMPARE(webView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")); -} - -void tst_QQuickWebView::stop() -{ - webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html"))); - QVERIFY(waitForLoadSucceeded(webView())); - - QCOMPARE(webView()->url().path(), QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html")); - - // FIXME: This test should be fleshed out. Right now it's just here to make sure we don't crash. - webView()->stop(); -} - -void tst_QQuickWebView::loadProgress() -{ - QCOMPARE(webView()->loadProgress(), 0); - - webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html"))); - QSignalSpy loadProgressChangedSpy(webView(), SIGNAL(loadProgressChanged())); - QVERIFY(waitForLoadSucceeded(webView())); - - QVERIFY(loadProgressChangedSpy.count() >= 1); - - QCOMPARE(webView()->loadProgress(), 100); -} - -void tst_QQuickWebView::show() -{ - // This should not crash. - m_window->show(); - QTest::qWait(200); - m_window->hide(); -} - -void tst_QQuickWebView::showWebView() -{ - webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/direct-image-compositing.html"))); - QVERIFY(waitForLoadSucceeded(webView())); - m_window->show(); - // This should not crash. - webView()->setVisible(true); - QTest::qWait(200); - webView()->setVisible(false); - QTest::qWait(200); -} - -void tst_QQuickWebView::removeFromCanvas() -{ - showWebView(); - - // This should not crash. - QQuickItem* parent = webView()->parentItem(); - QQuickItem noCanvasItem; - webView()->setParentItem(&noCanvasItem); - QTest::qWait(200); - webView()->setParentItem(parent); - webView()->setVisible(true); - QTest::qWait(200); -} - -void tst_QQuickWebView::multipleWebViewWindows() -{ - showWebView(); - - // This should not crash. - QQuickWebView* webView1 = newWebView(); - QScopedPointer<TestWindow> window1(new TestWindow(webView1)); - QQuickWebView* webView2 = newWebView(); - QScopedPointer<TestWindow> window2(new TestWindow(webView2)); - - webView1->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/scroll.html"))); - QVERIFY(waitForLoadSucceeded(webView1)); - window1->show(); - webView1->setVisible(true); - - webView2->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html"))); - QVERIFY(waitForLoadSucceeded(webView2)); - window2->show(); - webView2->setVisible(true); - QTest::qWait(200); -} - -void tst_QQuickWebView::multipleWebViews() -{ - showWebView(); - - // This should not crash. - QScopedPointer<QQuickWebView> webView1(newWebView()); - webView1->setParentItem(m_window->contentItem()); - QScopedPointer<QQuickWebView> webView2(newWebView()); - webView2->setParentItem(m_window->contentItem()); - - webView1->setSize(QSizeF(300, 400)); - webView1->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/scroll.html"))); - QVERIFY(waitForLoadSucceeded(webView1.data())); - webView1->setVisible(true); - - webView2->setSize(QSizeF(300, 400)); - webView2->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html"))); - QVERIFY(waitForLoadSucceeded(webView2.data())); - webView2->setVisible(true); - QTest::qWait(200); -} - -void tst_QQuickWebView::basicRenderingSanity() -{ - showWebView(); - - webView()->setUrl(QUrl(QString::fromUtf8("data:text/html,<html><body bgcolor=\"#00ff00\"></body></html>"))); - QVERIFY(waitForLoadSucceeded(webView())); - - // This should not crash. - webView()->setVisible(true); - QTest::qWait(200); - QImage grabbedWindow = m_window->grabWindow(); - QRgb testColor = qRgba(0, 0xff, 0, 0xff); - QVERIFY(grabbedWindow.pixel(10, 10) == testColor); - QVERIFY(grabbedWindow.pixel(100, 10) == testColor); - QVERIFY(grabbedWindow.pixel(10, 100) == testColor); - QVERIFY(grabbedWindow.pixel(100, 100) == testColor); -} - -void tst_QQuickWebView::titleUpdate() -{ - QSignalSpy titleSpy(webView(), SIGNAL(titleChanged())); - - // Load page with no title - webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page2.html"))); - QVERIFY(waitForLoadSucceeded(webView())); - QCOMPARE(titleSpy.size(), 1); - - titleSpy.clear(); - - // No titleChanged signal for failed load - webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/file_that_does_not_exist.html"))); - QVERIFY(waitForLoadFailed(webView())); - QCOMPARE(titleSpy.size(), 0); - -} - -void tst_QQuickWebView::transparentWebViews() -{ - showWebView(); - - // This should not crash. - QScopedPointer<QQuickWebView> webView1(newWebView()); - webView1->setParentItem(m_window->contentItem()); - QScopedPointer<QQuickWebView> webView2(newWebView()); - webView2->setParentItem(m_window->contentItem()); - QVERIFY(!webView1->experimental()->transparentBackground()); - webView2->experimental()->setTransparentBackground(true); - QVERIFY(webView2->experimental()->transparentBackground()); - - webView1->setSize(QSizeF(300, 400)); - webView1->loadHtml("<html><body bgcolor=\"red\"></body></html>"); - QVERIFY(waitForLoadSucceeded(webView1.data())); - webView1->setVisible(true); - - webView2->setSize(QSizeF(300, 400)); - webView2->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/basic_page.html"))); - QVERIFY(waitForLoadSucceeded(webView2.data())); - webView2->setVisible(true); - - QTest::qWait(200); - // FIXME: test actual rendering results; https://bugs.webkit.org/show_bug.cgi?id=80609. -} - -void tst_QQuickWebView::inputMethod() -{ - QQuickWebView* view = webView(); - view->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/inputmethod.html"))); - QVERIFY(waitForLoadSucceeded(view)); - - QVERIFY(!view->flags().testFlag(QQuickItem::ItemAcceptsInputMethod)); - runJavaScript("document.getElementById('inputField').focus();"); - QVERIFY(view->flags().testFlag(QQuickItem::ItemAcceptsInputMethod)); - runJavaScript("document.getElementById('inputField').blur();"); - QVERIFY(!view->flags().testFlag(QQuickItem::ItemAcceptsInputMethod)); -} - -void tst_QQuickWebView::inputMethodHints() -{ - QQuickWebView* view = webView(); - - view->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/inputmethod.html"))); - QVERIFY(waitForLoadSucceeded(view)); - - // Setting focus on an input element results in an element in its shadow tree becoming the focus node. - // Input hints should not be set from this shadow tree node but from the input element itself. - runJavaScript("document.getElementById('emailInputField').focus();"); - QVERIFY(view->flags().testFlag(QQuickItem::ItemAcceptsInputMethod)); - QInputMethodQueryEvent query(Qt::ImHints); - QGuiApplication::sendEvent(view, &query); - Qt::InputMethodHints hints(query.value(Qt::ImHints).toUInt() & Qt::ImhExclusiveInputMask); - QCOMPARE(hints, Qt::ImhEmailCharactersOnly); - - // The focus of an editable DIV is given directly to it, so no shadow root element - // is necessary. This tests the WebPage::editorState() method ability to get the - // right element without breaking. - runJavaScript("document.getElementById('editableDiv').focus();"); - QVERIFY(view->flags().testFlag(QQuickItem::ItemAcceptsInputMethod)); - query = QInputMethodQueryEvent(Qt::ImHints); - QGuiApplication::sendEvent(view, &query); - hints = Qt::InputMethodHints(query.value(Qt::ImHints).toUInt()); - QCOMPARE(hints, Qt::ImhNone); -} - -void tst_QQuickWebView::scrollRequest() -{ - m_window->setGeometry(0, 0, 300, 400); - m_window->show(); - - webView()->setUrl(QUrl::fromLocalFile(QLatin1String(TESTS_SOURCE_DIR "/html/scroll.html"))); - QVERIFY(waitForViewportReady(webView())); - - // COMPARE with the position requested in the html - // Use qRound as that is also used when calculating the position - // in WebKit. - int y = qRound(50 * webView()->page()->contentsScale()); - QVERIFY(webView()->contentY() == y); -} - -QTEST_MAIN(tst_QQuickWebView) - -#include "tst_qquickwebview.moc" - diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro deleted file mode 100644 index 02dc197c7..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/qrawwebview.pro +++ /dev/null @@ -1,3 +0,0 @@ -include(../tests.pri) -SOURCES += $${TARGET}.cpp -QT += webkit-private diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp deleted file mode 100644 index 208288d1e..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp +++ /dev/null @@ -1,238 +0,0 @@ -/* - Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) - - 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 library 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 library; 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 "../util.h" - -#include <QImage> -#include <QMatrix4x4> -#include <QOpenGLContext> -#include <QSize> -#include <QWindow> -#include <QtTest/QtTest> - -#include <WebKit2/WKContext.h> -#include <WebKit2/WKPageGroup.h> -#include <WebKit2/WKPageLoadTypes.h> -#include <WebKit2/WKPreferences.h> -#include <WebKit2/WKPreferencesPrivate.h> -#include <WebKit2/WKStringQt.h> -#include <WebKit2/WKURL.h> -#include <WebKit2/qrawwebview_p.h> - -static WKContextRef webContext() -{ - static WKContextRef result = WKContextCreate(); - return result; -} - -static WKPageGroupRef createWebPageGroup(const QString& name) -{ - WKPageGroupRef pageGroup =WKPageGroupCreateWithIdentifier(WKStringCreateWithQString(name)); - WKPreferencesRef preferences = WKPageGroupGetPreferences(pageGroup); - WKPreferencesSetAcceleratedCompositingEnabled(preferences, true); - WKPreferencesSetFrameFlatteningEnabled(preferences, true); - - return pageGroup; -} - -static WKPageGroupRef webPageGroup(const QString& name) -{ - static WKPageGroupRef result = createWebPageGroup(name); - return result; -} - -class WebView : public QObject, public QRawWebViewClient { - Q_OBJECT -public: - WebView(const QSize& size, bool transparent = false) - { - m_webView = new QRawWebView(webContext(), webPageGroup(QString()), this); - m_webView->setTransparentBackground(transparent); - m_webView->create(); - - WKPageLoaderClient loaderClient; - memset(&loaderClient, 0, sizeof(WKPageLoaderClient)); - loaderClient.version = kWKPageLoaderClientCurrentVersion; - loaderClient.clientInfo = this; - loaderClient.didLayout = WebView::didLayout; - - WKPageSetPageLoaderClient(m_webView->pageRef(), &loaderClient); - WKPageListenForLayoutMilestones(m_webView->pageRef(), kWKDidFirstVisuallyNonEmptyLayout); - WKPageSetUseFixedLayout(m_webView->pageRef(), true); - - m_webView->setSize(size); - m_webView->setFocused(true); - m_webView->setVisible(true); - m_webView->setActive(true); - } - - ~WebView() { delete m_webView; } - - void load(const QString& html) - { - m_frameLoaded = false; - WKPageLoadURL(m_webView->pageRef(), WKURLCreateWithUTF8CString(html.toLocal8Bit().data())); - QVERIFY(::waitForSignal(this, SIGNAL(loaded()), 5000)); - } - - void setDrawBackground(bool value) { m_webView->setDrawBackground(value); } - void setTransparentBackground(bool value) { m_webView->setTransparentBackground(value); } - - virtual void viewNeedsDisplay(const QRect&) - { - m_webView->paint(QMatrix4x4(), 1, 0); - } - - virtual void viewRequestedScroll(const QPoint&) { } - virtual void viewProcessCrashed() { } - virtual void viewProcessRelaunched() { } - virtual void viewContentSizeChanged(const QSize&) { } - virtual void viewRequestedCursorOverride(const QCursor&) { } - virtual void doneWithKeyEvent(const QKeyEvent*, bool wasHandled) { } - virtual void doneWithTouchEvent(const QTouchEvent*, bool wasHandled) { } - - void frameLoaded() - { - m_frameLoaded = true; - WKPageForceRepaint(m_webView->pageRef(), this, finishForceRepaint); - } - - void onRepaintDone() - { - emit loaded(); - } - - static void finishForceRepaint(WKErrorRef, void* context) - { - static_cast<WebView*>(context)->onRepaintDone(); - } - - static void didLayout(WKPageRef page, WKLayoutMilestones milestones, WKTypeRef userData, const void *clientInfo) - { - static_cast<WebView*>(const_cast<void*>(clientInfo))->frameLoaded(); - } - -Q_SIGNALS: - void loaded(); - -private: - QRawWebView* m_webView; - bool m_frameLoaded; -}; - -static bool compareImages(const QImage& i1, const QImage& i2, int count) -{ - if (i1.size() != i2.size()) - return false; - for (int x = 0; x < count; ++x) { - for (int y = 0; y < count; ++y) { - QPoint point(x * i1.width() / count, y * i1.height() / count); - if (i1.pixel(point) != i2.pixel(point)) - return false; - } - } - - return true; -} - -class tst_qrawwebview : public QObject { - Q_OBJECT -public: - tst_qrawwebview() - : m_resourceDir(QString::fromLatin1(TESTS_SOURCE_DIR "/html/resources")) - , m_baseUrl(QUrl::fromLocalFile(TESTS_SOURCE_DIR "/html").toString()) - { - addQtWebProcessToPath(); - } - -private Q_SLOTS: - void paint() { run(&tst_qrawwebview::doPaint, m_resourceDir + "/qwkview_paint.png"); } - void noBackground1() { run(&tst_qrawwebview::doNoBackground1, m_resourceDir + "/qwkview_noBackground1.png"); } - void noBackground2() { run(&tst_qrawwebview::doNoBackground2, m_resourceDir + "/qwkview_noBackground1.png"); } - void noBackground3() { run(&tst_qrawwebview::doNoBackground3, m_resourceDir + "/qwkview_noBackground3.png"); } - -private: - const QString m_resourceDir; - const QString m_baseUrl; - - void doPaint(const QSize& size); - void doNoBackground1(const QSize& size); - void doNoBackground2(const QSize& size); - void doNoBackground3(const QSize& size); - - typedef void (tst_qrawwebview::*PaintMethod)(const QSize& size); - void run(PaintMethod, const QString& expectation); -}; - -void tst_qrawwebview::doPaint(const QSize& size) -{ - WebView view(size); - view.load(m_baseUrl + "/redsquare.html"); -} - -void tst_qrawwebview::doNoBackground1(const QSize& size) -{ - WebView view(size, true); - view.load(m_baseUrl + "/redsquare.html"); - view.load(m_baseUrl + "/bluesquare.html"); -} - -void tst_qrawwebview::doNoBackground2(const QSize& size) -{ - WebView view1(size, true); - view1.load(m_baseUrl + "/redsquare.html"); - - WebView view2(size, true); - view2.load(m_baseUrl + "/bluesquare.html"); -} - -void tst_qrawwebview::doNoBackground3(const QSize& size) -{ - WebView view1(size, false); - view1.load(m_baseUrl + "/redsquare.html"); - - WebView view2(size, true); - view2.load(m_baseUrl + "/bluesquare.html"); -} - -void tst_qrawwebview::run(PaintMethod method, const QString& expectation) -{ - QWindow window; - window.setSurfaceType(QSurface::OpenGLSurface); - window.setGeometry(0, 0, 200, 200); - window.create(); - - QOpenGLContext context; - context.create(); - context.makeCurrent(&window); - - glViewport(0, 0, window.size().width(), window.size().height()); - glClearColor(0, 0, 0, 0); - glClear(GL_COLOR_BUFFER_BIT); - - (this->*method)(window.size()); - - QImage image(window.size(), QImage::Format_ARGB32_Premultiplied); - glReadPixels(0, 0, window.size().width(), window.size().height(), GL_RGBA, GL_UNSIGNED_BYTE, image.bits()); - - QVERIFY(compareImages(QImage(expectation), image.rgbSwapped(), 5)); -} - -QTEST_MAIN(tst_qrawwebview) - -#include "tst_qrawwebview.moc" diff --git a/Source/WebKit2/UIProcess/API/qt/tests/tests.pri b/Source/WebKit2/UIProcess/API/qt/tests/tests.pri deleted file mode 100644 index a1133530d..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/tests.pri +++ /dev/null @@ -1,20 +0,0 @@ -TEMPLATE = app - -VPATH += $$_PRO_FILE_PWD_ -TARGET = tst_$$TARGET - -INCLUDEPATH += $$PWD -SOURCES += ../util.cpp - -QT += testlib webkit -have?(QTQUICK) { - QT += qml quick quick-private - HEADERS += ../bytearraytestdata.h \ - ../util.h - - SOURCES += ../bytearraytestdata.cpp -} -WEBKIT += wtf # For platform macros - -DEFINES += TESTS_SOURCE_DIR=\\\"$$PWD\\\" \ - QWP_PATH=\\\"$${ROOT_BUILD_DIR}/bin\\\" diff --git a/Source/WebKit2/UIProcess/API/qt/tests/testwindow.h b/Source/WebKit2/UIProcess/API/qt/tests/testwindow.h deleted file mode 100644 index 9d5d656e9..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/testwindow.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) - - 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 library 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 library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - -#ifndef testwindow_h -#define testwindow_h - -#if 0 -#pragma qt_no_master_include -#endif - -#include <QResizeEvent> -#include <QScopedPointer> -#include <QtQuick/qquickitem.h> -#include <QtQuick/qquickview.h> - -// TestWindow: Utility class to ignore QQuickView details. -class TestWindow : public QQuickView { -public: - inline TestWindow(QQuickItem* webView); - QScopedPointer<QQuickItem> webView; - -protected: - inline void resizeEvent(QResizeEvent*); -}; - -inline TestWindow::TestWindow(QQuickItem* webView) - : webView(webView) -{ - Q_ASSERT(webView); - webView->setParentItem(contentItem()); - resize(300, 400); -} - -inline void TestWindow::resizeEvent(QResizeEvent* event) -{ - QQuickView::resizeEvent(event); - webView->setX(0); - webView->setY(0); - webView->setWidth(event->size().width()); - webView->setHeight(event->size().height()); -} - -#endif /* testwindow_h */ diff --git a/Source/WebKit2/UIProcess/API/qt/tests/util.cpp b/Source/WebKit2/UIProcess/API/qt/tests/util.cpp deleted file mode 100644 index 3b0c45f7d..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/util.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) - - 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 library 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 library; 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 "util.h" - -#include <QtTest/QtTest> -#include <stdio.h> - -#if defined(HAVE_QTQUICK) && HAVE_QTQUICK -#include "private/qquickwebview_p.h" -#include "private/qwebloadrequest_p.h" -#endif - -void addQtWebProcessToPath() -{ - // Since tests won't find ./QtWebProcess, add it to PATH (at the end to prevent surprises). - // QWP_PATH should be defined by qmake. - qputenv("PATH", qgetenv("PATH") + ":" + QWP_PATH); -} - -/** - * Starts an event loop that runs until the given signal is received. - * Optionally the event loop - * can return earlier on a timeout. - * - * \return \p true if the requested signal was received - * \p false on timeout - */ -bool waitForSignal(QObject* obj, const char* signal, int timeout) -{ - QEventLoop loop; - QObject::connect(obj, signal, &loop, SLOT(quit())); - QTimer timer; - QSignalSpy timeoutSpy(&timer, SIGNAL(timeout())); - if (timeout > 0) { - QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); - timer.setSingleShot(true); - timer.start(timeout); - } - loop.exec(); - return timeoutSpy.isEmpty(); -} - -static void messageHandler(QtMsgType type, const QMessageLogContext&, const QString& message) -{ - if (type == QtCriticalMsg) { - fprintf(stderr, "%s\n", qPrintable(message)); - return; - } - // Do nothing -} - -void suppressDebugOutput() -{ - qInstallMessageHandler(messageHandler); \ - if (qgetenv("QT_WEBKIT_SUPPRESS_WEB_PROCESS_OUTPUT").isEmpty()) \ - qputenv("QT_WEBKIT_SUPPRESS_WEB_PROCESS_OUTPUT", "1"); -} - -#if defined(HAVE_QTQUICK) && HAVE_QTQUICK -bool waitForLoadSucceeded(QQuickWebView* webView, int timeout) -{ - QEventLoop loop; - LoadSpy loadSpy(webView); - QObject::connect(&loadSpy, SIGNAL(loadSucceeded()), &loop, SLOT(quit())); - QTimer timer; - QSignalSpy timeoutSpy(&timer, SIGNAL(timeout())); - if (timeout > 0) { - QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); - timer.setSingleShot(true); - timer.start(timeout); - } - loop.exec(); - return timeoutSpy.isEmpty(); -} - -bool waitForLoadFailed(QQuickWebView* webView, int timeout) -{ - QEventLoop loop; - LoadSpy loadSpy(webView); - QObject::connect(&loadSpy, SIGNAL(loadFailed()), &loop, SLOT(quit())); - QTimer timer; - QSignalSpy timeoutSpy(&timer, SIGNAL(timeout())); - if (timeout > 0) { - QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); - timer.setSingleShot(true); - timer.start(timeout); - } - loop.exec(); - return timeoutSpy.isEmpty(); -} - -bool waitForViewportReady(QQuickWebView* webView, int timeout) -{ - // The viewport is locked until the first frame of a page load is rendered. - // The QQuickView needs to be shown for this to succeed. - return waitForSignal(webView->experimental(), SIGNAL(loadVisuallyCommitted()), timeout); -} - -LoadSpy::LoadSpy(QQuickWebView* webView) -{ - connect(webView, SIGNAL(loadingChanged(QWebLoadRequest*)), SLOT(onLoadingChanged(QWebLoadRequest*))); -} - -void LoadSpy::onLoadingChanged(QWebLoadRequest* loadRequest) -{ - if (loadRequest->status() == QQuickWebView::LoadSucceededStatus) - emit loadSucceeded(); - else if (loadRequest->status() == QQuickWebView::LoadFailedStatus) - emit loadFailed(); -} - -LoadStartedCatcher::LoadStartedCatcher(QQuickWebView* webView) - : m_webView(webView) -{ - connect(m_webView, SIGNAL(loadingChanged(QWebLoadRequest*)), this, SLOT(onLoadingChanged(QWebLoadRequest*))); -} - -void LoadStartedCatcher::onLoadingChanged(QWebLoadRequest* loadRequest) -{ - if (loadRequest->status() == QQuickWebView::LoadStartedStatus) { - QMetaObject::invokeMethod(this, "finished", Qt::QueuedConnection); - - QCOMPARE(m_webView->loading(), true); - } -} -#endif diff --git a/Source/WebKit2/UIProcess/API/qt/tests/util.h b/Source/WebKit2/UIProcess/API/qt/tests/util.h deleted file mode 100644 index 8711d5b1e..000000000 --- a/Source/WebKit2/UIProcess/API/qt/tests/util.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies) - - 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 library 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 library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ -// Functions and macros that really need to be in QTestLib - -#include <QEventLoop> -#include <QSignalSpy> -#include <QTimer> - -class QQuickWebView; -class QWebLoadRequest; - -#if !defined(TESTS_SOURCE_DIR) -#define TESTS_SOURCE_DIR "" -#endif - -void addQtWebProcessToPath(); -bool waitForSignal(QObject*, const char* signal, int timeout = 10000); -void suppressDebugOutput(); - -#if defined(HAVE_QTQUICK) && HAVE_QTQUICK -bool waitForLoadSucceeded(QQuickWebView* webView, int timeout = 10000); -bool waitForLoadFailed(QQuickWebView* webView, int timeout = 10000); -bool waitForViewportReady(QQuickWebView* webView, int timeout = 10000); - -class LoadSpy : public QEventLoop { - Q_OBJECT -public: - LoadSpy(QQuickWebView* webView); -Q_SIGNALS: - void loadSucceeded(); - void loadFailed(); -private Q_SLOTS: - void onLoadingChanged(QWebLoadRequest* loadRequest); -}; - -class LoadStartedCatcher : public QObject { - Q_OBJECT -public: - LoadStartedCatcher(QQuickWebView* webView); - virtual ~LoadStartedCatcher() { } -public Q_SLOTS: - void onLoadingChanged(QWebLoadRequest* loadRequest); -Q_SIGNALS: - void finished(); -private: - QQuickWebView* m_webView; -}; -#endif diff --git a/Source/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake index fb1112f41..ad775b11b 100644 --- a/Source/cmake/OptionsQt.cmake +++ b/Source/cmake/OptionsQt.cmake @@ -13,6 +13,7 @@ set(PROJECT_VERSION_STRING "${PROJECT_VERSION}") set(QT_CONAN_DIR "" CACHE PATH "Directory containing conanbuildinfo.cmake and conanfile.txt") if (QT_CONAN_DIR) + message(STATUS "Using conan directory: ${QT_CONAN_DIR}") find_program(CONAN_COMMAND NAMES conan PATHS $ENV{PIP3_PATH}) if (NOT CONAN_COMMAND) message(FATAL_ERROR "conan executable not found. Make sure that Conan is installed and available in PATH") @@ -420,40 +421,6 @@ if (WIN32) set(USE_SYSTEM_MALLOC 1) endif () -if (MSVC) - if (NOT WEBKIT_LIBRARIES_DIR) - if (DEFINED ENV{WEBKIT_LIBRARIES}) - set(WEBKIT_LIBRARIES_DIR "$ENV{WEBKIT_LIBRARIES}") - else () - set(WEBKIT_LIBRARIES_DIR "${CMAKE_SOURCE_DIR}/WebKitLibraries/win") - endif () - endif () - - include_directories("${CMAKE_BINARY_DIR}/DerivedSources/ForwardingHeaders" "${CMAKE_BINARY_DIR}/DerivedSources" "${WEBKIT_LIBRARIES_DIR}/include") - set(CMAKE_INCLUDE_PATH "${WEBKIT_LIBRARIES_DIR}/include") - # bundled FindZlib is strange - set(ZLIB_ROOT "${WEBKIT_LIBRARIES_DIR}/include") - if (${MSVC_CXX_ARCHITECTURE_ID} STREQUAL "X86") - link_directories("${CMAKE_BINARY_DIR}/lib32" "${WEBKIT_LIBRARIES_DIR}/lib32") - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib32) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib32) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin32) - set(CMAKE_LIBRARY_PATH "${WEBKIT_LIBRARIES_DIR}/lib32") - else () - link_directories("${CMAKE_BINARY_DIR}/lib64" "${WEBKIT_LIBRARIES_DIR}/lib64") - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib64) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib64) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin64) - set(CMAKE_LIBRARY_PATH "${WEBKIT_LIBRARIES_DIR}/lib64") - endif () - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}") - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}") - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") -endif () - if (DEFINED ENV{SQLITE3SRCDIR}) get_filename_component(SQLITE3SRC_ABS_DIR $ENV{SQLITE3SRCDIR} ABSOLUTE) set(SQLITE3_SOURCE_DIR ${SQLITE3SRC_ABS_DIR} CACHE PATH "Path to SQLite sources to use instead of system library" FORCE) |