diff options
Diffstat (limited to 'tests/auto/quick/qmltests/data/tst_getUserMedia.qml')
-rw-r--r-- | tests/auto/quick/qmltests/data/tst_getUserMedia.qml | 72 |
1 files changed, 22 insertions, 50 deletions
diff --git a/tests/auto/quick/qmltests/data/tst_getUserMedia.qml b/tests/auto/quick/qmltests/data/tst_getUserMedia.qml index d1c894699..9a876778b 100644 --- a/tests/auto/quick/qmltests/data/tst_getUserMedia.qml +++ b/tests/auto/quick/qmltests/data/tst_getUserMedia.qml @@ -1,34 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** 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 https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.2 -import QtTest 1.0 -import QtWebEngine 1.6 +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +import QtQuick +import QtTest +import QtWebEngine TestWebEngineView { id: webEngineView @@ -36,6 +11,7 @@ TestWebEngineView { height: 400 settings.screenCaptureEnabled: true + profile.persistentPermissionsPolicy: WebEngineProfile.NoPersistentPermissions TestCase { name: "GetUserMedia" @@ -46,17 +22,17 @@ TestWebEngineView { { tag: "device audio", constraints: { audio: true }, - feature: WebEngineView.MediaAudioCapture, + feature: WebEnginePermission.MediaAudioCapture, }, { tag: "device video", constraints: { video: true }, - feature: WebEngineView.MediaVideoCapture, + feature: WebEnginePermission.MediaVideoCapture, }, { tag: "device audio+video", constraints: { audio: true, video: true }, - feature: WebEngineView.MediaAudioVideoCapture, + feature: WebEnginePermission.MediaAudioVideoCapture, }, { tag: "desktop video", @@ -67,7 +43,7 @@ TestWebEngineView { } } }, - feature: WebEngineView.DesktopVideoCapture, + feature: WebEnginePermission.DesktopVideoCapture, }, { tag: "desktop audio+video", @@ -83,7 +59,7 @@ TestWebEngineView { } } }, - feature: WebEngineView.DesktopAudioVideoCapture, + feature: WebEnginePermission.DesktopAudioVideoCapture, } ] } @@ -126,8 +102,8 @@ TestWebEngineView { signalName: "loadFinished" } - onLoadingChanged: { - if (loadRequest.status == WebEngineLoadRequest.LoadSucceededStatus) { + onLoadingChanged: function(load) { + if (load.status == WebEngineView.LoadSucceededStatus) { loadFinished() } } @@ -140,28 +116,24 @@ TestWebEngineView { //// // synchronous permission requests - property variant requestedFeature - property variant requestedSecurityOrigin + property variant permissionObject - onFeaturePermissionRequested: { - requestedFeature = feature - requestedSecurityOrigin = securityOrigin + onPermissionRequested: function(perm) { + permissionObject = perm } function gotFeatureRequest(expectedFeature) { - return requestedFeature == expectedFeature + return permissionObject && permissionObject.feature == expectedFeature } function acceptPendingRequest() { - webEngineView.grantFeaturePermission(requestedSecurityOrigin, requestedFeature, true) - requestedFeature = undefined - requestedSecurityOrigin = undefined + permissionObject.grant() + permissionObject = undefined } function rejectPendingRequest() { - webEngineView.grantFeaturePermission(requestedSecurityOrigin, requestedFeature, false) - requestedFeature = undefined - requestedSecurityOrigin = undefined + permissionObject.deny() + permissionObject = undefined } //// |