summaryrefslogtreecommitdiffstats
path: root/tests/manual/quick/geopermission/tst_geopermission.qml
blob: ff9c79f1d0655bc650c7e692a92da57111c75f36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

import QtQuick
import QtTest
import QtWebEngine

WebEngineView {
    id: webEngineView
    width: 200
    height: 200
    url: Qt.resolvedUrl("qrc:/geolocation.html")
    property bool deniedGeolocation: false
    property bool geoPermissionRequested: false

    onPermissionRequested: function(perm) {
        if (perm.permissionType === WebEnginePermission.PermissionType.Geolocation) {
            geoPermissionRequested = true
            if (deniedGeolocation) {
                perm.deny()
            }
            else {
                perm.grant()
            }
        }
    }

}