diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2016-07-27 09:14:52 +0200 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2016-08-24 21:24:30 +0000 |
commit | 822763ddda98f04339df44641f9b0d0f72ff6466 (patch) | |
tree | b46d1bb211165acb3445ddc6bbb92d723726387f /tests/auto/quick | |
parent | 7da3fa4e73a37b0d63a98a4d476447071075935f (diff) |
Autocomplete view-source URL
User may miss the URL scheme (eg. http://) when type a view-source url
into the browser's location bar (eg. view-source:qt.io). This is not
handled by the Chromium thus will produce an empty view-source page.
The new autocompletion extends the incomplete view-source URL thus it
will provide valid URL if it is possible (eg. view-source:http://qt.io/)
Change-Id: I3edcd271cd0a971c9754e875db8f2a55a9a545de
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto/quick')
-rw-r--r-- | tests/auto/quick/qmltests/data/tst_viewSource.qml | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/quick/qmltests/data/tst_viewSource.qml b/tests/auto/quick/qmltests/data/tst_viewSource.qml index 7c7dd34e0..746bfcfb3 100644 --- a/tests/auto/quick/qmltests/data/tst_viewSource.qml +++ b/tests/auto/quick/qmltests/data/tst_viewSource.qml @@ -63,6 +63,9 @@ TestWebEngineView { name: "WebEngineViewSource" function init() { + webEngineView.url = Qt.resolvedUrl("about:blank"); + verify(webEngineView.waitForLoadSucceeded()); + newViewRequestedSpy.clear(); titleChangedSpy.clear(); viewRequest = null; @@ -88,6 +91,37 @@ TestWebEngineView { compare(webEngineView.title, "test1.html"); compare(webEngineView.url, "view-source:" + Qt.resolvedUrl("test1.html")); } + + function test_viewSourceURL_data() { + var testLocalUrl = "view-source:" + Qt.resolvedUrl("test1.html"); + var testLocalUrlWithoutScheme = "view-source:" + Qt.resolvedUrl("test1.html").substring(7); + + return [ + { tag: "view-source:", userInputUrl: "view-source:", loadSucceed: true, url: "view-source:", title: "view-source:" }, + { tag: "view-source:about:blank", userInputUrl: "view-source:about:blank", loadSucceed: true, url: "view-source:about:blank", title: "view-source:about:blank" }, + { tag: testLocalUrl, userInputUrl: testLocalUrl, loadSucceed: true, url: testLocalUrl, title: "test1.html" }, + { tag: testLocalUrlWithoutScheme, userInputUrl: testLocalUrlWithoutScheme, loadSucceed: true, url: testLocalUrl, title: "test1.html" }, + { tag: "view-source:http://non.existent", userInputUrl: "view-source:http://non.existent", loadSucceed: false, url: "view-source:http://non.existent/", title: "http://non.existent/ is not available" }, + { tag: "view-source:non.existent", userInputUrl: "view-source:non.existent", loadSucceed: false, url: "view-source:http://non.existent/", title: "http://non.existent/ is not available" }, + ]; + } + + function test_viewSourceURL(row) { + WebEngine.settings.errorPageEnabled = true + webEngineView.url = row.userInputUrl; + + if (row.loadSucceed) { + verify(webEngineView.waitForLoadSucceeded()); + tryCompare(titleChangedSpy, "count", 1); + } else { + verify(webEngineView.waitForLoadFailed()); + tryCompare(titleChangedSpy, "count", 2); + } + + compare(webEngineView.url, row.url); + compare(webEngineView.title, row.title); + verify(!webEngineView.canViewSource); + } } } |