summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/quick/publicapi/tst_publicapi.cpp13
-rw-r--r--tests/auto/quick/qmltests/data/alert.html8
-rw-r--r--tests/auto/quick/qmltests/data/confirm.html19
-rw-r--r--tests/auto/quick/qmltests/data/prompt.html12
-rw-r--r--tests/auto/quick/qmltests/data/tst_findText.qml15
-rw-r--r--tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml109
-rw-r--r--tests/auto/quick/qmltests/data/tst_loadFail.qml92
-rw-r--r--tests/auto/quick/qmltests/data/tst_navigationHistory.qml11
-rw-r--r--tests/auto/quick/qmltests/qmltests.pro23
-rw-r--r--tests/quicktestbrowser/BrowserWindow.qml96
-rw-r--r--tests/quicktestbrowser/utils.h6
11 files changed, 347 insertions, 57 deletions
diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp
index 98e52352f..1cf2e37c4 100644
--- a/tests/auto/quick/publicapi/tst_publicapi.cpp
+++ b/tests/auto/quick/publicapi/tst_publicapi.cpp
@@ -73,6 +73,7 @@ static QList<const QMetaObject *> typesToCheck = QList<const QMetaObject *>()
<< &QQuickWebEngineNewViewRequest::staticMetaObject
<< &QQuickWebEngineProfile::staticMetaObject
<< &QQuickWebEngineScript::staticMetaObject
+ << &QQuickWebEngineFullScreenRequest::staticMetaObject
;
static QList<const char *> knownEnumNames = QList<const char *>();
@@ -127,6 +128,7 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.icon --> QUrl"
<< "QQuickWebEngineView.canGoBack --> bool"
<< "QQuickWebEngineView.canGoForward --> bool"
+ << "QQuickWebEngineView.isFullScreen --> bool"
<< "QQuickWebEngineView.loading --> bool"
<< "QQuickWebEngineView.loadProgress --> int"
<< "QQuickWebEngineView.titleChanged() --> void"
@@ -138,6 +140,9 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineView.iconChanged() --> void"
<< "QQuickWebEngineView.linkHovered(QUrl) --> void"
<< "QQuickWebEngineView.navigationRequested(QQuickWebEngineNavigationRequest*) --> void"
+ << "QQuickWebEngineView.fullScreenRequested(QQuickWebEngineFullScreenRequest) --> void"
+ << "QQuickWebEngineView.isFullScreenChanged() --> void"
+ << "QQuickWebEngineView.fullScreenCancelled() --> void"
<< "QQuickWebEngineView.runJavaScript(QString,QJSValue) --> void"
<< "QQuickWebEngineView.runJavaScript(QString) --> void"
<< "QQuickWebEngineView.loadHtml(QString,QUrl) --> void"
@@ -218,21 +223,23 @@ static QStringList expectedAPI = QStringList()
<< "QQuickWebEngineScript.ApplicationWorld --> ScriptWorldId"
<< "QQuickWebEngineScript.UserWorld --> ScriptWorldId"
<< "QQuickWebEngineScript.name --> QString"
- << "QQuickWebEngineScript.source --> QString"
+ << "QQuickWebEngineScript.sourceCode --> QString"
<< "QQuickWebEngineScript.injectionPoint --> InjectionPoint"
<< "QQuickWebEngineScript.worldId --> ScriptWorldId"
<< "QQuickWebEngineScript.runOnSubframes --> bool"
<< "QQuickWebEngineScript.nameChanged(QString) --> void"
- << "QQuickWebEngineScript.sourceChanged(QString) --> void"
+ << "QQuickWebEngineScript.sourceCodeChanged(QString) --> void"
<< "QQuickWebEngineScript.injectionPointChanged(InjectionPoint) --> void"
<< "QQuickWebEngineScript.worldIdChanged(ScriptWorldId) --> void"
<< "QQuickWebEngineScript.runOnSubframesChanged(bool) --> void"
<< "QQuickWebEngineScript.setName(QString) --> void"
- << "QQuickWebEngineScript.setSource(QString) --> void"
+ << "QQuickWebEngineScript.setSourceCode(QString) --> void"
<< "QQuickWebEngineScript.setInjectionPoint(InjectionPoint) --> void"
<< "QQuickWebEngineScript.setWorldId(ScriptWorldId) --> void"
<< "QQuickWebEngineScript.setRunOnSubframes(bool) --> void"
<< "QQuickWebEngineScript.toString() --> QString"
+ << "QQuickWebEngineFullScreenRequest.toggleOn --> bool"
+ << "QQuickWebEngineFullScreenRequest.accept() --> void"
;
static bool isCheckedEnum(const QByteArray &typeName)
diff --git a/tests/auto/quick/qmltests/data/alert.html b/tests/auto/quick/qmltests/data/alert.html
new file mode 100644
index 000000000..39a853519
--- /dev/null
+++ b/tests/auto/quick/qmltests/data/alert.html
@@ -0,0 +1,8 @@
+<!doctype html>
+<html>
+<head>
+ <script> alert("Hello Qt"); </script>
+</head>
+<body>
+</body>
+</html>
diff --git a/tests/auto/quick/qmltests/data/confirm.html b/tests/auto/quick/qmltests/data/confirm.html
new file mode 100644
index 000000000..d7256a883
--- /dev/null
+++ b/tests/auto/quick/qmltests/data/confirm.html
@@ -0,0 +1,19 @@
+<!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/tests/auto/quick/qmltests/data/prompt.html b/tests/auto/quick/qmltests/data/prompt.html
new file mode 100644
index 000000000..ae5fbd07a
--- /dev/null
+++ b/tests/auto/quick/qmltests/data/prompt.html
@@ -0,0 +1,12 @@
+<!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/tests/auto/quick/qmltests/data/tst_findText.qml b/tests/auto/quick/qmltests/data/tst_findText.qml
index 1cb23a1c4..5f72c52fa 100644
--- a/tests/auto/quick/qmltests/data/tst_findText.qml
+++ b/tests/auto/quick/qmltests/data/tst_findText.qml
@@ -42,7 +42,6 @@
import QtQuick 2.0
import QtTest 1.0
import QtWebEngine 1.1
-import QtWebEngine.experimental 1.0
TestWebEngineView {
id: webEngineView
@@ -67,12 +66,12 @@ TestWebEngineView {
name: "WebViewFindText"
function test_findText() {
- var findFlags = WebEngineViewExperimental.FindCaseSensitively
+ var findFlags = WebEngineView.FindCaseSensitively
webEngineView.url = Qt.resolvedUrl("test1.html")
verify(webEngineView.waitForLoadSucceeded())
webEngineView.clear()
- webEngineView.experimental.findText("Hello", findFlags, webEngineView.findTextCallback)
+ webEngineView.findText("Hello", findFlags, webEngineView.findTextCallback)
tryCompare(webEngineView, "matchCount", 1)
verify(!findFailed)
}
@@ -83,7 +82,7 @@ TestWebEngineView {
verify(webEngineView.waitForLoadSucceeded())
webEngineView.clear()
- webEngineView.experimental.findText("heLLo", findFlags, webEngineView.findTextCallback)
+ webEngineView.findText("heLLo", findFlags, webEngineView.findTextCallback)
tryCompare(webEngineView, "matchCount", 1)
verify(!findFailed)
}
@@ -94,19 +93,19 @@ TestWebEngineView {
verify(webEngineView.waitForLoadSucceeded())
webEngineView.clear()
- webEngineView.experimental.findText("bla", findFlags, webEngineView.findTextCallback)
+ webEngineView.findText("bla", findFlags, webEngineView.findTextCallback)
tryCompare(webEngineView, "matchCount", 100)
verify(!findFailed)
}
function test_findTextFailCaseSensitive() {
- var findFlags = WebEngineViewExperimental.FindCaseSensitively
+ var findFlags = WebEngineView.FindCaseSensitively
webEngineView.url = Qt.resolvedUrl("test1.html")
verify(webEngineView.waitForLoadSucceeded())
webEngineView.clear()
- webEngineView.experimental.findText("heLLo", findFlags, webEngineView.findTextCallback)
+ webEngineView.findText("heLLo", findFlags, webEngineView.findTextCallback)
tryCompare(webEngineView, "matchCount", 0)
verify(findFailed)
}
@@ -117,7 +116,7 @@ TestWebEngineView {
verify(webEngineView.waitForLoadSucceeded())
webEngineView.clear()
- webEngineView.experimental.findText("string-that-is-not-threre", findFlags, webEngineView.findTextCallback)
+ webEngineView.findText("string-that-is-not-threre", findFlags, webEngineView.findTextCallback)
tryCompare(webEngineView, "matchCount", 0)
verify(findFailed)
}
diff --git a/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml b/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml
new file mode 100644
index 000000000..da04fbd92
--- /dev/null
+++ b/tests/auto/quick/qmltests/data/tst_javaScriptDialogs.qml
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Quick Controls 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 QtWebEngine 1.0
+import QtWebEngine.testsupport 1.0
+
+TestWebEngineView {
+ id: webEngineView
+
+ property string messageFromAlertDialog: ""
+ property int confirmCount: 0
+ property int promptCount: 0
+
+ testSupport: WebEngineTestSupport {
+ onAlertDialog: {
+ webEngineView.messageFromAlertDialog = dialog.message
+ dialog.accept()
+ }
+
+ onConfirmDialog: {
+ webEngineView.confirmCount += 1
+ if (dialog.message == "ACCEPT")
+ dialog.accept()
+ else
+ dialog.reject()
+ }
+
+ onPromptDialog: {
+ webEngineView.promptCount += 1
+ if (dialog.message == "REJECT")
+ dialog.reject()
+ else {
+ var reversedDefaultValue = dialog.defaultValue.split("").reverse().join("")
+ dialog.accept(reversedDefaultValue)
+ }
+ }
+ }
+
+ TestCase {
+ id: test
+ name: "WebEngineViewJavaScriptDialogs"
+
+ function init() {
+ webEngineView.messageFromAlertDialog = ""
+ webEngineView.confirmCount = 0
+ webEngineView.promptCount = 0
+ }
+
+ function test_alert() {
+ webEngineView.url = Qt.resolvedUrl("alert.html")
+ verify(webEngineView.waitForLoadSucceeded())
+ compare(webEngineView.messageFromAlertDialog, "Hello Qt")
+ }
+
+ function test_confirm() {
+ webEngineView.url = Qt.resolvedUrl("confirm.html")
+ verify(webEngineView.waitForLoadSucceeded())
+ compare(webEngineView.confirmCount, 2)
+ compare(webEngineView.title, "ACCEPTED REJECTED")
+ }
+
+ function test_prompt() {
+ webEngineView.url = Qt.resolvedUrl("prompt.html")
+ verify(webEngineView.waitForLoadSucceeded())
+ compare(webEngineView.promptCount, 2)
+ compare(webEngineView.title, "tQ olleH")
+ }
+ }
+}
diff --git a/tests/auto/quick/qmltests/data/tst_loadFail.qml b/tests/auto/quick/qmltests/data/tst_loadFail.qml
index e88d82903..7b5bbe2e2 100644
--- a/tests/auto/quick/qmltests/data/tst_loadFail.qml
+++ b/tests/auto/quick/qmltests/data/tst_loadFail.qml
@@ -43,36 +43,69 @@ import QtQuick 2.0
import QtTest 1.0
import QtWebEngine 1.1
import QtWebEngine.experimental 1.0
+import QtWebEngine.testsupport 1.0
TestWebEngineView {
id: webEngineView
width: 400
height: 300
- property variant unavailableUrl
+ property var unavailableUrl: Qt.resolvedUrl("file_that_does_not_exist.html")
+ property var loadRequestArray: []
+
+ testSupport: WebEngineTestSupport {
+ property var errorPageLoadStatus: null
+
+ function waitForErrorPageLoadSucceeded() {
+ var success = _waitFor(function() { return testSupport.errorPageLoadStatus == WebEngineView.LoadSucceededStatus })
+ testSupport.errorPageLoadStatus = null
+ return success
+ }
+
+ errorPage.onLoadingChanged: {
+ errorPageLoadStatus = loadRequest.status
+
+ loadRequestArray.push({
+ "status": loadRequest.status,
+ "url": loadRequest.url.toString(),
+ "errorDomain": loadRequest.errorDomain,
+ "isErrorPage": true
+ })
+ }
+ }
+
+ onLoadingChanged: {
+ if (loadRequest.status == WebEngineView.LoadFailedStatus) {
+ test.compare(loadRequest.url, unavailableUrl)
+ test.compare(loadRequest.errorDomain, WebEngineView.InternalErrorDomain)
+ }
+
+ loadRequestArray.push({
+ "status": loadRequest.status,
+ "url": loadRequest.url.toString(),
+ "errorDomain": loadRequest.errorDomain,
+ "isErrorPage": false
+ })
+ }
TestCase {
id: test
name: "WebEngineViewLoadFail"
- function initTestCase() {
- WebEngine.settings.errorPageEnabled = false
- }
-
function test_fail() {
- unavailableUrl = Qt.resolvedUrl("file_that_does_not_exist.html")
+ WebEngine.settings.errorPageEnabled = false
webEngineView.url = unavailableUrl
verify(webEngineView.waitForLoadFailed())
}
function test_fail_url() {
+ WebEngine.settings.errorPageEnabled = false
var url = Qt.resolvedUrl("test1.html")
webEngineView.url = url
compare(webEngineView.url, url)
verify(webEngineView.waitForLoadSucceeded())
compare(webEngineView.url, url)
- unavailableUrl = Qt.resolvedUrl("file_that_does_not_exist.html")
webEngineView.url = unavailableUrl
compare(webEngineView.url, unavailableUrl)
verify(webEngineView.waitForLoadFailed())
@@ -80,12 +113,47 @@ TestWebEngineView {
// We expect the url of the previously loaded page here.
compare(webEngineView.url, url)
}
- }
- onLoadingChanged: {
- if (loadRequest.status == WebEngineView.LoadFailedStatus) {
- test.compare(loadRequest.url, unavailableUrl)
- test.compare(loadRequest.errorDomain, WebEngineView.InternalErrorDomain)
+ function test_error_page() {
+ WebEngine.settings.errorPageEnabled = true
+ webEngineView.url = unavailableUrl
+
+ // Loading of the error page must be successful
+ verify(webEngineView.testSupport.waitForErrorPageLoadSucceeded())
+
+ var loadRequest = null
+ compare(loadRequestArray.length, 4)
+
+ // Start to load unavailableUrl
+ loadRequest = loadRequestArray[0]
+ compare(loadRequest.status, WebEngineView.LoadStartedStatus)
+ compare(loadRequest.errorDomain, WebEngineView.NoErrorDomain)
+ compare(loadRequest.url, unavailableUrl)
+ verify(!loadRequest.isErrorPage)
+
+ // Loading of the unavailableUrl must fail
+ loadRequest = loadRequestArray[1]
+ compare(loadRequest.status, WebEngineView.LoadFailedStatus)
+ compare(loadRequest.errorDomain, WebEngineView.InternalErrorDomain)
+ compare(loadRequest.url, unavailableUrl)
+ verify(!loadRequest.isErrorPage)
+
+ // Start to load error page
+ loadRequest = loadRequestArray[2]
+ compare(loadRequest.status, WebEngineView.LoadStartedStatus)
+ compare(loadRequest.errorDomain, WebEngineView.NoErrorDomain)
+ compare(loadRequest.url, "data:text/html,chromewebdata")
+ verify(loadRequest.isErrorPage)
+
+ // Loading of the error page must be successful
+ loadRequest = loadRequestArray[3]
+ compare(loadRequest.status, WebEngineView.LoadSucceededStatus)
+ compare(loadRequest.errorDomain, WebEngineView.NoErrorDomain)
+ compare(loadRequest.url, "data:text/html,chromewebdata")
+ verify(loadRequest.isErrorPage)
+
+ compare(webEngineView.url, unavailableUrl)
+ compare(webEngineView.title, unavailableUrl + " is not found")
}
}
}
diff --git a/tests/auto/quick/qmltests/data/tst_navigationHistory.qml b/tests/auto/quick/qmltests/data/tst_navigationHistory.qml
index 335d9155e..ea56cc29e 100644
--- a/tests/auto/quick/qmltests/data/tst_navigationHistory.qml
+++ b/tests/auto/quick/qmltests/data/tst_navigationHistory.qml
@@ -42,7 +42,6 @@
import QtQuick 2.0
import QtTest 1.0
import QtWebEngine 1.1
-import QtWebEngine.experimental 1.0
TestWebEngineView {
id: webEngineView
@@ -52,7 +51,7 @@ TestWebEngineView {
ListView {
id: backItemsList
anchors.fill: parent
- model: webEngineView.experimental.navigationHistory.backItems
+ model: webEngineView.navigationHistory.backItems
currentIndex: count - 1
delegate:
Text {
@@ -64,7 +63,7 @@ TestWebEngineView {
ListView {
id: forwardItemsList
anchors.fill: parent
- model: webEngineView.experimental.navigationHistory.forwardItems
+ model: webEngineView.navigationHistory.forwardItems
currentIndex: 0
delegate:
Text {
@@ -94,7 +93,7 @@ TestWebEngineView {
compare(backItemsList.count, 1)
compare(backItemsList.currentItem.text, Qt.resolvedUrl("test1.html"))
- webEngineView.experimental.goBackTo(0)
+ webEngineView.goBackOrForward(-1)
verify(webEngineView.waitForLoadSucceeded())
compare(webEngineView.url, Qt.resolvedUrl("test1.html"))
compare(webEngineView.canGoBack, false)
@@ -121,7 +120,7 @@ TestWebEngineView {
compare(forwardItemsList.count, 0)
compare(backItemsList.currentItem.text, Qt.resolvedUrl("test1.html"))
- webEngineView.experimental.goBackTo(1)
+ webEngineView.goBackOrForward(-2)
verify(webEngineView.waitForLoadSucceeded())
compare(webEngineView.url, Qt.resolvedUrl("test1.html"))
compare(webEngineView.canGoBack, false)
@@ -130,7 +129,7 @@ TestWebEngineView {
compare(forwardItemsList.count, 2)
compare(forwardItemsList.currentItem.text, Qt.resolvedUrl("test2.html"))
- webEngineView.experimental.goForwardTo(1)
+ webEngineView.goBackOrForward(2)
verify(webEngineView.waitForLoadSucceeded())
compare(webEngineView.url, Qt.resolvedUrl("javascript.html"))
compare(webEngineView.canGoBack, true)
diff --git a/tests/auto/quick/qmltests/qmltests.pro b/tests/auto/quick/qmltests/qmltests.pro
index 6789b714b..4b6795ae1 100644
--- a/tests/auto/quick/qmltests/qmltests.pro
+++ b/tests/auto/quick/qmltests/qmltests.pro
@@ -6,11 +6,14 @@ IMPORTPATH += $$PWD/data
OTHER_FILES += \
$$PWD/data/TestWebEngineView.qml \
+ $$PWD/data/alert.html \
+ $$PWD/data/confirm.html \
$$PWD/data/favicon.html \
$$PWD/data/favicon.png \
$$PWD/data/favicon2.html \
$$PWD/data/javascript.html \
$$PWD/data/link.html \
+ $$PWD/data/prompt.html \
$$PWD/data/redirect.html \
$$PWD/data/small-favicon.png \
$$PWD/data/test1.html \
@@ -20,6 +23,7 @@ OTHER_FILES += \
$$PWD/data/keyboardModifierMapping.html \
$$PWD/data/tst_desktopBehaviorLoadHtml.qml \
$$PWD/data/tst_favIconLoad.qml \
+ $$PWD/data/tst_javaScriptDialogs.qml \
$$PWD/data/tst_linkHovered.qml \
$$PWD/data/tst_loadFail.qml \
$$PWD/data/tst_loadHtml.qml \
@@ -37,3 +41,22 @@ OTHER_FILES += \
load(qt_build_paths)
DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$PWD$${QMAKE_DIR_SEP}data\\\"\"
+
+!isQMLTestSupportApiEnabled() {
+ PLUGIN_EXTENSION = .so
+ PLUGIN_PREFIX = lib
+ osx: PLUGIN_PREFIX = .dylib
+ win32 {
+ PLUGIN_EXTENSION = .dll
+ PLUGIN_PREFIX =
+ }
+
+ TESTSUPPORT_MODULE = $$shell_path($$[QT_INSTALL_QML]/QtWebEngine/testsupport/$${PLUGIN_PREFIX}qtwebenginetestsupportplugin$${PLUGIN_EXTENSION})
+ BUILD_DIR = $$shell_path($$clean_path($$OUT_PWD/../../../..))
+ SRC_DIR = $$shell_path($$clean_path($$PWD/../../../..))
+
+ warning("QML Test Support API is disabled. This means some QML tests that use Test Support API will fail.")
+ warning("Use the following command to build Test Support module and rebuild WebEngineView API:")
+ warning("cd $$BUILD_DIR && qmake WEBENGINE_CONFIG+=testsupport -r $$shell_path($$SRC_DIR/qtwebengine.pro) && make -C $$shell_path($$BUILD_DIR/src/webengine) clean && make")
+ warning("After performing the command above make sure QML module \"QtWebEngine.testsupport\" is deployed at $$TESTSUPPORT_MODULE")
+}
diff --git a/tests/quicktestbrowser/BrowserWindow.qml b/tests/quicktestbrowser/BrowserWindow.qml
index 2c8e9e1ea..9e9f73646 100644
--- a/tests/quicktestbrowser/BrowserWindow.qml
+++ b/tests/quicktestbrowser/BrowserWindow.qml
@@ -54,12 +54,16 @@ ApplicationWindow {
id: browserWindow
property QtObject applicationRoot
property Item currentWebView: tabs.currentIndex < tabs.count ? tabs.getTab(tabs.currentIndex).item.webView : null
+ property int previousVisibility: Window.Windowed
property bool isFullScreen: visibility == Window.FullScreen
onIsFullScreenChanged: {
// This is for the case where the system forces us to leave fullscreen.
- if (currentWebView)
- currentWebView.state = isFullScreen ? "FullScreen" : ""
+ if (currentWebView && !isFullScreen) {
+ currentWebView.state = ""
+ if (currentWebView.isFullScreen)
+ currentWebView.fullScreenCancelled()
+ }
}
height: 600
@@ -89,7 +93,7 @@ ApplicationWindow {
offTheRecord: true
}
- // Make sure the Qt.WindowFullscreenButtonHint is set on Mac.
+ // Make sure the Qt.WindowFullscreenButtonHint is set on OS X.
Component.onCompleted: flags = flags | Qt.WindowFullscreenButtonHint
// Create a styleItem to determine the platform.
@@ -141,7 +145,7 @@ ApplicationWindow {
shortcut: "Escape"
onTriggered: {
if (browserWindow.isFullScreen)
- browserWindow.showNormal()
+ browserWindow.visibility = browserWindow.previousVisibility
}
}
Action {
@@ -357,10 +361,12 @@ ApplicationWindow {
]
onCertificateError: {
- sslDialog.certError = error
- sslDialog.text = "Certificate Error: " + error.description
- sslDialog.visible = true
- error.defer()
+ if (!acceptedCertificates.shouldAutoAccept(error)){
+ error.defer()
+ sslDialog.enqueue(error)
+ } else{
+ error.ignoreCertificateError()
+ }
}
onNewViewRequested: {
@@ -378,18 +384,19 @@ ApplicationWindow {
}
}
- experimental {
- isFullScreen: webEngineView.state == "FullScreen" && browserWindow.isFullScreen
- onFullScreenRequested: {
- if (fullScreen) {
- webEngineView.state = "FullScreen"
- browserWindow.showFullScreen();
- } else {
- webEngineView.state = ""
- browserWindow.showNormal();
- }
+ onFullScreenRequested: {
+ if (request.toggleOn) {
+ webEngineView.state = "FullScreen"
+ browserWindow.previousVisibility = browserWindow.visibility
+ browserWindow.showFullScreen()
+ } else {
+ webEngineView.state = ""
+ browserWindow.visibility = browserWindow.previousVisibility
}
+ request.accept()
+ }
+ experimental {
onFeaturePermissionRequested: {
permBar.securityOrigin = securityOrigin;
permBar.requestedFeature = feature;
@@ -416,18 +423,18 @@ ApplicationWindow {
TextField {
id: findTextField
onAccepted: {
- webEngineView.experimental.findText(text, 0)
+ webEngineView.findText(text)
}
}
ToolButton {
id: findBackwardButton
iconSource: "icons/go-previous.png"
- onClicked: webEngineView.experimental.findText(findTextField.text, WebEngineViewExperimental.FindBackward)
+ onClicked: webEngineView.findText(findTextField.text, WebEngineView.FindBackward)
}
ToolButton {
id: findForwardButton
iconSource: "icons/go-next.png"
- onClicked: webEngineView.experimental.findText(findTextField.text, 0)
+ onClicked: webEngineView.findText(findTextField.text)
}
ToolButton {
id: findCancelButton
@@ -440,17 +447,50 @@ ApplicationWindow {
}
}
+ QtObject{
+ id:acceptedCertificates
+
+ property var acceptedUrls : []
+
+ function shouldAutoAccept(certificateError){
+ var domain = utils.domainFromString(certificateError.url)
+ return acceptedUrls.indexOf(domain) >= 0
+ }
+ }
+
MessageDialog {
id: sslDialog
- property var certError
-
- standardButtons: StandardButton.Cancel | StandardButton.Ok
- visible: false
- title: "Do you want to accept this certificate?"
+ property var certErrors: []
+ icon: StandardIcon.Warning
+ standardButtons: StandardButton.No | StandardButton.Yes
+ title: "Server's certificate not trusted"
+ text: "Do you wish to continue?"
+ detailedText: "If you wish so, you may continue with an unverified certificate. " +
+ "Accepting an unverified certificate means " +
+ "you may not be connected with the host you tried to connect to.\n" +
+ "Do you wish to override the security check and continue?"
+ onYes: {
+ var cert = certErrors.shift()
+ var domain = utils.domainFromString(cert.url)
+ acceptedCertificates.acceptedUrls.push(domain)
+ cert.ignoreCertificateError()
+ presentError()
+ }
+ onNo: reject()
+ onRejected: reject()
- onAccepted: certError.ignoreCertificateError()
- onRejected: certError.rejectCertificate()
+ function reject(){
+ certErrors.shift().rejectCertificate()
+ presentError()
+ }
+ function enqueue(error){
+ certErrors.push(error)
+ presentError()
+ }
+ function presentError(){
+ visible = certErrors.length > 0
+ }
}
DownloadView {
diff --git a/tests/quicktestbrowser/utils.h b/tests/quicktestbrowser/utils.h
index 0f4460dfe..52025b7e4 100644
--- a/tests/quicktestbrowser/utils.h
+++ b/tests/quicktestbrowser/utils.h
@@ -48,6 +48,7 @@ class Utils : public QObject {
Q_OBJECT
public:
Q_INVOKABLE static QUrl fromUserInput(const QString& userInput);
+ Q_INVOKABLE static QString domainFromString(const QString& urlString);
};
inline QUrl Utils::fromUserInput(const QString& userInput)
@@ -58,4 +59,9 @@ inline QUrl Utils::fromUserInput(const QString& userInput)
return QUrl::fromUserInput(userInput);
}
+inline QString Utils::domainFromString(const QString& urlString)
+{
+ return QUrl::fromUserInput(urlString).host();
+}
+
#endif // UTILS_H