From d0ce6ce776852c1fab3d349ee709e5ac49f18796 Mon Sep 17 00:00:00 2001 From: Adam Kallai Date: Thu, 13 Aug 2015 13:57:14 +0200 Subject: Update the expected list of public API testcase Change-Id: I5cec5789149e3a9ed8b6752646f1879bb3dd56aa Reviewed-by: Joerg Bornemann --- tests/auto/quick/publicapi/tst_publicapi.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'tests/auto/quick') diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp index eb925b178..8f0c2f6ec 100644 --- a/tests/auto/quick/publicapi/tst_publicapi.cpp +++ b/tests/auto/quick/publicapi/tst_publicapi.cpp @@ -169,6 +169,7 @@ static QStringList expectedAPI = QStringList() << "QQuickWebEngineView.zoomFactor --> double" << "QQuickWebEngineView.zoomFactorChanged(double) --> void" << "QQuickWebEngineView.profile --> QQuickWebEngineProfile*" + << "QQuickWebEngineView.profileChanged() --> void" << "QQuickWebEngineView.navigationHistory --> QQuickWebEngineHistory*" << "QQuickWebEngineView.newViewRequested(QQuickWebEngineNewViewRequest*) --> void" << "QQuickWebEngineView.userScripts --> QQmlListProperty" -- cgit v1.2.3 From bbf750845908d1663fabf94a7babcfa07ec24c69 Mon Sep 17 00:00:00 2001 From: Adam Kallai Date: Wed, 5 Aug 2015 09:04:30 -0700 Subject: Add tst_geopermission QML test case Change-Id: Icfb74f3ef8b0745d3fc0a7335f8344960a74fa0b Reviewed-by: Joerg Bornemann --- tests/auto/quick/qmltests/data/geolocation.html | 26 +++++ .../auto/quick/qmltests/data/tst_geopermission.qml | 105 +++++++++++++++++++++ tests/auto/quick/qmltests/qmltests.pro | 2 + 3 files changed, 133 insertions(+) create mode 100644 tests/auto/quick/qmltests/data/geolocation.html create mode 100644 tests/auto/quick/qmltests/data/tst_geopermission.qml (limited to 'tests/auto/quick') diff --git a/tests/auto/quick/qmltests/data/geolocation.html b/tests/auto/quick/qmltests/data/geolocation.html new file mode 100644 index 000000000..c095a6b9e --- /dev/null +++ b/tests/auto/quick/qmltests/data/geolocation.html @@ -0,0 +1,26 @@ + + +Geolocation Permission API Test + + + +
Location unknown
+ + + diff --git a/tests/auto/quick/qmltests/data/tst_geopermission.qml b/tests/auto/quick/qmltests/data/tst_geopermission.qml new file mode 100644 index 000000000..acb561825 --- /dev/null +++ b/tests/auto/quick/qmltests/data/tst_geopermission.qml @@ -0,0 +1,105 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtWebEngine 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 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. +** +** 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. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company 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.2 +import QtTest 1.0 +import QtWebEngine 1.1 + +TestWebEngineView { + id: webEngineView + width: 200 + height: 200 + + property bool deniedGeolocation: false + property bool geoPermissionRequested: false + property string consoleErrorMessage: "" + + SignalSpy { + id: featurePermissionSpy + target: webEngineView + signalName: "featurePermissionRequested" + } + + onFeaturePermissionRequested: { + if (feature === WebEngineView.Geolocation) { + geoPermissionRequested = true + if (deniedGeolocation) { + webEngineView.grantFeaturePermission(securityOrigin, feature, false) + } + else { + webEngineView.grantFeaturePermission(securityOrigin, feature, true) + } + } + } + + onJavaScriptConsoleMessage: { + if (level === WebEngineView.ErrorMessageLevel) + consoleErrorMessage = message + } + + TestCase { + name: "WebViewGeopermission" + when: windowShown + + function init() { + deniedGeolocation = false + consoleErrorMessage = "" + featurePermissionSpy.clear() + } + + function test_geoPermissionRequest() { + compare(featurePermissionSpy.count, 0) + webEngineView.url = Qt.resolvedUrl("geolocation.html") + featurePermissionSpy.wait() + verify(geoPermissionRequested) + compare(featurePermissionSpy.count, 1) + if (consoleErrorMessage) // Print the error message if it fails to get user's location + fail(consoleErrorMessage) + } + + function test_deniedGeolocationByUser() { + deniedGeolocation = true + webEngineView.url = Qt.resolvedUrl("geolocation.html") + featurePermissionSpy.wait() + compare(consoleErrorMessage, "User denied Geolocation") + } + } +} diff --git a/tests/auto/quick/qmltests/qmltests.pro b/tests/auto/quick/qmltests/qmltests.pro index 68e9dc002..9f6f55275 100644 --- a/tests/auto/quick/qmltests/qmltests.pro +++ b/tests/auto/quick/qmltests/qmltests.pro @@ -15,6 +15,7 @@ OTHER_FILES += \ $$PWD/data/favicon.html \ $$PWD/data/favicon.png \ $$PWD/data/favicon2.html \ + $$PWD/data/geolocation.html \ $$PWD/data/javascript.html \ $$PWD/data/link.html \ $$PWD/data/prompt.html \ @@ -28,6 +29,7 @@ OTHER_FILES += \ $$PWD/data/tst_desktopBehaviorLoadHtml.qml \ $$PWD/data/tst_download.qml \ $$PWD/data/tst_favIconLoad.qml \ + $$PWD/data/tst_geopermission.qml \ $$PWD/data/tst_javaScriptDialogs.qml \ $$PWD/data/tst_linkHovered.qml \ $$PWD/data/tst_loadFail.qml \ -- cgit v1.2.3