~ubuntu-branches/ubuntu/raring/qtwebkit-source/raring-proposed

« back to all changes in this revision

Viewing changes to Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_geopermission.qml

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-02-18 14:24:18 UTC
  • Revision ID: package-import@ubuntu.com-20130218142418-eon0jmjg3nj438uy
Tags: upstream-2.3
ImportĀ upstreamĀ versionĀ 2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import QtQuick 2.0
 
2
import QtTest 1.0
 
3
import QtWebKit 3.0
 
4
import QtWebKit.experimental 1.0
 
5
 
 
6
WebView {
 
7
    id: webView
 
8
    width: 200
 
9
    height: 200
 
10
 
 
11
    property bool expectedPermission: false
 
12
 
 
13
    SignalSpy {
 
14
        id: spy
 
15
        target: experimental
 
16
        signalName: "permissionRequested"
 
17
    }
 
18
 
 
19
    experimental.onPermissionRequested: {
 
20
        //Must be false by default
 
21
        if (!permission.allow) {
 
22
           permission.allow = true
 
23
        } else
 
24
           console.log("Fail: permission must be set to false")
 
25
 
 
26
        if (permission.type == PermissionRequest.Geolocation) {
 
27
            console.log("Permission is geotype")
 
28
        }
 
29
    }
 
30
 
 
31
    TestCase {
 
32
        name: "WebViewGeopermission"
 
33
 
 
34
        // Delayed windowShown to workaround problems with Qt5 in debug mode.
 
35
        when: false
 
36
        Timer {
 
37
            running: parent.windowShown
 
38
            repeat: false
 
39
            interval: 1
 
40
            onTriggered: parent.when = true
 
41
        }
 
42
 
 
43
        function init() {
 
44
            spy.clear()
 
45
        }
 
46
 
 
47
        function test_permissionRequest() {
 
48
            compare(spy.count, 0)
 
49
            webView.url = Qt.resolvedUrl("../common/geolocation.html")
 
50
            spy.wait()
 
51
            compare(spy.count, 1)
 
52
        }
 
53
    }
 
54
}