diff options
Diffstat (limited to 'Source/WebKit2/UIProcess/API/qt/tests')
15 files changed, 159 insertions, 95 deletions
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/CMakeLists.txt b/Source/WebKit2/UIProcess/API/qt/tests/CMakeLists.txt new file mode 100644 index 000000000..b26366492 --- /dev/null +++ b/Source/WebKit2/UIProcess/API/qt/tests/CMakeLists.txt @@ -0,0 +1,93 @@ +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} +) + +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}) + +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}) 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/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 index 192e1bb1a..c042a3494 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp +++ b/Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp @@ -90,6 +90,7 @@ static QStringList expectedAPI = QStringList() << "QWebNavigationRequest.keyboardModifiers --> int" << "QWebNavigationRequest.action --> QQuickWebView::NavigationRequestAction" << "QWebNavigationRequest.navigationType --> QQuickWebView::NavigationType" + << "QWebNavigationRequest.isMainFrame --> bool" << "QWebNavigationRequest.actionChanged() --> void" ; 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/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 index e561e1a32..d25dcb9a8 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_applicationScheme.qml @@ -70,6 +70,7 @@ TestWebView { name: "WebViewApplicationSchemes" function test_applicationScheme() { + skip("QTFIXME: application schemes are not supported yet") var testUrl = "applicationScheme://something" webView.url = testUrl verify(webView.waitForLoadSucceeded()) @@ -77,6 +78,7 @@ TestWebView { } 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 @@ -90,6 +92,7 @@ TestWebView { } function test_multipleUrlsForScheme() { + skip("QTFIXME: application schemes are not supported yet") var testUrl = "scheme3://url1" webView.url = testUrl verify(webView.waitForLoadSucceeded()) @@ -103,6 +106,7 @@ TestWebView { } function test_charsets() { + skip("QTFIXME: application schemes are not supported yet") var testUrl = "schemeCharset://latin1" webView.url = testUrl verify(webView.waitForLoadSucceeded()) 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 index 720b4cd04..b4576af36 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_evaluateJavaScript.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_evaluateJavaScript.qml @@ -78,7 +78,43 @@ Item { resultSpy.wait() compare(JSON.stringify(webView.lastResult), - '{"child":{"level":2},"level":"1"}') + '{"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() { 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 index 26f30eedd..dfdcf7add 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_webchannel.qml +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_webchannel.qml @@ -1,32 +1,40 @@ /**************************************************************************** ** ** 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.io/licensing/ +** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtWebChannel module of the Qt Toolkit. ** -** $QT_BEGIN_LICENSE:LGPL21$ +** $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 The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. +** 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 or version 3 as published by the Free -** Software Foundation and appearing in the file LICENSE.LGPLv21 and -** LICENSE.LGPLv3 included in the packaging of this file. Please review the -** following information to ensure the GNU Lesser General Public License -** requirements will be met: https://www.gnu.org/licenses/lgpl.html and -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** 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. ** -** As a special exception, The Qt Company gives you certain additional -** rights. These rights are described in The Qt Company LGPL Exception +** 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$ ** ****************************************************************************/ @@ -64,7 +72,7 @@ Item { TestWebView { id: webView - experimental.windowObjects: [testObject] + experimental.webChannel.registeredObjects: [testObject] experimental.preferences.developerExtrasEnabled: true } diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/notification.html b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/notification.html index b53533eb0..e9186a4fd 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/notification.html +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/common/notification.html @@ -3,9 +3,9 @@ <title>Desktop Notification Permission test</title> <script> requestPermission = function(cb) { - window.webkitNotifications.requestPermission(function() { + window.Notification.requestPermission(function() { if (cb) - cb(window.webkitNotifications.checkPermission() == 0); + cb(window.Notification.permission); }); } requestPermission() 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/tst_qmltests.cpp b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp index ab57556bd..e681daa0d 100644 --- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp +++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/tst_qmltests.cpp @@ -21,7 +21,6 @@ #include "../util.h" #include "private/qquickwebview_p.h" -#include <QGuiApplication> #include <QVarLengthArray> #include <QtQuickTest/quicktest.h> @@ -40,9 +39,6 @@ int main(int argc, char** argv) suppressDebugOutput(); addQtWebProcessToPath(); - // Instantiate QApplication to prevent quick_test_main to instantiate a QGuiApplication. - // This can be removed as soon as we do not use QtWidgets any more. - QGuiApplication app(argc, argv); qmlRegisterType<ByteArrayTestData>("Test", 1, 0, "ByteArrayTestData"); #ifdef DISABLE_FLICKABLE_VIEWPORT 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/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/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\\\" |